Wednesday, 7 August 2013

stack program

Description:


In this program we have to implement the stack operation by using the pointers. Here they stack operation are push and pop. Push operation is used to insert the elements into a stack and pop operation is used to remove the elements in to a stack.


#include<stdio.h>
#include<conio.h>
//typedef struct stack
struct stack_tag
{
 int *s;
 int top,size;
};
typedef struct stack_tag stack;
stack init();
void push();
int pop();
void display(stack a);
void menu()
{
 printf("1. insertion\n");
 printf("2. deletion\n");
 printf("3.display stack\n");
 printf("4.exit\n");
}
stack init()
{
 stack a;
 printf("enter size of the stack\n");
 scanf("%d",&a.size);
 a.top=-1;
 a.s=(int*)malloc(a.size*sizeof(int));
 return(a);
}
//b=init();
//push()
void push(stack *p,int x)
{
 if(p->top==p->size-1)
 {
  printf("stack is full, insertion is not possible\n");
 }
 else
 {
  p->top++;
  p->s[p->top]=x;
 }
}
//pop()
int pop(stack *p)
{
 int x;
 if(p->top==-1)//is stack empty?
  return(-1);
 else{
  x=p->s[p->top];//store top most value in x
  p->top--;
  return(x);
 }
}
//x=pop(&a);
void display(stack a)
{
 int i;
 if(a.top==-1)
 {
  printf("stack is empty\n");
  }
 else
 {
  printf("stack is as follows\n");
  for(i=a.top;i>=0;i--)//display values in the stack in reverse order
  { //since stak is LIFO
  printf("%d\n",a.s[i]);
  }
 }//end of else
}
int topmost(stack a)
{
 if(a.top==-1)
  return(-1);
 else
  return(a.s[a.top]);
}
//x=topmost(a);
void main()
{
 stack a;
 int ch,x;
 clrscr();
 a=init();//initialize members of tht structures s,top,size
 clrscr();
 printf("enter your choice\n");
 scanf("%d",&ch);
 while(ch<5)//execute loop until uses,entered choice is 5
 {
  switch(ch)
  {
   case 1:{
       printf("enter value to be inserted\n");
       scanf("%d",&x);
       break;
       }
   case 2:{
       x=pop(&a);//delete top most value in the stack
       if(x==-1)
printf("stack is empty, del not posible\n");
       else
printf("deleted value is %d\n",x);
       break;
      }
   case 3:{
      display(a);//disp value in the stack in rever order
      break;
      }
   case 4: {
x=topmost(a);
if(x==-1)
printf("stack is empty\n");
else
printf("top most value is %d\n",x);
break;
}
   }//switch
  menu();
  printf("enter ur choice\n");
  scanf("%d",&ch);
 }//while
 getch();
}

Saturday, 13 April 2013

CFC DIPLOMA EXAM MARCH/APRIL-2013 (C-09)


C-09-CM-105/C09-IT-105
3025
BOARD DIPLOMA EXAMINATION (C-09)
MARCH/APRIL-2013
DCME-FIRST YEAR EXAMINATION
COMPUTER FUNDAMENTALS AND PROGRAMMING IN C
Time: 3 hours}                                   [Total Marks: 80
Part A
Instructions: (1) Answer all questions
                (2) Each question carries three marks
(3) Answers should be brief and straight to the point and shall not exceed five simple sentences.
1.       What is the result of the conversion 49 B5(16)=?(10)?
3.       What are the different types of operating systems?
4.       Write the advantages of a computer network.
5.       List the different symbols used to draw the flowchart.
6.       What are the bitwise operators?
7.       Define string. Give example.
8.       List the uses of pointers.
9.       Define union.
10.   Write a short note on random access.
PART-B
Instructions : (1) Answer any five questions. (2) Each question carries ten marks. (3) answers should be comprehensive and the criterion for valuation is the content but not the length of the answer.
11.   What are the functions of an output device? Explain any three different types of output devices.
12.   Explain installing a new hardware using control panel
13.   Explain various Internet connection methods.
14.   (a) write the difference between the while and do-while loops. (b) Write a C program to find the given year is leap year or not.
15.   Explain the structure of a c program with an example
16.   Write a c program to find the sum of elements of a single-dimensional array.
17.   Explain about local and external variables with example.
18.   (a) Explain the two-dimensional arrays with example. (b) write a c program using pointer to compute the sum of all elements stored in an array.


Friday, 12 April 2013

what is bit, byte, kilobyte?


A bit (short for binary digit) is the smallest unit of data in a computer. A bit has a single binary value, either 0 or 1.


and one bit is a single binary value of 1 or 0

Byte = 8 bits
Kilobyte = 1024 Megabytes
Megabyte = 1024 Kilobytes
Gigabyte = 1024 Megabytes
Terabyte = 1024 Gigabytes
Petabyte = 1024 Terabytes
Excabyte = 1024 Petabytes

Sunday, 7 April 2013

Starting a program using start button


Accessing Display Properties


components of Windows


Defragmentation


Drive Space


Files and Folders


Find option


Formatting a Floppy Disk


Installing and Unstalling Hardware


Installing a Modem and printer


Installing a new Software


Uninstalling Software


System Date and Time


Files and types of files


Advantages of Windows


Features of Windows


What is Windows


Wednesday, 27 March 2013

CPU SPEED AND wordlength of the processor


cpu ppt


OCT /NOV-2011 (C-05)



C-05-CM-304
237
BOARD DIPLOMA EXAMINATION, (C-05)
OCT /NOV-2011
DCME.-III SEMESTER EXAMINATION
UNIX & C

TIME: 3 Hours]                                                                     [Total Marks :40]
PART   - A
INSTRUCTION:  (1) ANSWER ALL QUESTION AND EACH QUESTION
                                           CARRIES FOUR MARKS
                    (2)  ANSWER SHOULD BE BRIEF AND   STRAIGHT      TO  THE POINT AND SHALL NOT EXEED FIVE SIMPLE SENTENCES

