Slideshow

Monday, 25 February 2013


Q.21 A global variable is a variable
(A) declared in the main ( ) function.
(B) declared in any function other than the main ( ) function.
(C) declared outside the body of every function.
(D) declared any where in the C program.

Ans: C
A global variable is declared outside the body of every function.
Q.22 main ( ) is an example of
(A) library function (B) user defined function
(C) header (D) statement
Ans: A
main() is a special function used by C system to tell the computer where the program
starts.
Q.23 While incrementing a pointer, its value gets increased by the length of the data type to
which it points. This length is called
(A) scale factor (B) length factor
(C) pointer factor (D) increment factor
Ans: D
AC05 Programming & Problem Solving Through ‘C’
AC06 Data Structures
6
While incrementing a pointer, its value gets increased by the length of the data type to
which it points.
Q.24 The first digit of a decimal constant must be
(A) a zero (B) a non zero number
(C) a negative number (D) an integer
Ans: D
Decimal constants consist of a set of digit, 0 to 9, preceded by an optional – or + sign.
Q.25 What is the output of the following statement:
printf (“%-3d”,12345);
(A) 1 2 3 (B) -1 2 3
(C) 1 2 3 4 5 (D) 12
Ans: C
printf statement would print 12345.
Q.26 A single character input from the keyboard can be obtained by using the function.
(A) printf ( ) (B) scanf ( )
(C) putchar ( ) (D) getchar ( )
Ans: D
Reading a single character can be done by using the function getchar( ).
Q.27 The function ftell ( )
(A) reads a character from a file
(B) reads an integer from a file
(C) gives the current position in the file
(D) sets the position to the beginning of the file.
Ans: C
ftell( ) takes a file pointer and returns a number of type long, that corresponds to the
current position.
Q.28 If the variables i, j and k are assigned the values 5,3 and 2 respectively, then the
expression i = j + ( k + + = 6 ) + 7
(A) gives an error message (B) assigns a value 16 to i
(C) assigns a value 18 to i (D) assigns a value 19 to i
Ans: A
It gives an error message-Lvalue required.
Q.29 If an integer needs two bytes of storage, then the maximum value of a signed integer
is
(A) 216-1 (B) 215-1
(C) 216 (D) 215
Ans: B
If we use a 16 bit word length, the size of the integer value is limited to the range
-215 to 215-1
AC05 Programming & Problem Solving Through ‘C’
AC06 Data Structures
7
Q.30 Literal means
(A) a string (B) a string constant
(C) a character (D) an alphabet
Ans: B
Literal means a string constant.

No comments:

Post a Comment