You are on page 1of 51

Computer Programming (ECS-201

)

Multiple Choice Questions1) The C language consists of ____ number of keywords.
A] 32
B] 40
C] 24
D] 56
2) Which of the following is a keyword used for a storage class?
A] Printf
B] externa
l C] auto
D] scanf
3) The prototype of the function in the header file isA]Stdio.h
B] stdlib.h
C] conio.h
D] io.h
4) Preprocessor Directives are used for A] Macro Expansion
B] File Inclusion
C] Conditional Compilation
D] All of these
5) Which operator has the lowest priority ?
A] ++
B] %
C] +
D] ||
6) The type cast operator isA] (type)
B] cast()
C] //
D] “ “
7) File manipulation functions in C are available in which header file ?
A] streams.h
B] stdio.h
C] stdlib.h
D] files.h
8) Which pair of functions below are used for single xharacter I/O ?
A] getchar() and putchar()
B] scanf() and printf()
C] input() and output()
D] Non of these
9) Which function is used to read character as you type ?
A] getchar()
B] getch()

C] getche()
D] Both (B) and (C)
10) What is the output of this program ?
void main() {
int a=b=c=10;
a=b=c=50;
printf(“\n %d %d %d”,a,b,c); }
A] 50 50 50
B] Compile Time Error
C] 10 10 10
D] Three Gaebage Value
11) Which format specifier is used to print the values of double type variable
A]%If
B]%Id
C]%Iu
D] %f
12) What will be the output of the following program?
Void main ( ) {
Double x=28;
Int r;
R= x%5;
Printf (“\n r=%d”, r); }
A] r= 3
B] Run time Error
C]Compile time Error
D]None of the Above
13) What the follwing function call mean?
Strcpy(s1 , s2 );
A]copies s1 string into s2
B]copies s2 string into s1
C]copies both s1 and s2
D] None of these
14) What will be the output of the following program?
Void main( ) {
Int x []= {10,20,30,40,50};
Print f (“ \n %d %d %d %d “, x [4] ,3[x] ,x[2] ,1[x] ,x[0] ); }
A] Error
B] 10 20 30 40 50
C] 50 40 30 20 10
D]None of these
15) Which of the following is not s keyword of ‘C’ ?
A] auto
B] register
C] int
D] function
16) What will be the out put ?
Void main ( ) {
Char a[] = “INFO” ;
a + +;

printf (“ \n %s”, a); }
A] Error
B] INFO
C] NFO
D] None of these
17) Which of the following operator has right to left associativity?
A] &&
B] //
C] %
D] sizeof
18) What wiil be the output ?
Void main ( ) {
IntI ;
I=0x10+ 010+10;
Printf (“\nx=%x”, i); }
A] x= 34
B] i= 34
C] I = 22
D]Error

19) Explicit type conversion is known as
A] conversion
B] disjunction
C] separation
D] casting
20) What will be the output ?
#define SQUARE(X) X * X
void main ( ) {
printf (“\n Square = %d” , SQUARE(10+2) ); }
A] Square = 144
B] Square =32
C] Square =122
D]Square =12
21) By default a function returns a value of type
A] int
B] char
C] void
D] None of these
22) What will be the value of x after executing the program ?
void main ( ) {
int x;
x = printf(“I See, Sea in C”);
printf(“\n x= % d” , x); }
A] x= 15
B] x=2
C] Garbage value
D] Error

23) What is sizeof In ‘C’ ?
A] Operator
B] Reserve Word
C] Both (A) and (B)
D] Function
24) Study the following C program
Void main ( ) {
Int a= 0;
For ( ; a ;);
A++; }
What will be the value of the variable a, on the execution of the above program
A] I B] 0 C] –1 D] None of these
25) Which is not keyword in ‘C’ ?
A]typedef B] const C] near D] complex
26) What will be the output of the following program code ?
void main ( ) {
char a[]= “Hello World” ;
char *p ;
p=a;
printf(“\n%d%d%d%d”,sizeof(a), sizeof(p), stren (a), strlen(p) ); }
A] 11 11 10 10 B] 10 10 10 10 C] 12 12 11 11 D] 12 2 11 11
27) The meaning of arrow operator in a->b
A] ( *a).b B] a.(*b) C] a.b D] None of these
28) What will be the output of the following program code?
Void main ( ) {
Printf (“\n ABC\b\b\bInfo World”); }
A] Info world B] ABC Info world C] strxfrm D] strcut
29) Which is valid string function ?
A] strpbrk B] strlen C] strxfrm D] strcut
30) What will be the size of following structure?
Struct sample {
Static int x;
inty,z; } ;
A]6 bytes B] 2 bytes C] + bytes D] None of these
31) Which of the following function not convert floating point number to string ?
A] fcvt B] gevt C] eevt D] hcvt
32) What will be the output ?
void main ( ) {
printf(“%d”,’B’ < ‘A’ ); }
A] Error B] 1 C] 0 D] None of these
33) Which one of the following is condirionaldirective ?
A] #nifdefn B] #ifdefn C] # ifdefn D] #nifdef
34) What will be the output ?

void main ( ) {
int x;
unsigned y;
printf(“\n%d %d”, sizeof(x), sizeof(y) ); }
A] 22 B] 24 C] 44 D] None of these
35) int **x;
A]x is a pointer to pointer B] x is not pointer
C] x is long D] None of these
36) What will be the output ?
void main ( ) {
printf(“\n %d %d”, 10&20, 10/ 20); }
A] 00 B] 10 10 C] 0 30 D] 20 20
37) Which of the following is used as a string termination character ?
A] 0 B] \0 C] /0 D] None of these
38) What will be the output ?
void main ( ) {
int I= 48;
printf(“\n %c %d” ,I,I ); }
A] Error B] 48 48 C] 1 48 D] 0 48
39) A static variable by default gets initialized to
A] 0 B] blank space C] 1 D] garbage value
40) Find out on which line no .you will get an error ?
Line 1: void main ( )
Line 2: {
Line 3: print(“\n Hello World”)
Line 4: }
A] Line 1 B] Line 2 C] Line 3 D] Line 4
41) What will be the output of the following program ?
void main ( ) {
int x=10,y=20;
printf (“\n %d”,x,y); }
A] 10 B] 20 C] 10 20 D] None of these
42) Which function reallocates memory ?
A] realloc B] alloc C] malloc D] None of these
43) What will be the size of following union declaration?
Union Test {
Int x;
Char y;
Float z; } ;
A] 7 bytes B] 4bytes C] 1byte D] 4 bytes
44) A declaration float a,b; accupies ______of memory ?
A] 1 bytes B] 4bytes C] 8byte D] 16 bytes
45) What is the output of the following program ?
void main() {

Printf(“a=%d”. q++.e=10. A=c>1?d>1||e>1?100:200:300.z=80. } A] ello world B]Error Ello world C] ello world D]ello world Lo world llo world 48) which of the following is an operator in ‘C’? A] . q = (int *)p. int *q. if(x<y<z) printf(“\n Hello world”). p++. else printf(“\nGood by”).int x=40.y=30. printf(“\n %s\n%s. } A] a=300 B]a=100 C] a=200 D] None of these 50) Which among the following is a unconditional control structure? A] do-while B] if –else C] goto D] for 51) Which of the following language is predecessor to C Programming Language? A] A B]B C] BCPL D]C++ 52) C programming language was developed by A] Dennis Ritchie B]Ken Thompson C] Bill Gates D] Peter Norton 53) C was developed in the year ___ A] 1970 B] 1972 C] 1976 D] 1980 54) C is a ___ language A] High Level B] Low Level C] Middle Level D] Machine Level 55) C language is available for which of the following Operating Systems? A] DOS B] Windows C]Unix D] All of these 56) Which of the following symbol is used to denote a pre-processor statement? .a). B] $ C] @ D] None of these 49) What is the output of the following code? Void main() { Int c=0.a. d=5.q).p. A] Hello world B]Good by C]Compile time error D]None of these 46) Which of the following is not a relational operator? A]! B] != C]>= D]< 47) what will be the output ? void main(){ char *p=”Hello world”.

A] Assignment B] Increment C] Logical D] Rational 73) The operator & is used for A] Bitwise AND B] Bitwise OR C] Logical AND D] Logical OR . 57) Which of the following is a Scalar Data type A] Float B] Union C] Array D] Pointer 58) Which of the following are tokens in C? A] Keywords B]Variables C]Constants D]All of the above 59) What is the valid range of numbers for int type of data? A] 0 to 256 B] -32768 to +32767 C] -65536 to +65536 D] No specific range 60) Which symbol is used as a statement terminator in C? A] ! B] # C]~ D] .A] !B]# C] ~ D]. occupies ___ of memory A] 1 byte B] 4 bytes C] 8 bytes D] 16 bytes 70) The size of a String variable is A] 1 byte B] 8 bytes C] 16 bytes D] None 71) Which of the following is an example of compounded assignment statement? A] a = 5 B ]a += 5 C] a = b = c D] a = b 72) The operator && is an example for ___ operator.b. 61) Which escape character can be used to begin a new line in C? A] \a B] \b C] \m D] \n 62) Which escape character can be used to beep from speaker in C? A] \a B] \b C] \m D] \n 63) Character constants should be enclosed between ___ A] Single quotes B] Double quotes C] Both a and b D]None of These 64) String constants should be enclosed between ___ A] Single quotes B] Double quotes C] Both a and b D]None of These 65) Which of the following is invalid? A] ‘’ B] “ “ C] ‘a’ D] ‘abc’ 66) The maximum length of a variable in C is ___ A] 8 B] 16 C] 32 D] 64 67) What will be the maximum size of a float variable? A] 1 byte B] 2 bytes C] 4 bytes D] 8 bytes 68) What will be the maximum size of a double variable? A] 1 byte B] 4 bytes C] 8 bytes D] 16 bytes 69) A declaration float a.

Which of the following is a ternary operator? A] ? B] * C] sizeof D]^ 86) What will be the output of the expression 11 ^ 5? A]5 B]6 C] 11 D]None of these 87) The type cast operator is A] (type) B]cast() C]// D] " " 88) Explicit type conversion is known as A] Casting B] Conversion C] Disjunction D] Separation 89) The operator + in a+=4 means A] a = a + 4 B] a + 4 = a C] a = 4 D] a = 4 + 4 . It is used to know which operator A] is most important B] is used first C] is faster D] operates on large numbers 77) The bitwise AND operator is used for A] Masking B] Comparison C] Division D] Shifting bits 78) The bitwise OR operator is used to A] set the desired bits to 1 B] set the desired bits to 0 C] divide Numbers D] multiply numbers 79) Which of the following operator has the highest precedence? A ] * B] == C] => D] + 80) The associativity of !operator is A] Right to Left B] Left to Right C] (a) for Arithmetic and (b) for Relational D] (a) for Relational and (b) for Arithmetic 81) Which operator has the lowest priority? A]++ B]% C]+ D]|| 82) Which operator has the highest priority? A]++ B]% C]+ D]|| 83) Operators have precedence.74) The operator / can be applied to A] integer values B] float values C] double values D] All of these 75) The equality operator is represented by A] := B] . A Precedence determines which operator is A]faster B] takes less memory C] evaluated first D]takes no Arguments 84) Integer Division results in A] Rounding the fractional part B] truncating the fractional part C] Floating value D]An Error is generated 85) .EQ. C] = D]== 76) Operators have hierarchy.

h 102) malloc() function used in dynamic allocation is available in which header file? A] stdio.h D] strcmp.h C] stdlib.h D] mem. A] Getchar() and putchar() B] Scanf() and printf() C] Input() and output() D] None of these 94) The printf() function retunes which value when an error occurs? A]Positive value B]Zero C] Negative value D]None of these 95) Identify the wrong statement A] putchar(65) B] putchar('x') C] putchar("x") D] putchar('\n') 96) Which of the following is charecter oriented console I/O function? A] getchar() and putchar() B] gets() and puts() C]scanf() and printf() D] fgets() and fputs() 97) The output of printf("%u".h 103) File manipulation functions in C are available in which header file? A] streams.h B] stdlib. -1) is A] -1 B] minimum int value C] maxiumint value D] Error message 98) An Ampersand before the name of a variable denotes A] Actual Value B] Variable Name C] Address D] Data Type 99) Symbolic constants can be defined using A] # define B] const C] symbols D] None of these 100) Null character is represented by A] \n B] \0 C] \o D] \e 101) Which header file is essential for using strcmp() function? A] string.h B] stdio.h D] files.h C] conio.90) p++ executes faster than p+1 because A] p uses registers B] p++ is a single instruction C] ++ is faster than + D] None of these 91) Which of the following statements is true? A] C Library functions provide I/O facilities B] C inherent I/O facilities C] C doesn’t have I/O facilities D] Both (a) and (c) 92) Header files in C contain A] Compiler commands B] Library functions C] Header information of C programs D] Operators for files 93) Which pair of functions below are used for single character I/O.h 104) C supports how many basic looping constructs .h C] text.h B] strings.

h C] files. relational. relational. assign. B] : C] NULL D] . assignment 114) Which of the following is a key word is used for a storage class A] printf B] external C] auto D]scanf 115) In the C language 'a’ represents A] a digit B] an integer C] a character D] a word 116) The number of the relational operators in the C language is A] Four B] Six C] Three D] One 117) A compound statement is a group of statements included between a pair of A] double quote B] curly braces C] parenthesis D] a pair of /’s . If Parenthesis are not present.h B] strings. 106) What should be the expression return value for a do-while to terminate A] 1 B] 0 C] -1 D] NULL 107) Which among the following is a unconditional control structure A] do-while B] if-else C] goto D] for 108) continue statement is used A] to go to the next iteration in a loop B] come out of a loop C] exit and return to the main function D] restarts iterations from beginning of loop 109) Which operator in C is called a ternary operator A] if.A] 2 B] 3 C] 4 D] 6 105) A statement differs from expression by terminating with a A] . arithmetic. the order will be A] Assignment.. assignment C] Assignment.then B] ++ C] ? D] () 110) Which of the following header file is required for strcpy() function? A ]string. arithmetic D] Arithmetic.h D] strcpy() 111) The meaning of conversion character for data input is A] Data item is a long integer B] Data item is an unsigned decimal integer C] Data item is a short integer D] None of the above 112) The conversion characters for data input means that the data item is A] An unsigned decimal integer B] A short integer C] A hexadecimal integer D] A string followed by white space 113) An expression contains relational. ment and arithmetic operators. arithmetic. relational B] Relational.