1.     List any two features of multi user operating system and give two examples.
2.     Write the use of head, tail commands.
3.     Explain grep command with example.
4.     State the importance of stdin, stdout, stderrr.
5.     What is conditional operator?
6.     What is a static variable
7.     List any four symbols used in flow chart.
8.     Define self referential structure.
9.     Define MACRO with example.
10.  List bitwise logical operators with examples.

Instructions :    (1) Answer any five questions and each question carries ten marks.
                  (2) The answers should be comprehensive and the criteria for valuation   is the content but not the length of the answer.

11.   (a) explain about unix file system. (b) explain working of the following directory commands each with an example. (i) cd, (ii) mv, (iii) cp, (iv) rm
12.   (a) write a shell script to generate Fibonacci series. (b) write a shell script to find the sum of 10 numbers using for loop
13.   (a) differentiate between algorithm and flowchart. (b) write a c program to find the length of the given integer.
14.   (a) explain conditional operator in c languge. (b) explain increment and decrement operator in c language. (c) list various comparision operators in c language with examples
15.   (a) explain switch statement. (b) write a c program to print multiplication table from 1 to 10
16.   (a) explain recursion technique with an example program (b) write the syntax of while and do-while loops and explain essential difference between them.
17.   Write a c program for two matrix multiplication using arrays.
18.   Explain the following preprocessing features. (i) include, (ii) define, (iii) ifdef, (iv) ifndef




OCT /NOV-2011 (C-05)



C-05-CM-304
237
BOARD DIPLOMA EXAMINATION, (C-05)
OCT /NOV-2011
DCME.-III SEMESTER EXAMINATION
UNIX & C

TIME: 3 Hours]                                                                     [Total Marks :100]
PART   - A
INSTRUCTION:  (1) ANSWER ALL QUESTION AND EACH QUESTION
                                           CARRIES FOUR MARKS
                    (2)  ANSWER SHOULD BE BRIEF AND   STRAIGHT      TO  THE POINT AND SHALL NOT EXEED FIVE SIMPLE SENTENCES

1.     State the importance of multiuser operating system. Give two examples.
2.     Write the use of cp and mv commands.
3.     List and explain any two types of files used in UNIX.
4.     Write about chmod command with example.
5.     List any four basic data types used in c along with their storage classes.
6.     Define flow chart and list any two advantages of flowcharts.
7.     Write about arithmetic operators in c language with examples
8.     Distinguish between local and global variables.
9.     Distinguish between structure and union
10.  Write about bitwise shift operators

Instructions :    (1) Answer any five questions and each question carries ten marks.
                  (2) The answers should be comprehensive and the criteria for valuation   is the content but not the length of the answer.

11.  (a) list any six differences between algorithm and flowchart. (b) explain egrep command with suitable example.
12.  Explain about head and tail filters in Unix with an example
13.  (a) explain the usage of a static variable using a simple program. (b) explain the concept of pointer to functions.
14.  (a) explain for loop with example in c. (b) write a program to find whether given number is palindrome or not.
15.  (a) explain recursion technique with example. (b) explain break and continue statements with example.
16.  Explain various storage classes available in c language.
17.  (a) differentiate address operator and de-referencing operator. (b) write a switch statement to find whether a given character is vowel or not.

OCT /NOV-2010 (C-09)



BOARD DIPLOMA EXAMINATION, (C09)

OCT /NOV-2010
DCM-I YEAR EXAMINATION
COMPUTER FUNDAMENTALS & PROGRAMMING IN “C”2009

TIME: 3 HOURS                                                                              TOTAL MARKS:80

           
Time :3 Hours                                                                                       (Total Marks :100
1.      State the use of Secondary Storages Devices used in a Computer. List any two 2+1 devices.
2.      Convert the following :                                                                                                        3
(1011100111110.01100)2 = (?)10
3.      Define a File and list any two File types.                                                              1+2
4.      Write any three difference between Internet and intranet.                                         3
5.      Draw the flowchart to print the numbers between 1 to 10.                                       3
6.      List the rules for naming an Indentifier.                                                                     3
7.      Define a String and List any four String functions.                                                 1+2
8.      What is the purpose of calloc() function and give it’s syntax?                                2+1
9.      Give any three differences between structure and union.                                                                      3
10.  List the input functions for reading data from a file.                                                               3
PART-B                                      10*5=50


Instructions :    (1) Answer any five questions and each question carries ten marks.
                  (2) The answers should be comprehensive and the criteria for valuation   is the content but not the length of the answer.

11.   (a) Explain the function of the CPU and major functional blocks of CPU.                            4+3
 (b) What is the need of Cache memory ?
12.   What is meant by disk Defragmentation ? What is its use and how to Defragment using System tools ?        2+2+6
13.   (a) Explain about IP address and write its format                                                                  3+3
(b) What is meant by search engine and list any two search engine                             2+2
14.  (a) Write any three important features of C language.
(b) Write a C program to find the roots of a quadratic equation ax2+ bx+c.                  7
15.  (a) Give the syntaxs of iterative statements.                                                                   6
      (b) Write a C program to check whether the given numbers is perfect number or not 4
16. (a) Write  C program to find the largest number in a single dimension Array.        5
      (b) Write a C program to check whether the given string is palindrome or not.                5
17. (a) Write any four differences between call by value                                                                   4
      (b) Write a C program to print Fibonacci numbers upto                                                6
18. (a) Write any three advantages of pointers                                                                   3
      (b) Write a C program to check whether the given matrix is symmetric or no.               7
Answers:
Short:
1.      State the use of Secondary Storages Devices used in a Computer. List any two 2+1 devices.
2.      Convert the following :                                                                                                        3
(1011100111110.01100)2 = (?)10
3.      Define a File and list any two File types.                                                              1+2
4.      Write any three difference between Internet and intranet.                                         3
5.      Draw the flowchart to print the numbers between 1 to 10.                                       3
6.      List the rules for naming an Identifier.                    
Ans:
Identifier: identifier is nothing but giving the name to the variable, function name is known as the identifier
RULES OF THE IDENTIFIER:
1.       It should start with alphabetical letters only
2.       It should not star with numbers, special symbols
3.       It should not exist more than 32 characters
Key words are not used as variables
7.      Define a String and List any four String functions.                                                 1+2
8.      What is the purpose of calloc() function and give it’s syntax?                                2+1
9.      Give any three differences between structure and union. 
Structure
Union
4.       Structure stores different types of data in different locations. That is each member within a structure is assigned its own unique storagr area.
5.       All members can be accessed at a time
6.       The memory size of the structure variable is the sum of the sizes of its members.

4.       Union stores different types of data in a single memory location tha are the members that compose    a union all share the same storage area.
5.       Only one member of the union  and thus one data type can be accessed  at any one time
6.       The memory size of the union variable is the largest size of its members
                                                                   
10.  List the input functions for reading data from a file.                                                              
Long

11.   (a) Explain the function of the CPU and major functional blocks of CPU.                            4+3
 (b) What is the need of Cache memory ?
12.   What is meant by disk Defragmentation ? What is its use and how to Defragment using System tools ?        2+2+6
13.   (a) Explain about IP address and write its format                                                                  3+3
(b) What is meant by search engine and list any two search engine                             2+2
14.  (a) Write any three important features of C language.
(b) Write a C program to find the roots of a quadratic equation ax2+ bx+c.                  7
15.  (a) Give the syntaxs of iterative statements.                                                                   6
      (b) Write a C program to check whether the given numbers is perfect number or not 4
16. (a) Write  C program to find the largest number in a single dimension Array.        5
      (b) Write a C program to check whether the given string is palindrome or not.                5
17. (a) Write any four differences between call by value and call by address
Call by value
Call by reference
1.       The variable/value/expression is sent to the function is known as call by value.
1.       If the address is sent to the function it is known as call by reference
2.       Syntax: function(variable,variable2);
3.       Syntax:function(&variable,&variable2);
4.here formal parameters is variable
Ex: intx
4.       Here formal parameters is pointers
Ex:int*x
5.       If the value is sent to the function ,that value cannot be modified
6.       Whenthe address is sent to the function the value is modified by using ‘*’operator

      (b) Write a C program to print Fibonacci numbers upto  n
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c,n,I;
clrscr();
a=0; b=1;
printf(“how many no’s\n”);
scanf (“%d”,&n);
printf(“fibnoccie series are\n”);
printf(“%d\n%d\n”,a,b\n”);
for (i=1;I<=n-2;i++)
{
c=a+b;
printf(“%d\n”,c);
a=b;
b=c;
}
getch ();
}                                 
18. (a) Write any three advantages of pointers                                                                   3
Ans:
  1. Indirect accessing
  2. fast execution
  3. Dynamic memory allocation.
  4. saving the time
We can return more than one value.
      (b) Write a C program to check whether the given matrix is symmetric or no.               7