Sail E0 Webinar

MCQs

Total Questions : 38 | Page 1 of 4 pages
Question 1. Where does the execution of the program starts?
  1.    user-defined function
  2.    main function
  3.    void function
  4.    none of the mentioned
 Discuss Question
Answer: Option B. -> main function


Normally the execution of the program in c++ starts from main only.


Question 2. What are mandatory parts in function declaration?
  1.    return type,function name
  2.    return type,function name,parameters
  3.    both a and b
  4.    none of the mentioned
 Discuss Question
Answer: Option A. -> return type,function name


In a function, return type and function name are mandatory all else are just used as a choice.


Question 3. which of the following is used to terminate the function declaration?
  1.    :
  2.    )
  3.    ;
  4.    none of the mentioned
 Discuss Question
Answer: Option C. -> ;


;


Question 4. Which is more effective while calling the functions?
  1.    call by value
  2.    call by reference
  3.    call by pointer
  4.    none of the mentioned
 Discuss Question
Answer: Option B. -> call by reference


In the call by reference, it will just copy the address of the variable to access it, so it will reduce the memory in accessing it.


Question 5. How many max number of arguments can present in function in c99 compiler?
  1.    99
  2.    90
  3.    102
  4.    127
 Discuss Question
Answer: Option D. -> 127


127


Question 6.

What is the output of this program?

#include < iostream >

using namespace std;

void mani()

void mani()

{

cout

  1.    hai
  2.    haihai
  3.    compile time error
  4.    none of the mentioned
 Discuss Question
Answer: Option C. -> compile time error


We have to use the semicolon to declare the function in line 3. If we did means, the program will execute.


Question 7.

What is the output of this program?

#include < iostream >

using namespace std;

void fun(int x, int y)

{

x = 20;

y = 10;

}

int main()

{

int x = 10;

fun(x, x);

cout

  1.    10
  2.    20
  3.    compile time error
  4.    none of the mentioned
 Discuss Question
Answer: Option A. -> 10


In this program, we called by value so the value will not be changed, So the output is 10


Question 8. How many minimum number of functions are need to be presented in c++?
  1.    0
  2.    1
  3.    2
  4.    3
 Discuss Question
Answer: Option B. -> 1


The main function is the mandatory part, it is needed for the execution of the program to start.


Question 9. What is the scope of the variable declared in the user definied function?
  1.    whole program
  2.    only inside the {} block
  3.    both a and b
  4.    none of the mentioned
 Discuss Question
Answer: Option B. -> only inside the {} block


The variable is valid only in the function block as in other.


Question 10. How many ways of passing a parameter are there in c++?
  1.    1
  2.    2
  3.    3
  4.    4
 Discuss Question
Answer: Option C. -> 3


There are three ways of passing a parameter. They are pass by value,pass by reference and pass by pointer.


Latest Videos

Latest Test Papers