a Union is A ] memory location B] memory store C] memory screen D] None of these 121) When the main function is called. who will determined this A] programmer B] compiler C] parameter D]None of these 124) A pointer to a pointer in a form of A] multiple indirection B] a chain of pointers C] both a and b D] None of these 125) Pointers are of A] integer data type B] character data type C] unsigned integer data types D] None of these 126) Maximum number of elements in the array declaration int a[5][8] is A ] 28 B] 32 C] 35 D] 40 127) If the size of the array is less than the number of initializers then. it is called with the arguments A ]argc B] argv C] None of these D] both a & b 122) A multidimensional array can be expressed in terms of A] array of pointers rather than as pointers to a group of contiguous array B] array without the group of contiguous array C] data type arrays D] None of these 123) C allows arrays of greater than two dimensions. A ] Extra values are being ignored B ] Generates an error message C ] Size of Array is increased D ] Size is neglected when values are given 128) Array subscripts in C always start at A ] -1 B] 1 C] 0 D] Value provided by user 129) A Structure A ] can be read as a single entity .118) A Link is A] a compiler B] an active debugger C] a C interpreter D] a analyzing tool in C 119) The continue command cannot be used with A ] for B] switch C] do D] while 120) In C.

Give syntax of simple if stmt 30. What is logical variable? 9. Give syntax of simple nested if – else stmt? 32. Which are unformatted input output functions? 23. What are major disadvantages of machine code? 18. Which are relational operator? 20. Which are formatted input output functions? 24. What is process loop? 35. What is the use of getchar() function? 25. What is purpose of language processor? 17. How long is a byte? 12. What is Logical Error? 37. What is the use of getch() function? 26. Give the general syntax of conditional operator? 19. What is main difference between variable and constant? 8. What is constant? 3. What is Syntax Error? 36. What is Run Time Error? 38. How long is word? 11. What is language processor? 16. How many bytes are required to store float type value? 5. Which are Bitwise Operators? 22. What is nested loop? 34. Give general Syntax to declare One dimensional array 40. Define Array 39. Give general Syntax to declare two dimensional array 41. How many bytes are required to store integer type value? 4. Give syntax of simple if – else stmt 31. Which are logical Operators? 21.B ] cannot be read as a single entity C ] can be displayed as a single entity D ] has member variables that cannot be read individually 130) Identify the invalid pointer arithmetic A] Addition of float value to a pointer B] Comparision of pointers that do not point to the element of the same array C] Subtracting an integer from a pointer D] Assigning the value 0 to a pointer variable Short Questions 1. What is the use of getche() function? 27. Whether the program in c can be executed by computer directly ? 15. How many bytes are required to store char type value? 6. What is Disk IO Function? 28. What is function? 42. What do you mean by consol IO functions? 29. What is variable? 2. Define Program 33. Describe the appearance of machine code? 14. What is built in function? . What is global variable? 10. How does a programmer finds coding errors? 13. How many bytes are required to store double type value? 7.

10. What is the use of rewind()? 67. 11. 12. . 16. 6. Whether Structured programming helps in reducing errors? 57. 13. Give the syntax for Closing File 62. 8. What do you mean by call by value? 51. 19. What is the use of strcpy() function? 49. 3. 4. 2. Explain logical operators and expressions used in C? Explain the following g functions a. What is the use of strcmp() function? 46. What is structure? 54. 17. Enlist the features of C. What is the use of feof()? Questions 1. Give the syntax for opening File 61. 5. What is the use of fseek()? 66. What is use of typedef? 56. 9. 22.Explain applications of array. 25. What is the use of strrev() function? 47. 15. What is fclose()? 64. 21. 23.Explain with example ++i and i++. Give any two features of preprocessor 59. i)getch() and ii) clrscr() Explain printf() and scanf() function with an example Explain syntax and use of Do__While statement Which looping statements does C provides?Explain any one.e. What is preprocessor ? 58. What do you mean by call by reference? 52. Explain different data types used in C language? Explain type identifiers in C? Explain in brief structure of C programming? 5. Expalin one dimensional array with an example Explain Two dimensional array with an example.43. Explain continue and break statements with the help of example. What is use of return statement? 44. 26. What is the use of strlen() function? 48. print &scanf functions? What is variable? What are the rules for defining variables? Differentiate between local variable and global variable? Explain symbolic constants used in C? Explain any two bitwise operator with suitable example. What is main difference between structure and union? 55. 18. 7. What is recursive function? 50.What is operator enlist all operators used in C? What is data type explain the any four data types used in C language? Explain the difference between ‘=’ and ‘==’ operator explain with example? Write a short note precedence & order of evaluation? Differentiate between relational and logical operators used in C? Write short note on Input & Output functions used in C (i. What is pointer? 53. 24. 20. Expalin the difference between swith and nested if else with an example? What is array? How to declare array?Explain with suitable example. What is fopen()? 63. What is the use of strcat() function? 45. 14. Explain switch statement with its syntax and example. What is the use of ftell()? 65. Give the syntax for defining File 60.

34. 41. Explain the difference between calling function and called function? Explain void function? Explain what is pointer?expalin with suitable example. 55. 40. 54. 48. Explain how to access a value using pointer?give a suitable example. Explain dynamic memory allocation in brief. 67. 28. 71. Explain features of preprocessors What is a pre-processor explain #include . 62. What is string constant?How is string constant is differ from character constant? List out the five arithmetic operators in C. Explain pointer to structure in detail. What is the associtivity rules involve in this operator. What is swaping? Explain it with suitable program without using third variable.27. 70. 61. 73. 44. 46. 66. Explain function with argument and return type. 58. 36. 35. 33. 64. Explain pointer to function in detail. What is function ?how function is defined. 69. Describe programming approach. 59. 45. What is type casting? Explain it with suitable example. Explain Automatic . Explain the following types of file i)Sequential ii)Index Sequential iii)Direct File What is advantage of representing an array of string by an array of pointer to string. 53. Explain the use of Typedef Explain directives. What are the rule of to use period(.Enlist them. 38. Explain array of pointers. 63. . What is null string ?What is it’s length? What are static variable? Compare with standard local variable.#define Explain 1)fprintf() ii)fscanf() . 72. 60. Explain any 4 string functions with suitable example? What is the difference between call by value and call by Reference? What is recursion explain with suitable example. Explain array of structure with example Explain Nested structure with example.) operator. 50. Explain * operator and & operator with example. 68. 47. Explain the following functions with example 1)getchar() 2)putchar() Explain the following functions with example 1)getche() 2)putche() Explain sizeof operator with example. Explain Extern storage class. Write a short note on file handling in C Explain the following i)rewind ii)feof Distinguish between the following getch and getc putch and putc putc and getc What is command line argument? Explain command line argument with example What is macro? Explain with example Differentiate between if-else-if and switch statement. 43. 65. 51. Explain pointer to structure. 49. For what purpose ‘\0’ is used in string operations explain with suitable example. 31. Write a short note on ternary operator and cast operator. Write a short note on pointer to pointer Distinguish bet malloc and calloc() What is structure?explain with suitable example. 57. 37. Write a rule for declaring character constant. 29. 39. 52. 30. What is EOF and what value does usually have ? What are identifier and keywords? Explain it with suitable example. 32. 42. Explain conditional operator with example. 56. Static and register storage classs. What is user defined functions and built-in functions. 82.

77. What role does the fseek() plays and how many arguments does it Have? 100. 97. What is unary operator? List out the different operator involve in the unary operator. When sorting the elements of an array is it necessary to use another array to store the sorted elements explain? 102. What is the purpose of return statement 98.h function. What is mean by call by reference & call by value. What is an array and how array variable differs from ordinary variable. What is mean by the comparision and logical operator?How are they different from the arithmetic and assignment operator? 75. What is mean by conditional expression? 89. function call and return value? 103. Explain Getw() &Putw function . What is the function and list out advantages and disadvantages of functions?What is mean by function argument. 93. 92. List out applications of C language. What is the nested for loop? 91. Explain the following bitwise operators i)Bitwise AND ii) Bitwise OR iii) BitwiseXOR iv) Bitwise Left Shift v) Bitwise Right Shift 78. What is use of continue in C. What is the purpose of comma operator within which statement does the comma operator usually appear. Compare while loop and for loop with example. Explain the following stements: i)getchar() ii)putchar() iii)EOF 85. What is modulus operator and how does it operate in C. 106.Display the various data types in C. How can #define directive be continued to anew line 105. 80. List out the different operators involve for comparision and logical decision making in C. 86. What is the scanf() and how does it differ from the getchar(). What is crucial importance of main() in C. What is mean by register variable and what the scope of it? 99. 87. 76. What is the difference betweent call by reference & call by value.74. What is the difference between structure declaration and structure initialization? 108. List out the advantages of function. What is looping in C? What are the advantages of looping? 90. What are the format codes used along with the scanf(). Summarize the purpose of string. How is the #include directive is used? 104. What is the printf() and compare with putchar(). 83. What is mean by the equality operator?How do these differ from an assignment operator. What is mean by member or field of structure 107. Distinguish between binary minus and unary minus. 95. What are the salient features of standard input and output file 84. 110. What is an array indexing explain with an example 101. 94. What is an expression? How is an expression different from the variables? 82. What are the different type of statement used in C.? 96. Explain the various modes used in file operation? 109. 81. 79. 88.

