C Programming: MCQ Set – 09

Q81: The name of all functions end with a

• (A) Pair of parenthesis
• (B) Semicolon
• (C) Braces
• (D) Colon

Q82: A self contained block of statements that perform a coherent task of some kind is called a

• (A) Monitor
• (B) Function
• (C) Program
• (D) Structure

• (A) Switch
• (B) Goto
• (C) Go back
• (D) Return

Q84: What will happen if in a C program you assign a value to an array element whose subscript exceeds the size of array?

• (A) The element will be set to 0.
• (B) The compiler would report an error.
• (C) The program may crash if some important data gets overwritten.
• (D) The array size would appropriately grow.

Q85: Consider the following recursive C function that takes two arguments. What is value of function foo when it called as foo(512, 2)?

unsigned int foo(unsigned int n,unsigned int r)
{
if(n>0)
return((n%r)+foo(n/r,r));
else
return 0;
} 
• (A) 9
• (B) 2
• (C) 8
• (D) 11

Q86: Consider the following recursive C function that takes two arguments. What is value of function foo when it called as foo(342, 10)?

unsigned int foo(unsigned int n,unsigned int r)
{
if(n>0)
return((n%r)+foo(n/r,r));
else
return 0;
} 
• (A) 11
• (B) 12
• (C) 3
• (D) 6

Q87: Which of the following is a bad example of recursion ?

• (A) Factorial
• (B) Fibonacci numbers
• (C) Tower of Hanai
• (D) Tree traversal

Q88: Recursion is sometimes called

• (A) Circular definition
• (B) Complex definition
• (C) Procedure
• (D) Union

• (A) Queue
• (B) Graph
• (C) Stack
• (D) Tree

Q90: Which of the following data structure is linear type ?

• (A) Strings
• (B) Lists
• (C) Queues
• (D) All of the above