C Programming MCQ Questions and Answers Part – 3

1991

C Programming MCQ Questions and Answers Part – 1

C Programming MCQ Questions and Answers Part – 2

C Programming MCQ Questions and Answers Part – 3

101. All standard C library <math.h> functions return what data type?
A. decimal.
B. float.
C. double.
D. int.
ANSWER: C
102. When a function is recursively called all automatic variables are ___________.
A. stored in stack.
B. stored in queue.
C. stored in array.
D. stored in linked list.
ANSWER: A
103. What is the output of the following code? main() { printf(%d\n,sum(5)); } int sum(int n) { if(n<1) return n; else return(n+sum(n-1));
A. 10.
B. 16.
C. 14.
D. 15.
ANSWER: D
104. Pointers are supported in________.
A. FORTRAN.
B. PASCAL.
C. C.
D. FORTRAN,C,PASCAL.
ANSWER: D
105. Pointer variable may be assigned_______.
A. an address value represented in hexadecimal.
B. an address value represented in octal.
C. the address of another variable.
D. an address value represented in binary.
ANSWER: C
106. The operators exclusively used in connection with pointers are________.
A. *
B. &
C. .
D. a and b
ANSWER: D
107. Identify the wrong declaration statement________.
A. int *p, a=10.
B. int a=10,*p=&a.
C. int *p=&a, =10.
D. options 1 and 2.
ANSWER: C
108. The operator % can be applied only to __________ .
A. float values.
B. double values.
C. character values.
D. integer values.
ANSWER: D
109. The address of operator returns________.
A. the address of its operand.
B. 1 value.
C. both options a and b.
D. r value.
ANSWER: A
110. Structural programming approach makes use of _________.
A. modules.
B. control structures.
C. user defined data types.
D. all of the above.
ANSWER: D
111. The number of arguments used in malloc ( ) is_______.
A. 0.
B. 1.
C. 2.
D. 3.
ANSWER: B
112. Loss in precision occurs for typecasting from____________.
A. float to double.
B. char to short.
C. float to int.
D. long to float.
ANSWER: C
113. The pointers can be used to achieve_____.
A. call by function.
B. call by reference.
C. call by name.
D. call by procedure.
ANSWER: B
114. Which among the following is odd one out?
A. printf.
B. fprintf.
C. putchar.
D. scanf .
ANSWER: D
115. Given int *p1,**p2,***p3,v=25;How to obtain the value of v using pointer variable?
A. *p1.
B. **p2.
C. ***p3.
D. all the above.
ANSWER: D
116. Identify the correct statement for given expression as________. Float fnum [10], *fptr = fnum
A. fnum is pointer variable.
B. fnum is a fixed address and not a variable.
C. fnum is an array variable.
D. fnum is an address that can be modified.
ANSWER: B
117. Given int a[5];how to declare array in the function definition if the function call is sort(a)______.
A. sort(int *a).
B. sort(int a[5]).
C. sort(int *a),sort(int a[5]).
D. sort(int a).
ANSWER: C
118. The value of EOF is_____.
A. -1
B. 0.
C. 1.
D. 10.
ANSWER: A
119. The declaration float *a[5];is_______.
A. an ordinary array.
B. a pointer to an array.
C. an array of pointers.
D. pointer to an array.
ANSWER: C
120. The arguments argc in main( ) counts_______.
A. the number of command line strings including the execution command.
B. the number of command line strings excluding the execution command.
C. the number of lines in a program.
D. the number of characters in a program.
ANSWER: A
121. In the declaration double (*pf)( ); as _________.
A. pf is a pointer to a function.
B. pf is a function returning pointer.
C. pf is a pointer to array.
D. pf is an array of pointers.
ANSWER: A
122. The operation that can be performed on pointers are______.
A. addition and subtraction of a pointer and an integer.
B. assignment of pointer using pointer expression.
C. assignment of the value 0 to a pointer.
D. all the above.
ANSWER: D
123. When applied to a variable, what does the unary & operator yield?
A. the variable value.
B. the variable address.
C. the variable format.
D. the variable right value.
ANSWER: B
124. Which of the following is the most accurate statement about runtime memory?
A. memory is allocated by using malloc ( ).
B. memory is freed by a garbage collector.
C. allocated memory can be freed by calling free ( ).
D. memory is allocated by using malloc ( ), allocated memory can be freed by calling free().
ANSWER: D
125. The storage class allowed for parameters is _________.
A. auto storage class.
B. static storage class.
C. extern storage class.
D. register storage class.
ANSWER: C
126. The function strcpy(s1,s2) in string.h __________.
A. copies s1 to s2.
B. copies s2 to s1.
C. appends s1 to end of s2.
D. appends s2 to end of s1.
ANSWER: B
127. Recursive call results when ________.
A. a function calls itself.
B. a function1 calls another function, which in turn calls the function1
C. both 1 & 2.
D. a function calls another function.
ANSWER: C
128. Which statement correctly defines a character string with a length of 4 plus 1 for the terminating NUL?
A. char string[ ];.
B. char* string[ ];.
C. char * string[5];.
D. char string[5];.
ANSWER: D
129. Which are valid?
A. Pointers can be added.
B. Pointers can be subtracted.
C. integers can be added to pointers
D. Both a and b are correct.
ANSWER: A
130. The pointers can be used to achieve _________.
A. call by function.
B. call by reference.
C. call by name.
D. call by procedure.
ANSWER: B
131. Structure is a_____.
A. scalar data type.
B. derived data type.
C. both a and b.
D. primitive data type.
ANSWER: B
132. Structure is a data type in which______.
A. each element must have the same data type.
B. each element must have pointer type only.
C. each element may have different data type.
D. no element is defined.
ANSWER: C
133. C provides a facility for user-defined data type using______.
A. pointer.
B. function.
C. structure.
D. array.
ANSWER: B
134. Structure declaration _______.
A. describes the prototype.
B. creates structure variable.
C. defines the structure-function.
D. not necessary.
ANSWER: A
135. A structure_________.
A. can be read as a single entity.
B. cannot be read as a single entity.
C. can be displayed as a single entity.
D. has a member variable that cannot be individually read
ANSWER: B
136. A structure have________.
A. pointers as its members.
B. scalar data type as its members.
C. structure as its member.
D. all the above.
ANSWER: C
137. In a structure definition________.
A. initialization of structure members are possible.
B. initialization of array of structures are possible.
C. both a and b.
D. initialization of array of structures are not possible.
ANSWER: C
138. The function putchar() uses ___________ .
A. no argument.
B. one argument that is a character variable.
C. one argument that is the ASCII value of a character.
D. one argument, that is a string.
ANSWER: A
139. The version C is also referred to as __________.
A. C10.
B. C70.
C. C89.
D. C90.
ANSWER: C
140. C program was developed at __________ laboratories.
A. USA.
B. Sun.
C. Bell.
D. C++.
ANSWER: C
141. C program can be viewed as a group of building blocks called __________.
A. groups.
B. functions.
C. statements.
D. structures.
ANSWER: B
142. All statements in the declaration and executable parts end with a __________.
A. comma.
B. bracket.
C. parenthesis
D. semicolon.
ANSWER: D
143. The smallest individual units in a C program are called __________.
A. characters.
B. symbols.
C. tokens.
D. identifiers.
ANSWER: C
144. All keywords must be written in ___________.
A. upper case.
B. lower case.
C. within codes.
D. separately.
ANSWER: B
145. ANSI C supports __________ classes of data types
A. one.
B. two.
C. three.
D. four.
ANSWER: C
146. A double data type has __________ bytes.
A. two.
B. four.
C. six.
D. eight.
ANSWER: D
147. Declaration of __________ must be done before they are used in the program.
A. variables.
B. constants.
C. loops.
D. branches.
ANSWER: A
148. The enumerated data type is a __________ data type.
A. derived data type.
B. user-defined data type.
C. primary data type.
D. fundamental data type.
ANSWER: B
149. The variable which has been declared before the main is called __________ variable.
A. local.
B. global.
C. static.
D. auto.
ANSWER: B
150. Expressions are evaluated using a __________ operator
A. conditional operators.
B. assignment operators.
C. bitwise operators.
D. special operators.
ANSWER: B

Previous articleC Programming MCQ Questions and Answers Part – 2
Next articleMCQ Questions and Answers for all Subjects
Author and Assistant Professor in Finance, Ardent fan of Arsenal FC. Always believe "The only good is knowledge and the only evil is ignorance - Socrates"