Slideshow

Monday 25 February 2013


Q.31 If ‘y’ is of integer type then the expressions
3* (y − 8)/9 and (y − 8)/9 * 3
(A) must yield the same value.
(B) must yield different values.
(C) may or may not yield the same value.
(D) none of the above.
Ans: C
The expression may or may not yield the same value.
Q.32 In the following code fragment
int x, y = 2, z, a;
x=(y*=2) + (z=a=y);
printf (‘%d’,x);
(A) prints 8
(B) prints 6
(C) prints 6 or 8 depending on the compiler
(D) is syntactically wrong
Ans: A
It will print 8 because x=(y*=2)+(z=a=y)=4+4=8.
Q.33 A possible output of the following program fragment is
for (i=getchar();; i=get.char())
if (i==‘x’) break;
else putchar(i);
(A) mi (B) mix
(C) mixx (D) none of the above
Ans: D
None of the above as it is wrong syntax.
Q.34 In a for loop, if the condition is missing, then,
(A) It is assumed to be present and taken to be false.
(B) It is assumed to be present and taken to be true.
(C) It results in a syntax error.
(D) Execution will be terminated abruptly.
Ans: B
Q.35 If storage class is missing in the array definition, by default it will be taken to be
(A) automatic
(B) external
(C) static
AC05 Programming & Problem Solving Through ‘C’
AC06 Data Structures
8
(D) either automatic or external depending on the place of occurrence.
Ans: A
A variable declared inside inside a function without storage class specification is, by
default, an automatic variable.
Q.36 The maximum number of dimensions an array can have in C is
(A) 3 (B) 4
(C) 5 (D) compiler dependent
Ans: D
C allows arrays of three or more dimensions. The exact limit is determined by the
compiler.
Q.37 puts(argv[0]);
(A) prints the name of the source code file.
(B) prints argv.
(C) prints the number of command line arguments.
(D) prints the name of the executable code file.
Ans: D
argv[0] represent the filename where the executable code of the program is stored.
Q.38 printf(“%–10s”, “ABDUL”); displays
(A) ABDULbbbbb (B) bbbbbABDUL
(C) ABDULbbbbbbbbbb (D) bbbbbbbbbbABDUL
Ans: A
-10s will print ABDUL in 10 space ABDUL followed by 5 blank space.
Q.39 Which amongst the following expression uses bitwise operator?
(A) a++ (B) !a>5
(C) a|b (D) a!=b
Ans: C
| is bitwise OR.
Q.40 The output of the following program is
main( )
{ float y;
y=198.7361;
printf(“%7.2f”, y);
}
(A) 1 9 8 . 7 3 6 (B) 1 9 8 . 7 3
(C) 1 9 8 . 7 4 (D) 1 9 8 . 7 4
Ans: C
The printf statement is giving formatted output till two places of decimal.

No comments:

Post a Comment