Ans. .What is a computer? Draw a neat label block diagram of a computer and explain the functions of each unit.Long Questions Q1. Computer is an electronic device that takes some data as input process that data and produce some output.

Central Processing Unit .

. Eg: An algorithm to determine a student’s final grade and indicate whether it is passing or failing. The final grade is calculated as the average of four marks.Output Unit Q2. Explain the basic operations of computer? Ans. An Algorithm is a step wise analysis of the work to be done.m3. Step 1: Input m1.m2.m4 Step2: Grade ← (m1+m2+m3+m4)/4 Step3: if Grade<50 then Print “fail” else Print “pass” endif Q3.What is an algorithm? Explain. Ans.

What is an operating system.Five Basic Operations of Computer Q4. . Explain the functions and objectives of an operating system.

Main Functions Of OS •Process management functions: takes care of creation & deletion  of processes. •Command Interpretation: It takes care of interpreting user  commands & directing system resources to process the  commands. naming . scheduling of system resources to different  processes requesting them & providing mechanism for  synchronization & communication among processes. • In the absence of OS neither i/p devices will  be able to provide data to computer nor  memory will be able to store anything nor will  o/p devices be able to show the result. •Memory management processes: It takes care of allocation &  deallocation of memory space to program in need of resources.sharing & protection of  files.What are the basic flowcharting symbols? What functions does each represent? Ans.Operating System • It acts as an interface between the user and  the hardware. Q5. • A user cannot run an application program on  computer without OS. . storage . •File management : It takes care of file‐related activities  such as  organization. •Security: It protects the resources & information of computer  system against destruction & unauthorized access. Flowchart is a pictorial representation of an algorithm. • OS is essential s/w that is for computer to  become operational. retrieval .

What is a software ? How do you classify sofftware? Types of software: are.Q6.is a set of o one or morre programs designed d to control the ope eration and extend e • System Softwa he processing g capability off computer system. . th • Application A So oftware-is a se et of one or more m program m designed to o solve a spe ecific problem m or to do o a specific ta ask.

float and long double data types in bytes? Ans. Give the size of integer.System Software Q7. character. Integer = 2bytes Character=1 byte Float=4 bytes Long double=10 bytes Q8. What are the basic data types used in ‘C’? Ans. .

PRIMARY TYPE DECLERATION: ¾A variable can be used to store a value of any  data types. total. V1. ¾That is the name has nothing to do with its type.…….s. ¾A decleration statement must be end with  semicolon.function.V2.structure and pointers are  discussed. DERIVED DATA TYPES ¾The derived data types such as  array.Vn. ¾All c compilers support five fndamental data  types: 1‐integer(int) 2‐character(char) 3‐floating point(float) 4‐double‐precesion floating point(double) 5‐void ¾Many of them extended data types such as  long int and long double .Vn are the names of variables are  seprated by comma.V2……. Int number. ¾The syntax for declearing a variable is as follow: data_type V1. 3‐User‐defined data types.DATA TYPES ¾ANSI ‘C’ supports three classes of data types: 1‐Primary data types(or fundamental). EX:int count. 2‐Derived data types.

¾Limited range of integer is ‐32768 to 32767. ¾‘C’ has three classes of integer storage namely  short int. ¾A double data type number uses 64 bit (8 byte).and long int. ¾Long double use the 80 bit(10 byte). ¾The size of an integer that can be stored depend  on the computer.int. . CHARACTER TYPE ¾A single character can be defined as a  character(char) type data. ¾ANSI ‘C’ defines these types so that they can be  organized from smallest to the largest. ¾The qalifier signed are unsigned may be explicity applied to char. ¾Character are usually stored 8 bit(1 byte).INTEGER TYPES ¾Integer are whole numbers wih a range of value  supported by a particular machine. ¾When the accracy provided b a float number is  not sufficent than type doublecan be used the  define number. ¾Unsigned char have value b/w 0  to 255. ¾It use 16 bit(2 byte) word length. ¾To extend the precesion we use long double.  FLOATING POINT TYPE ¾Floating point numbers are stored in 32 bit(4  byte). ¾Signed char values from ‐128 to 127. ¾Floating point number are defined in ‘C’ by the  keyword float.

VOID TYPE ¾The void type has no values. ¾Another user defined enumarted data type. ¾The user defined data type can later be used to  declear variable. ¾It does not return an value to the calling  function. ¾The mian advantage of typedef is that we can  creae meaningfull data type names for increasing  the readability of program. ¾It takes the general form‐ typedef type    identifier. ¾This is usually used to specify the type of  function. ¾It can also play the role of generic type means  that it can represnet an of the other standard  type. What are operators? Chart various types of operators offered by ‘C’ language ? . USER DEFINE TYPES DECLERATION ¾‘C’ supports a feature known as “type definition”. ¾It allows user to define an identifier that would  represent an existing data type. Where type refers to an existing data type and  identifier new name given o the data type. ¾This function said to be void. Q9.

