Search Topics....

Sunday, August 28, 2011

Questions on C Programming

Q.1 Literal means 
(A) a string.
(B) a string constant.
(C) a character.
(D) an alphabet.


Q.2 Choose the correct answer
(A) Casting refers to implicit type conversion.
(B) Coercion refers to implicit type conversion. 
(C) Casting means coercion.
(D) Coercion refers to explicit type conversion.


Q.3 printf (“%d”, printf (“tim”)); 
(A) results in a syntax error
 (B) outputs tim3
(C) outputs garbage
 (D) outputs tim and terminates abruptly


Q.4 Output of the following program fragment is
x = 5;
y = x++;
printf(“%d%d”, x, y);


(A) 5, 6
(B) 5, 5
(C) 6, 5 
(D) 6, 6

Q.5 The value of an automatic variable that is declared but not initialised will be
(A) 0
 (B) -1
(C) unpredictable
(D) none of these


Q.7 The following program fragment
int *a;
*a = 7;

(A) assigns 7 to a
(B) results in compilation error
(C) assigns address of a as 7 
(D) segmentation fault

Q.8 A pointer variable can be
(A) passed to a function as argument.
(B) changed within function.
(C) returned by a function. 
(D) assigned an integer value.


Q.9 ‘C’ is often called a
(A) Object oriented language 
(B) High level language 
(C) Assembly language 
(D) Machine level language

Q.10 The loop in which the statements within the loop are executed at least once is called 
(A) do-while 
(B) while
(C) for 
(D) goto

Q.11 The control automatically passes to the first statement after the loop in
(A) continue statement 
(B) break statement
(C) switch statement 
(D) if statement

More >>

No comments: