Skip to content

100+ MCQS for Programming With C with Answers | NTS

computer science mcqs
Spread the love

computer science mcqs

124. max is a function that returns the larger of the two integers, given as arguments. Which of the following statements finds the largest of three given numbers?
(a) max(max(a, b), max(a, c) }
(b) max(a, max(a, c)) }
(c) max(max a, b) max(b, c) }
(d) max (b, max (a, c) }
125. Forward declaration is absolutely necessary
(a) if a function returns a non-integer quantity
(b) if the function call precedes its definition
(c) if the function call precedes its definition and the function returns a non integer quantity
(d) none of the above
126. void can be used
(a) as a data-type of a function that returns nothing to its calling environment
(b) inside the brackets of a function that does not need any argument
(c) in an expression
(d) in a print f statement
127. Any C program
(a) must contain at least one function (b) need not contain any function
(c) needs input data (d) none of the above
128. The following program
( int a = 4;
change (a);
printf (“%d”. a) ;
change (a)
int a;
( printf (“%d” , ++a) ; )
(a) 55 (b) 45 (c) 54 (d) 44
129. Choose the best answer.
Storage class defines
(a) the data type (b) the scope
(c) the scope and permanence (d) the scope, permanence and datatype

130. Which of the following is true of external variables?

(a) They provide a way for two way communication between functions.
(b) Their scope extends from the point of definition through the remainder of the program.
(e) If they are not initialized, they will have garbage value.
(d) None of the above.

computer science mcqs

computer science mcqs

149. Choose the correct statements.
(a) Address is the numeric value associated with a memory location.
(b) Two variables can have the same address.
(c) Address is bound to a variable by the compiler.
(d) Value of a variable can be an address.
150 Feature for accessing a variable through its address is desirable because
(a) call by reference can be simulated
(b) call by value can be simulated
(c) a function can return more than one value
(d) excessive use of global variables can be avoided
151. int i = 5;
is a statement in a C program. Which of the following are true?
(a) During execution, value of i may change but not its address
(b) During execution both the address and value may change
(c) Repeated execution may result in different addresses for
(d) i may not have an associated address
152. Choose the correct statements.
(a) Address operator cannot be applied to register variables.
(b) Address operator can be applied to register variables.
(c) Misuse of register declaration will increase the execution time.
(d) None of the above.
*153. Choose the best answer.
Prior to using a pointer variable
(a) it should be declared
(b) it should be initialized
(c) it should be both declared and initialized
(d) none of the above
154. The operators > and c are meaningful when used with pointers, if
(a) the pointers point to data of similar type
(b) the pointers point to structure of similar data type
(c) the pointers point to elements of the same array
(d) none of these

155. A set of names can be represented as a
(a) two-dimensional array of characters
(b) one-dimensional array of strings
(c) one-dimensional array of pointers to character
(d) none of these
156. If arr is a two dimensional array of 10 rows and 12 columns, then arr 151 logically points to the
(a) Sixth row (b) fifth row (c) fifth column (d) sixth column

157. While sorting a set of names, representing the names as an array of pointers is preferable to representing the names as a two dimensional array of characters, because
(a) storage needed will be proportional to the size of the data
(b) execution will be faster
(c) swapping process becomes easier and faster
(d) none of the above
158. The statement
int **a;
(a)is illegal
(b) is legal but meaningless
(c) is syntactically and semantically correct
(d) none of the above
· 159. Consider the following declaration.
int a, *b = &a, **c= &b;
The following program fragment
a = 4;
**c • 5;
(a) does not change the value of a (b) assigns address of c to a
(c) assigns the value of b to a (d) assigns 5 to a
· 160. If the statement
b = (int *)**c;
is appended to the above program fragment, then
(a) value of b is unaffected (b) value of b will be the address of c
(c) value of b becomes 5 (d) none of these
161. Consider the two declarations
void *voidPtr ;
char *charPtr ;
Which of the following assignments are syntactically correct?
(a) voidPtr = charPtr (b) charPtr = voidPtr
(c) *voidPtr = *charPtr (d) *charPtr = voidPtr

162. Which of the following operators can be applied to pointer variable(s)?
(a) Division (b) Multiplication (c) Casting (4) none of these
*163. Pointers an of
(a) integer datatype
(c) unsigned integer datatype
164. The address operator cannot act on
(a) R-values

(b) character datatype
(c) members of a structure
(d) none of these

computer science mcqs

Leave a Reply

Your email address will not be published.