++  increment the value of the variable by one. x=x+1 2.then assign its value into y.Assignment Operator • • • • X=8 /* 8 is assigned to x */ Y=5 /* 5 is assigned to y */ x= x+5  can also be written as x+=5 y=y*5 can also be written as y*=5 Increment and Decrement Operator • • • • • • • These are unary operators they operate on single  operand. These operators are of two types: ‐Prefix increment/decrement ‐Postfix increment/decrement Prefix Increment/Decrement • y = ++x means first increment the value of x by  1. 1. y=x • y = ‐‐x means first decrement the value of x by  1.then assign its value into y. 2. 1. ‐‐ decrement the value of the variable by one. ++x  is equivalent to  x=x+1 ‐‐x is equivalent to x=x‐1 These operators should only be used with variables not  with constant or expressions. x = x‐1 y =x .

1. 2.  1. x = x‐1 y =x Relational Operators Operator < Meaning Less than <= == Less than or equal to Equal to != Not equal to > >= Greater than Greater than or equal to Logical Operators Operator  && || ! Meaning AND OR NOT NOT(!) Operator Condition False True Result True False .Postfix Increment/Decrement • y = x++ means first assign value of x into y  then increment the value of x by 1. • y=x x=x+1 y = x‐‐ means first  assign value of x into y then  decrement the value of x by 1. 2.

else printf(“not leap year”).h> #include<conio. .&m4). else printf(“grade=E”). } getch(). #include<stdio.&m2. else printf(“not leap year”). printf(“enter marks of 4 subjects”).&m3.per. &year).WAP to wheather the year is Leap year or not. else if(per>=55) printf(“grade=C).grade and average.Q10. Ans. total=m1+m2+m3+m4.WAP to accept four numbers andcompute their sum.h> #include<conio. scanf(“%f%f%f%f”.h> void main() { int year.12 WAP to print wheather the number is even or odd.per. } else { if(year%4==0) printf(“leap year ”).total. if(year%100==0) { if(year%400==0) printf(“leap year”). else if(per>=70) printf(“grade=B”). Ans. else if(per>=40) printf(“grade=D”). clrscr(). per=(total/400)*100. } Q. #include<stdio.m4.m2.m3. scanf(“%d”. if(per>=85) printf(“grade=A”). printf(“enter year”). Ans. getch(). } Q11.h> void main() { float m1.&m1.

fact). } printf(“factorial:%d”.#include<stdio. .14 WAP to print the sum of digits of any number.h> void main() { int num. getch(). Ans. else printf(“number is odd”). } Q. else { while(num>1) { fact=fact*num. } getch(). Ans. &num).WAP to print factorial of any number. printf(“enter  the number”). num=num-1.h> void main() { int  num. } Q13. if(num<0) printf(“no factorial of (‐)ve  number”). clrscr(). scanf(“%d”. fact=1. scanf(“%d”.&num). #include<stdio.h> #include<conio. if(num%2==0) printf(“num is even”).h> #include<conio.

} Q.&num). clrscr().h> #include<conio.16 WAP to print wheather the number is even or odd. #include<stdio. sum=sum+rem. Ans.&b. } For eg: Num=2345 Sum of digit=14 Q15.#include<stdio. else printf(“larger=c”).h> void main() { int a. Scanf(“%d”. while(num>0) { rem=num%10. getch(). sum=0. num=num/10. scanf(“%d%d%d”. Ans. c. } printf(“sum of digits=%d”.h> void main() { int num. &a.rem. . b. } else .&c).WAP to find largest among three numbers. { if(b>c) printf(“larger=b”).h> #include<conio. else printf(“larger=c”). if(a>b) { if(a>c) printf(“larger=a”). } getch().sum).

