Pages

Friday, 16 November 2012

C language objective questions


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


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.
      Ans:B



printf (“%d”, printf (“tim”));
     (A)  results in a syntax error  (B)  outputs tim3
    (C)  outputs garbage  (D)  outputs tim and terminates abruptly
 
  Ans:B printf statement will print tim3, “tim” due to inner printf statement and 3 as length due to
outer printf statement.  


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
   
  Ans:C x is incremented by 1 and before that increment the value is assigned to y so value of x=6 and
y=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
 
  Ans:C


‘C’ is often called a   
     (A)  Object oriented language  (B)  High level language
(C)  Assembly language  (D)  Machine level language
 
   Ans:B


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
  Ans:A


Recursion is sometimes called    
(A)  Circular definition  (B)  Complex definition
(C)  Procedure         (D)  Union


Unsigned integer occupies
(A)  Two bytes  (B)  Four bytes
(C)  One byte  (D)  Eight bytes
   Ans:B


Each C preprocessor directive begins with  
(A) #  (B)  include
(C)  main()  (D)  {
  Ans:A









The << operator is used for    
     (A)  Right shifting  (B)  Left shifting
(C)  Bitwise shifting  (D)  Bitwise complement
 
  Ans:B



0 comments:

Related Posts Plugin for WordPress, Blogger...

Adds