Monday 11 February 2013

C I Mid Online Bits

1. What symbol is used to represent the connector 
(a) circle 
2. Every C Program Statement must be terminated with a 
 (c) ; 
3. The individual units of a C program is known as 
 (b) tokens 
4. Identify the wrong datatype declaration 
 (c) signed a; 
5. Array elements are stored in 
 (b) Sequential memory locations 
6. If a is an integer variable, a=5/2; will assign a value 
(a) 2 
7. How many logical operators C provides? 
 (b) 3 
8. Which of the following comments about the ++ operator is not correct 
 (c) It can be applied to an expression 
9. Compute the result of the following expression in ‘C’. A=3*4/5+10/5+8-1+7/8 
(a) 11 
10. The single character input/output functions are 
 (b) getchar and putchar 
11. The case statement in switch ( ) is separated by 
 (b) break 
12. Which of the following statements is false 
(a) The initialization part of a for statement cannot have more than one initialization 
13. If the size of an integer array is ‘n’, the number of elements that can be stored in it is 
 (d) n 
14. Two dimensional array elements are stored 
 (c) complier dependent 
15. What is the input function for reading a strings 
 (c) gets() 
16. Actual and formal parameters must agree in 
 (b) number of argument and datatypes 
17. What is the output of the following program: 
main() 
{int x,y; 
x = 40; y = 80; 
change (&x, &y); 
printf (“%d %d”, x,y); 
}change ( 
int * 
a, int * 
b) 
{int *k; 
* k = *a; 
*a = *b; 
*b = *k; 
} 
 (d) 80 40 
18. What will be the output of the following program 
void main () 
{char txt[ ] 
= 
“ 
12345\0 
abcdef”; 
printf (“%s”, txt); 
} 
(a) 12345 
19. The address operator cannot be applied to variable 
 (d) register 
20. The header file that must be included at the beginning of a C program to use a library function cos is 
 (c) math.h 
1. What is the appropriate order of refinement in a problem solving. 
(a) flow chart, pseudo code program 
2. A machine language program consists of instructions written in 
 (c) 0’s and 1’s 
3. Among the following which is not a C token 
 (d) comment 
4. Which of the following datatypes require maximum storage. 
 (c) unsigned long double 
5. How many variables of the same type can be initialized at a time with the same value 
(a) any number of variables 
6. The operator ++ is called as operator 
 (b) increment 
7. Identify the logical operator from the following: 
(a) ! 
8. Which of the following is unary operator 
 (d) _ 
9. Which operator has the lowest priority? 
 (b) comma 
10. What format is used to print a character with the printf function 
 (b) %c 
11. Identify the wrong statement: 
 (d) if a
12. Do-while loop is also called as 
(b) post tested 
 13. All the elements in the array must be 
 (c) defined 
14. Under which of the following conditions,the size of the array need not be specified? 
 (c) when initialization is a part of definition 
15. The following function is used to count and return the number of characters in a given string 
 (d) strlen() 
16. void funct (void) 
The above function declaration indicates 
(a) it returns nothing and no arguments 
17. Which of the following statements is false about call by reference 
(a) a copy of actual parameters is created 
18. What is the use of strcpy( ) function 
 (b) copies one string into another 
19. Register variables can hold ———– values 
 (d) int 
20. Which of the following is a correct way of defining a symbolic constant pie in C 
 (d) #define pie= 3.142 

1. The symbol with rounded ends is used to represent 
 (d) start/ stop 
2. A machine language program consists of instructions written in 
 (b) 0’s and 1’s 
3. The only allowed special character in a variable name is 
 (b) (under scrore) 
4. The keyword is used to define enumerated data type 
 (d) enum 
5. Which of the following is not a correct representation of the real constant in C 
(b) 15 e 0.3 
6. Output of printf(“%f”,3/4) is——— 
(a) 0.00 
7. In an expression involving || 
|| 
operator the evaluation 
 (d) will be stopped if one of its components evaluates to true 
8. M = 5, Y = M++, After executing these statements the value of M and Y are 
 (d) M=6, Y=5 
9. Which of the following arithmetic expression is invalid 
(a) 7.5 % 3 
10. What is the output of the following program 
Main( ) 
{ float a; 
int x = 6; y = 4; 
a = x/y; 
print (“%f”,a) 
} 
(a) 1.00 
11. If statement is a —————statement 
 (d) two way decision 
12. Which of the following statement causes an immediate exit from the inner most loop structure. 
 (d) break 
13. Array elements are stored in 
 (c) sequential memory locations 
14. If we don’t initialize a static array, what will be the elements set to: 
 (b) 0  
15. putchar() and getchar() are both 
 (b) input and output statements 
16. main() is 
(a) user defined function 
17. Which of the following statements is false about call by reference 
 (d) a copy of actual parameters is created 
18. What will be the output of the following program? 
void main() 
{char x[ ] 
= 
{‘s’, ‘ 
a’, NULL }; 
printf (“\n %d”, sizeof (x)); 
} 
 (d) 3 
19. If storage class is missing in the array definition , by default it will take to be 
(a) either automatic or external depending on the place of occurrence 
20. The header file that must be included at the beginning of a C program to use a library function cos is 
 (d) math.h 
1. The symbol for decision making statement is 
(d) diamond 
2. A machine language program consists of instructions written in 
 (b) 0’s and 1’s 
3. Which of the following is not a key word of C? 
 (c) main 
4. Which of the following is a scalar data type used in ‘C’ 
 (c) double 
5. A character constant is assigned within 
(a) single quotes 
6. Associativity of arithmetic operators is from 
 (c) left to right 
7. Among the following operators, whose associatively is right to left 
 (c) conditional expression 
8. The symbol for exclusive OR operator is: 
 (b) ^ 
9. x = 9 - ((12 / 3 ) + 3 * 2 ) - 1 what is the value of x. 
 (c) -2 
10. Which of following is valid syntax for printf 
 (b) printf(“%d,%d”,a,b); 
11. Identify the wrong statement: 
(a) if a
12. Give the output of the following program: 
#include < stdio.h > 
main() 
{int I=1; 
while (I < 5) 
{printf(“%d”, I); 
}} 
/* End of Main */ 
(a) Infinite loop 
13. Elements of a string are accessed by a number called as 
 (c) index 
14. If we don’t initialize a static array, what will be the elements set to: 
(a) 0 
15. The statements that prints out the character set from A-Z is, where a is an integer variable 
 (d) for(a=’A’ a<=‘Z’, a++) printf(“%c”; a); 
16. The values of actual arguments are assigned to the formal arguments on a basis 
 (c) one to one 
17. Recursive functions are 
 (d) easy to code 
18. To convert the string of upper case letters to lower case letters which of the following string functions is used 
 (b) strlwr() 
 
19. The following Program 
main() 
{int i = 2; 
{int i = 2,j=5; 
printf(“%d %d ”,i,j); 
}printf(“%d %d”,i,j); 
} 
 (c) Will not compile successfully 
20. Which of the following is a correct way of defining a symbolic constant pie in C 
 (c) #define pie 22/7 

1. The error in a program is called 
(a) bug 
2. Which of the following operators is not used in c 
(a) X 
3. Which of the following is a valid numeric constant 
 (d) 65432 
4. The qualifier that may precede float is 
 (d) Nothing to precede 
5. How many variables of the same type can be initialized at a time with the same value 
 (d) any number of variables 
6. main( ) 
{ int a=5; float b=10,c; 
c=b%a; 
printf(“%f”,c); 
}output is——————– 
 (b) gives an error 
7. The operator with lowest priority in the list && , + , | | , < is 
 (d) | | 
8. main( ) 
{int m=7,y; 
y=m++; 
printf(“y=%dm=%d”,y,m); 
y=–m; 
printf(“y=%dm=%d”,y,m); 
}output is———– 
(a) y=7,m=8,y=7,m=7 
9. In the expression b=6.6/a+(2*a+(3*c)/a*d)/(2/n); which operation will be performed first? 
 (b) 6.6/a 
10. for( i = 1;i !=5; i++) 
{ printf(“%d”, i+2);} What is the output ? 
 (b) 3 4 5 6 
11. Switch case construct is an alternative for 
 (d) If-else construct 
12. The while loop is terminated when the conditional expression returns 
 (b) zero 
13. The allowed data types for the index of an array 
 (b) Only int 
14. The elements of array a[5] are 
 (d) a[0] to a[4] 
15. A string in the ‘C’ language is represented by enclosing a sequence of characters in 
 (b) double quotes 
16. main() is 
 (c) user defined function 
17. Recursive functions are 
 (d) easy to code 
18. If the first string and the second string both are identical, then strcmp function returns 
(a) a value of 0 
19. The following program 
main() 
{inc(); inc(); inc(); 
}inc() 
{static int x; 
pritnf(“%d”, ++x); 
} 
 (b) Prints 1 2 3 
20. #define PI 3.14 is a kind of . 
 (b) Preprocessor directive 
1. Representing various steps in a flow diagram is called as 
(a) flow chart 
2. The function getchar( ) is used to read 
 (b) a character 
3. The individual units of a C program is known as 
(a) tokens 
5. How many variables of the same type can be initialized at a time with the same value 
(a) any number of variables 
6. Associativity of arithmetic operators is from 
 (c) left to right 
7. When && operator is used with two conditions, conditions need to be satisfied for the expression to 
be true. 
 (b) both 
8. M = 5, Y = M++, After executing these statements the value of M and Y are 
(a) M=6, Y=5 
9. Which of the following shows the correct hierarchy of arithmetic operations in C 
(a) ( ), / or *, - or + 
10. Consider the segment 
If(1) printf(“yes”); 
else printf(“no”); 
what will be the output 
 (c) yes 
11. In switch (expression) statement, the expression should evaluate to 
 (b) an integer 
12. What will be the final values of x and y? 
# include 
void main() 
{int x = 1, y = 1; 
do while (x<=8) 
{x + +; y ++; 
} while (y<=5); 
printf (“\n x= %d y = %d”, x,y); 
} 
 (c) x = 9 y = 9 
13. The value within the [] brackets in an array declaration specifies 
 (d) size of an array 
14. An array which contains two subscripts, to represent each element is called as 
 (c) two dimensional 
15. “A” is a , while ‘A’ is a 
 (b) String/character 
16. Any program in C contains atleast 
 (c) one function 
18. The function is used to find the length of the string 
 (d) strlen() 
20. Which of the following is the symbol for preprocessor 
 (b) #