. } Q. getch(). else printf(“number is odd”). while(i<=10) { printf(“%d”. Ans.#include<stdio. #include<stdio. i=i+1. &num).h> #include<conio.h> #include<conio.i). Ans.h> void main() { int num.h> void main() { int i=1. if(num%2==0) printf(“num is even”). scanf(“%d”. } getch(). } Q.18 WAP to print numbers in reverse order with a differences of 2.17 WAP to print numbers from 1 to 10 sing while loop. clrscr().

. case 1: printf (“Monday\n”) . Case 2: St1.#include<stdio. Ans. The switch statement is used when the selection is based on the vale of single variable or of a simple expression. break . i=i‐2. What is a switch statement. break. St2. break. The value of this expression may be of type int or char. The syntax of switch statement is: switch(expression) { Case 1: St1. default: } Program: switch ( day ) { case 0: printf (“Sunday\n”) . case 3: printf (“Wednesday\n”) . Switch is a built in multiple branch selection statement in C. } getch(). Explain with a program.i). break .h> void main() { int i=10. } Q19. while(i>0) { printf(“%d”. break . case 4: printf (“Thursday\n”) . St2.h> #include<conio. but not of type double. case 2: printf (“Tuesday\n”) . break .

…… } Syntax of do while loop: do { Statement1. Q20.invalid day. Constant in ‘C’ reffered to fix Value that don’t change during the execution of program.char etc. case 5: printf (“Friday\n”) . it is not necessary in while loop.All keyword have a fix meaning and these meaning can’t be changed. default: printf (“Error -.Syntax of while loop: while(expression) { Statement 1. break . ¾ break.long.float.expression is tested first and then the body is executed. Explain the difference between while and do-while loop. The underscore character is also permitted in identifier. Ans. Keywords Ans. It is usually used as link b/w two word in long identifier. ¾ All keyword must be written in lower case. Q22. Define Identifiers and Keywords. Define the term constant and variable and its types .\n”) . ¾ Some compiler may use additional keyword that must be identified from ‘C ‘ manual.switch. break . }while(expression). It starts from alphabet. Both Upper and Lower case letters are permitted. C support several types of constants as given below: ™ Numeric Constant ™ Char Constant ™ Int Constant ™ Real Constant ™ Single Char Constant . Identifiers ¾ ¾ ¾ ¾ ¾ ¾ ¾ It refers to name of variable. Do-while loop gets executed at least once. Statement 2. Q21. In while loop .break . case 6: printf (“Saturday\n”) . Statement 2.function and Array.else. break . Generally lower case letter are commonly used. If the expression is evaluated to true then loop is again executed. Ans. ¾ ANSI ‘C‘ keyword.int. These are User defined Names. where as .

scanf(“%d”.WAP to find factorial of a number using recursion.f).digit and underscore character . float c. Q23.h> void main() { int num. #include<stdio. ¾ A variable may take different times during execution. } Int fact(int n) { . WAP to find square root of any number. eg: int a.h> #include<conio. getch().h> #include<conio. main(). ¾ Upper and Lower case are significant. } Q24.™ String Constant Variable ¾ A variable is a data name that may be used to store a data value.Recursion is a process.If a program has only one function then it must be the main() function. } #include<stdio. Explain the general syntax of a C function with eg.subject to the following condition: ¾ They must begin with letters some system permits. For eg :main() { printf(“this is an example of recursion”). &num). scanf(“%d”. getch().A C program consist of one or more functions. Printf(“fact=%d”. What do you understand by recursion.b. Ans.h> int fact(int n).s). char name. void main() { int num. ‰ Variable names may consist of letters. Ans.h> #include<math. well-defined task. printf(“enter the number”). printf(“%d”.That is variable total.when a function calls itself. F=fact(num).s.Functions is a self-contained subprogram that is meant to do specific.underscore as the first character. s=sqrt(num).&num).

Declares a pointer to an int (pointer of type int *) Multiple pointers require using a * before each variable declaration int *myPtr1. } int larger(int x.l. } Q26.int factorial. Ans.b. „ Can declare pointers to any data type „ Initialize pointers to 0. getch().h> #include<conio. void main() { int a. NULL.int y). Pointers contain address of a variable that has a specific value.All the directives are executed by the preprocessor. else return y.b).What is a preprocessor? Also explain its features.&b). printf(“%d%d”. If (n==1) return (1).int y) { if(x>y) return x. There can be only one preprocessor directive on a line . l=larger(a.h> int larger(int x. *myPtr2.What is pointers. #include<stdio. or an address 0 or NULL – points to nothing (NULL preferred) Q27. } Q25. Some feature of preprocessor directives are1.When the preprocessor finds a line starting with the symbol #. „ Pointer declaration „ * used with pointer variables int *myPtr. else factorial=n*fact(n-1). Ans.and thecompiler does not receive any line starting with # symbol. return (factorial). Pre-processor is a program that processes the source code before it passes through the compiler .it consider it as a command for itself and works accordingly. 2. • The lines starting with # are known as preprocessor directives.&a. Pre-processor directives begin with the symbol #. Why are they needed? Ans. WAP to find the largest of two numbers using functions.

What is a macro? What points should be taken into consideration while defining macros? Ans. A[9] • double B[20] An array of twenty long floating point numbers B[0]. So functions are slow but take less memory while macros are fast but occupy more memory due to duplicity of code Q30. How to declare and access array elements? Ans. • For example – #define PI 3. A[1]. 5. A directive is active from the point of its appearance till the end of program. There is no semicolon on a line 4.Conditional compilation Q28. etc. A macro is expanded into inline code so the text of macro is inserted into the code for each macro call. • • • Ans. • Macro_expansion can be any text. Main functions performed by preprocessor directives are1. • For ease of access to any member of array • For passing to functions as a groupint A[10] • An array of ten integers A[0].Macro with arguments 3. are also allowed • Array indexes always start at zero in C Declaring Arrays • • • Static or automatic Array size determined explicitly or implicitly Array size may be determined at run-time • Automatic only • Not in textbook .it is replaced by 3. What do you understand by arrays . • Pre-processor replaces all the occurrence of macro_name with the macro_expansion. B[19] • Arrays of structs. unions.Simpe macro substitution 2. regardless of the number of times it is called so the use of functions makes the code smaller. Hence macro makes the code lengthy and the compilation time increases.14 – #define MAX 100 • Pre-processor searches for the macro_name in the source code and replaces it with macro expansion.3. ….the passing of arguments and returning a value takes some time and hence the execution of the program becomes slow while in case of macros this time is saved and they make the program faster.We have seen macros with arguments can perform task similar to function.Differentiate between macro and functions. B[1].A collection of objects of the same type stored contiguously in memory under one name.. #define macro_name macro_expansion • Here macro_name is any valid C identifier and it is generally taken in capital letters to distinguish it from other variables. • A space is necessary between macro_name and macro_expansion. …. • For wherever the macro name PI appears in the code.On the other hand the code of a function is written only at one place. pointers.14 Q29. In function .

}. Similar elements of array can be all int or all float etc but not be the combination of various data type. #define CLASS_SIZE 73 double B[CLASS_SIZE]. Struct book b1.b3.A structure contain a number of data types together. .What is structure?. const int nElements = 25 float C[nElements]. b1 is a structure element of type book therefore it has a single entity in memory.How does a structure differ from an array? Ans. different types of data to comprise a given entity. } OUTPUT-size of iptr=2 Size of cptr=2 Wheather the pointer is point to an int.b2.#include<stdio. int s1.s2). Q31. return 0. Q32. Thus a structure gathers together. s1=size of(iptr). s2. printf(“size of cptr=%d\n”. s2=size of(cptr). Ans. int *cptr. The elements of array can be accessed by sing suffix with array name. a char or long type of objects.a float. getch().• Outside of any function – always static int A[13]. float price. Consider the following structure: Struct book { char name[10].Write a program to find the size of a pointer. clrscr(). printf(“size of iptr=%d\n”.h> main() { int *iptr. Q33. The elements of b1 can be accesed by using dot operator.Explain the rules of pointer arithmetic. These data types may or may not be of same type.the size of the pointer is always 2 bytes. int pages. On the other hand array is a collection of similar elements.s1).

Ans. getch(). WAP to print the first n terms in Fibonacci series. Q34.&num).h> #include<conio.z.i++) { z=x+y. } } if(flag==1) printf("num prime").h> #include<math. printf(“%d %d”.i++) { if(num%i==0) { printf("no.x.Ans. 6. /*WAP to print finonacci series*/ #include<stdio. scanf("%d". for(i=2.Pointer always increments or decrements to it.z).y=1. 4.h> #include<conio.h> void main() { int i. } Q36.An integer number can be substracted to pointer.Two pointer can not be added. Write a program to check whether the number is prime or not. clrscr(). not prime"). Ans.Two pointer can be compared 5. } getch(). 3. flag=0. #include<stdio. 8. clrscr().flag=1.i<10. Declaration of pointer: 1-An integer number can be added to pointer.num.Substraction of one pointer from other pointer. Write a program to check whether the number is palindrome or not. printf(“%d”. for(i=1. y=z. 2. break. . 7. x=y.s own type.y).i<sqrt(num).Pointers can nt be multiplied with a constant value. } Q37.Pointer can not be divided with a constant value.h> void main() { int x=1.

cube=rem*rem*rem.#include<stdio.&n). } Q38. clrscr(). temp.Write a program to check whether the given number is Armstrong or not.h> main() { int n. /* Write a program to check armstrong number */ #include<stdio.num<=999.h> #include<conio. while( temp != 0 ) { reverse = reverse * 10. n=n/10. reverse = reverse + temp%10. else printf("%d is not a palindrome number.cube. } . return 0. for(num=100. scanf("%d".sum.\n". n). reverse = 0. temp = n.rem. else printf(“not armstrong no”). printf("Enter a number to check if it is a palindrome or not\n"). sum=sum+cube. } if(num==sum) printf(“armstrong no.h> void main() { int num. while(num>0) { rem=n%10. temp = temp/10.num++) { n=num.”).n. n). Ans. sum=0. } getch().\n". } if ( n == reverse ) printf("%d is a palindrome number.

h> #include<conio. int c.h> #include<conio. Ans. Ans. case '*': c=a*b.Q39. */ #include<stdio.c). } Q40. printf("%d".&a. #include<stdio. scanf("%c". break. else printf(“not leap year”). &year).&op). Write a program to check the given year is leap year or not. } getch(). scanf("%d%d".c). break. scanf(“%d”.b.c).&b). if(year%100==0) { if(year%400==0) printf(“leap year”). case '-': c=a-b: printf("%d".h> void main() { char op. } else { if(year%4==0) printf(“leap year ”).a. } getch(). } . switch(op) { case '+': c=a+b: printf("%d".WAP to simulate calculator using switch statements. else printf(“not leap year”). clrscr().h> void main() { int year. printf(“enter year”). break. /* WAP to find whether year is leap year or not.

