Sail E0 Webinar

MCQs

Total Questions : 18 | Page 1 of 2 pages
Question 1. What will happen after compiling and running following code?
main()
{
printf("%p", main);
}
  1.    Error
  2.    Will make an infinite loop.
  3.    Some address will be printed.
  4.    None of these.
 Discuss Question
Answer: Option C. -> Some address will be printed.
Question 2. What is function?
  1.    Function is a block of statements that perform some specific task.
  2.    Function is the fundamental modular unit. A function is usually designed to perform a specific task.
  3.    Function is a block of code that performs a specific task. It has a name and it is reusable.
  4.    All of the above
 Discuss Question
Answer: Option D. -> All of the above
Question 3. Any C program
  1.    Must contain at least one function.
  2.    Need not contain any function.
  3.    Needs input data.
  4.    None of the above
 Discuss Question
Answer: Option A. -> Must contain at least one function.
Question 4. Use of functions
  1.    Helps to avoid repeating a set of statements many times.
  2.    Enhances the logical clarity of the program.
  3.    Helps to avoid repeated programming across programs.
  4.    Makes the debugging task easier.
  5.    All of the above
 Discuss Question
Answer: Option E. -> All of the above
Question 5. Determine output:
main()
{
int i = abc(10);
printf("%d", --i);
}
int abc(int i)
{
return(i++);
}
  1.    10
  2.    9
  3.    11
  4.    None of these.
 Discuss Question
Answer: Option B. -> 9
Question 6. The default parameter passing mechanism is
  1.    call by value
  2.    call by reference
  3.    call by value result
  4.    None of these.
 Discuss Question
Answer: Option A. -> call by value
Question 7. What is the result of compiling and running this code?
main()
{
char string[] = "Hello World";
display(string);
}
void display(char *string)
{
printf("%s", string);
}
  1.    will print Hello World
  2.    Compilation Error
  3.    will print garbage value
  4.    None of these.
 Discuss Question
Answer: Option B. -> Compilation Error
Question 8. Determine output:
main()
{
int i = 5;
printf("%d%d%d%d%d", i++, i--, ++i, --i, i);
}
  1.    54544
  2.    45445
  3.    54554
  4.    45545
 Discuss Question
Answer: Option D. -> 45545
Question 9. Pick the correct statements.
I.   The body of a function should have only one return statement.
II.  The body of a function may have many return statements.
III. A function can return only one value to the calling environment.
IV. If return statement is omitted, then the function does its job but returns no value to the calling environment.
  1.    I and II
  2.    I and III
  3.    II and III
  4.    II and IV
  5.    III and IV
 Discuss Question
Answer: Option C. -> II and III
Question 10. What will be the output of the following program code?
main()
{
static int var = 5;
printf("%d ", var--);
if(var)
main();
}
  1.    5 5 5 5 5
  2.    5 4 3 2 1
  3.    Infinite Loop
  4.    Compilation Error
  5.    None of these
 Discuss Question
Answer: Option B. -> 5 4 3 2 1

Latest Videos

Latest Test Papers