i<=3.h> #include<conio.k. WAP to print the sum of x+x^2+x^3+.i).mat3[ROW1][COL2].sum). for(j=1.h> #include<conio. while(i<=7) { fact=1.i++) .j. printf("enter the values for matrix1:"). } Q42. getch().h> #include<math.. int i. #include<stdio.i<ROW1. clrscr().j<=i. for(i=1. #include<stdio. #include<stdio.h> void main() { int i.i++) sum=sum +pow(x..x. } Q43. WAP to print the sum of series 1/1!+2/2!+3/3!+.Q41.h> void main() { float i=1.mat2[ROW2][COL2]. float sum=0. WAP to multiply two matrices . } printf("\n%f". printf("sum=%d". sum=sum+i/fact..&x)..sum=0.h> #define ROW1 2 #define COL1 3 #define ROW2 COL1 #define COL2 3 void main() { int mat1[ROW1][COL1]. scanf("%d". clrscr().fact. printf("enter the value of x:"). for(i=0.sum). i++.j.h> #include<conio. getch().j++) fact=fact*j.

j++) scanf("%d". for(i=0.i++) for(j=0. printf("enter the values for matrix2:").j<COL2. The method of assigning grade is: percent>=85 grade=A percent<85 and percent>=70 grade=B percent<70 and percent>=55 grade=C percent<55 and percent>=40 grade=D percent<40 grade=E Ans. } printf("resultant matrix"). else if(per>=70) printf(“grade=B”).total.&m3.h> #include<conio.m4.#include<stdio.j++) scanf("%d".i++) for(j=0. per=(total/400)*100. else if(per>=55) printf(“grade=C).j<COL2. } Q44.h> .m2.k++) mat3[i][j]=mat3[i]][j]+mat1[i][k]*mat2[k][j]. for(i=0.j<COL2. } Q45.h> void main() { float m1. Write a program to find minimum and maximum number in an array .&m2.&mat2[i][j]). #include<stdio.&m4).i<ROW1. printf(“enter marks of 4 subjects”).i<ROW2.mat3[i][j]).i<ROW1. else if(per>=40) printf(“grade=D”). scanf(“%f%f%f%f”. getch().m3.j++) { mat3[i][j]=0. for(k=0.j++) printf("%d". total=m1+m2+m3+m4. getch(). for(i=0.for(j=0. if(per>=85) printf(“grade=A”).j<COL1.per. printf("multiplication"). else printf(“grade=E”).&m1.&mat1[i][j]).K<COL1.i++) for(j=0.WAP to find out the grade of a student when the marks of four subjects are given.

98.4.56. getch().5.i++) { if(arr[i]==value) { printf("value is found"). scanf("%d".#include<conio.h> #define ROW 2 #define COL 3 void main() { int mat1[ROW][COL].12.value. for(i=0. Write a program for addition of two matrix .76}. Write a program to search an element in an array . if(arr[i]<min) min=arr[i] } printf("minimum=%d maximum=%d".max. } Q47.9. min=max=arr[0].h> #include<conio.i.j<COL. #include<stdio.min.&mat1[i][j]).i++) { if(arr[i]>max) max=arr[i].6.h> void main() { int i.11. for(i=0. for(i=1. printf("enter the values for matrix1:").h> #include<conio.1.mat3[ROW[COL]. } Q46.j++) scanf("%d".i++) for(j=0. printf("enter the values for matrix2:").h> void main() { int arr[10]={2. break.i<ROW. #include<stdio. getch().8.i++) .j. for(i=0.mat2[ROW][COL].i<5.i<ROW.i<10. } if(i==5) printf("value not found"). int i.&value).arr[5]={23.max). int min.3.7}.

i<ROW.i++) for(j=0.for(j=0.i++) for(j=0.mat3[i][j]). What is a preprocessor? Ans.j<COL.&mat2[i][j]). There can be only one preprocessor directive on a line 3.Simpe macro substitution 2.j<COL. printf("addition"). for(i=0.Macro with arguments 3. 2. getch().All the directives are executed by the preprocessor.When the preprocessor finds a line starting with the symbol #.j++) mat3[i][j]=mat1[i][j]+mat2[i][j].i<ROW. Main functions performed by preprocessor directives are1. There is no semicolon on a line 4.it consider it as a command for itself and works accordingly. Pre-processor directives begin with the symbol #. } Q48.j<COL.j++) printf("%d".Conditional compilation Pre-processor Directives Directives Functions #define Defines a macro substitution #undef Undefines a macro #include Specifies the files to be included #ifdef Test for macro definition #endif Specifies the end of #if #ifndef Test whether the macro is not defined #if Test a compiler time condition .and thecompiler does not receive any line starting with # symbol. printf("matrix3 after addition:"). for(i=0. Some feature of preprocessor directives are1.j++) scanf("%d". A directive is active from the point of its appearance till the end of program.The lines starting with # are known as preprocessor directives.

i++) printf(“%s%d%f”. void main() { struct student stu[10].3) .h> struct student{ char name[20]. Ans. What do you understand by hardware and software? . int i. and and not as 8 . } for(i=0.stu[i]. #include<stdio. giving 11.2 is calculated as (8 . Ans.2). In this case we say that subtraction is left associative meaning that the left most subtraction must be done first. The operator associativity rules define the order in which adjacent operators with the same precedence level are evaluated. float marks.stu[i]. giving 16. }. while(num>0) { rem=num%10. sum=0. Operator precedence determines which operator will be performed first in a group of operators with different precedence. giving 3.sum).rollno. for(i=0. scanf(“%s%d%f”. What do you understand by operator precedence and associativity? Ans. For instance 5 + 3 * 2 is calculated as 5 + (3 * 2).stu[i]. num=num/10.&stu[i]. sum=sum+rem.i<10. } Q50. WAP to print the sum of digits of any number. } printf(“sum of digits=%d”. int rollno.name. giving 7. getch().name.h> #include<conio.rem.3 .marks). For instance the expression 8 .Q49. Q52.h> #include<conio.(3 .stu[i].h> void main() { int num. getch(). } Q51. and not as (5 + 3) * 2.WAP to display the values of structure using arrays.stu[i].i++) { printf(“enter the value”).i<10.rollno.#include<stdio.2.marks).

Q53. (A & B) will give 12 which is 0000 1100 | Binary OR Operator copies a bit if it exists in eather operand. The left operands value is moved right by the number of bits specified by the right operand. The left operands value is moved left by the number of bits specified by the right operand. // definition and initialization of i int j. A << 2 will give 240 which is 1111 0000 >> Binary Right Shift Operator. The program came to be known as the software.Write short note on bitwise operators. 3. and B = 13. In information technology. on the other hand. A >> 2 will give 15 which is 0000 1111 . It produces a complete machine language program that can then be executed. connectors. 4. // assignment of j Q55. mouse. Write the difference between compiler and interpreter? Ans. 2. and printers. Compilers and interpreters have similar functions: They take a program written in some programming language and translate it into machine language. (A | B) will give 61 which is 0011 1101 ^ Binary XOR Operator copies the bit if it is set in one operand but not both. int i= 0. Ans:Bitwise operator works on bits and perform bit by bit operation. (A ^ B) will give 49 which is 0011 0001 ~ Binary Ones Complement Operator is unary and has the efect of 'flipping' bits. and peripheral devices such as the keyboard. hardware is the physical aspect of computers. includes not only the computer proper but also the cables. and then executes that instruction immediately. just translates one instruction at a time. A compiler does the translation all at once. audio speakers.that help computer to run or to do certain task. power supply units. Q54. Now in binary format they will be as follows: A = 0011 1100 B = 0000 1101 A&B = 0000 1100 A|B = 0011 1101 A^B = 0011 0001 ~A = 1100 0011 Show Examples There are following Bitwise operators supported by C language Operator Description Example & Binary AND Operator copies a bit to the result if it exists in both operands.Write the difference between initialization and assignment of variables in C? Ans: 1. (~A ) will give -60 which is 1100 0011 << Binary Left Shift Operator. Assume if A = 60.Ans. // just a definition of j j= i. An interpreter.

Multiprocessing refers to a computer system ability to support more than one process at the same time. but there are many others. Q57. in which the computer must react to a steady flow of new information without interruption. although multiprocessing sometimes implies that more then one CPU is involved. Multithreading is the ability of an operating system to execute different parts of a program called threads. including OS/2 for high end PCs. Some operating systems permit hundreds or even thousands of concurrent users. a task being a program. Real time. Expression 2. Real time operating system is systems that respond to input immediately. Multi user operating systems allow two or more users to run programs at the same time. Multi user. Classification of Operating System. It is per tested loop.Q56. Multiprocessing operating systems enable several programs to run concurrently.What are storage classes? Ans:A storage class defines the scope (visibility) and life time of variables and/or functions within a C Program. Multiprocessing.Explanation of loops or looping in c programming language by examples and questions Looping is the process of repeating of same code until a specific condition doesn’t satisfy. Multitasking is the ability to execute more than one task at the same time. They are used for such tasks as navigation. In c there are three types of loop: (a)loop (b)while loop (c)do while for loop: This loop is used when we have to execute a part of code in finite times. Syntax of for loop: for (Expression 1. This category includes operating systems designed substantially for the purpose of controlling and monitoring external activities with timing constraints.What do you understand by OS?What are the classifications of OS? Ans. MVS and UNIX are two of the most widely used multiprocessing systems. Multitasking allows more than one program one program to run concurrently. Expression 3){ Loop body } Q58. Multithreading. There are following storage classes which can be used in a C Program • auto . The operating systems of mainframes and minicomputers are multi user system. simultaneously. The terms multitasking and multiprocessing are often used interchangeably. Multithreading allows different parts of a single program to run concurrently. Multitasking.

in particular the programs that make-up the operating system. This inside a function static variable retains its value during vairous calls. This means that the variable has a maximum size equal to the register size (usually one word) and cant have the unary '&' operator applied to it (as it does not have a memory location).depending on hardware and implimentation restrictions.Storage Class register is used to define local variables that should be stored in a register instead of RAM. Register should only be used for variables that require quick access .• • • register static extern auto .Storage Class auto is the default storage class for all local variables.Storage Class static is the default storage class for global variables. Just for understanding extern is used to decalre a global variable or function in another files. Some examples of the use of C might be: • • • • • • Operating Systems Language Compilers Assemblers Text Editors Print Spoolers Network Drivers . The two variables below (count and road) both have a static storage class. then extern will be used in another file to give reference of defined variable or function. When you use 'extern' the variable cannot be initalized as all it does is point the variable name at a storage location that has been previously defined.Why to use C ? Ans C was initially used for system development work. Q59. register . It means that it MIGHT be stored in a register . static variables can be 'seen' within all functions in this source file. If this is done the variable is initalised at run time but is not reinitalized when the function is called. the static variables defined here will not be seen by the object modules that are brought in.Storage Class extern is used to give a reference of a global variable that is visible to ALL the program files. At link time. C was adoped as a system development language because it produces code that runs nearly as fast as code written in assembly language. static can also be defined within a function. static . extern . When you have multiple files and you define a global variable or function which will be used in other files also. It should also be noted that defining 'register' goes not mean that the variable will be stored in a register.such as counters.

data type int is used to define integer numbers. Ans. The definition of a variable will assign storage for the variable and define the type of data that will be held in the location. float . It reserves twice the storage for the number. char . C has the following basic built-in datatypes.data type char defines characters. The Programming language C has two main variable types • • Local Variables Global Variables Local Variables . • • • • int float double char Please note that there is not a boolean data type.• • • • Modern Programs Data Bases Language Interpreters Utilities Q60Expalin C datatypes. C has a concept of 'data types' which are used to define a variable before its use.data type double is used to define BIG floating point numbers. On PCs this is likely to be 8 bytes. Ans. before you actually try to do anything with it. int .Explain Variables. double . C does not have the traditional view about logical comparison. The C language demands that you declare the name of each variable that you are going to use and its type. but thats another story.data type float is used to define floating point numbers. The value of a variable can be changed any time. or class. A variable is just a named area of storage that can hold a single value (numeric or character). Q61.

What are functions? How to pass parameters in functions? Ans: A function is a module or block of program code which deals with a particular task. this can be stored in a pointer vairable.When a variable is declared as being a pointer to type void it is known as a generic pointer.it is not initalised by the system. Q62. Functions serve two purposes. you must initalise it yourself. • • • There are two new operators you will need to know to work with pointers. Pointers are designed for storing memory address i. The "address of" operator '&' and the "dereferencing" operator '*'.• • • Local variables scope is confined within the block or function where it is defined.e. the address of another variable. When a local variable is defined . Passing Parameters to a Function There are two ways to pass parameters to a function: • Pass by Value: mechanism is used when you don't want to change the value of passed paramters. This is very useful when you want a pointer to point to data of different types at different times. Both are prefix unary operators. What are pointers? Ans. Making functions is a way of isolating one block of code from other independent blocks of code. When parameters are passed by value then functions in C create copies of the passed in variables and do required processing on these copied variables. Hence the term Generic pointer. A pointer is a special kind of variable. . When you place an asterisk in front of a pointer you will get the value at the memory address pointed to. Second they make a block of code reusable since a function can be reused in many different contexts without repeating parts of the program text. What is void pointer? Ans:It is also called as Generic Pointer( void Pointer ). and when the block ends the variable 'dies'. • • They allow a programmer to say: `this piece of code does a specific job which stands by itself and should not be mixed up with anyting else'. Local variables must always be defined at the top of a block. It is still a pointer though. Q64. Global Variables Global variable is defined at the top of the program file and it can be visible and modified by any function that may reference it. to use it you just have to cast it to another kind of pointer first. Q63. the pointer will not point to any data and therefore cannot be dereferenced. When you place an ampersand in front of a variable you will get it's address. When execution of the block starts the variable is available. Since you cannot have a variable of type void. Declaring a pointer is the same as declaring a normal variable except you stick an asterisk '*' in front of the variables identifier.

strrchr:Find last occurrence of character c in string. Strncat:Concatenate n chracters from string src to the string dest. Strchr:Find first occurrence of character c in string.• Pass by Reference mechanism is used when you want a function to do the changes in passed parameters and reflect those changes back to the calling function. In this case only addresses of the variables are passed to a function so that function can work directly over the addresses. Strstr :Find first occurrence of string string1 in string2. String Manipulation Functions • • • • • • • • • • • Strcpy:copy source string to destination string strncpy: first n characters of string2 to stringl . . strcmp:Compare string1 and string2 to determine alphabetic order. strncmp: Compare first n characters of two strings. Q65. What are the different built-in string functions? Ans. Strcat: Concatenate string src to the string dest. Strlen:Determine the length of a string. Strtok: Parse the string s into tokens using delim as delimiter.