1 ) How many C++ data types are broadly classified ? A ) 2 , B ) 4 , C ) 3 , D ) 6 ,

1 )  How many C++ data types are broadly classified ?

A )  2 ,

B )   4 ,

C )   3 ,

D )   6 ,

Correct answers : -   C )   3 ,

 

2 )  What is the output of the following program ?

#include<iostream>

using namespace std;

 void f() {

static int i;

 ++i;

cout<<i<<" ";

}

main() {

 f();

f();

 f();

}

 Single choice.

A )  1 1 1 ,

B )  1 2 3 ,

C )  0 0 0 ,

B )  3 2 1 ,

Correct answers : -   B )  1 2 3 ,

 

3 )  What should be the output of the below program ?

int main()

{

int a = 1;

switch(a)

{

case 1: cout<<"One";

case 2: cout<<"Two";

case 3: cout<<"Three";

default: cout<<"Default";

}

return 0;

}

Single choice.

A )  One ,

B )  Compilation Error ,

C ) Default ,

D )  OneTwoThree ,

Correct answers : -  D )  OneTwoThree ,

 

4 )  Which one of the following is a keyword ?

A )  Size ,

B )  Key ,

C )  Jump ,

D )  Switch ,

Correct answers : -   D )  Switch ,

 

5 )  All programs can be written in terms of three types of control structures : -   _______  ,  ______   and _______ .

A )  1, 2, 3  .

B )  Sequence, selection and repetition .

C )  for, while, do while .

D ) if, if else, nested if else .

Correct answers : -   B )  Sequence, selection and repetition .

 

6 )  Signed , unsigned , long and short are some of the  ____________ . 

A )  Void ,

B )  Data ,

C )  Derived data ,

D )  Modifiers ,

Correct answers : -       D )  Modifiers ,

 

7 )  Which of the following functions / types of functions cannot have default parameters ?

A )  Member function of class ,

B )  Main() ,

C )   Member function of structure ,

D )  None of the above ,

Correct answers : -    B )  Main() ,

 

8 )   The expression ( x >Y && a < b ) is true if either the expression x >y is true or the expression a < b is true .

A )  True  ,

B )  False ,

Correct answers : -   B )  False ,

 

9 )  The modulus operator uses  ______ character .

A )  + ,

B )   * ,

C )    / ,

D )   % ,

Correct answers : -    D )   % ,

 

10 )  What is the output of the below program ?

int main()

{

int a = 10;

cout<

Single choice.

A )  11 ,

B )  12 ,

 C)  10 ,

D )   None of the above ,

Correct answers : -   C)  10 ,

 

11 )  What is the output of this program?

Note: Includes all required header files

using namespace std;

void fun(int p, int q)

{

 p = 20;

q = 10;

}

int main() {

 int p = 10;

fun(p, p);

cout << p;

return 0;

}

Single choice.

A )  10 ,

B )  20 ,

C )  Compile time error ,

D )  None of the mentioned ,

Correct answers : -   A )  10 ,

 

12 )  Which of the following term is used for a function defined inside a class ?

A )  Member Variable ,

B )  Member function ,

C )  Class function ,

D )  Classic function ,

Correct answers : -   B )  Member function ,

 

13 )  Logical AND (&&) and Logical OR (||) are  _______  operators .

A )  Equality ,

B )  Logical ,

C )  Boolean ,

D )  Special ,

Correct answers : -    B )  Logical ,

 

14 )  What is the output of this program ?

Note : -  Includes all required header files

using namespace std;

void fun(int &p)

{

p = 30;

}

int main()

{

 int p = 5;

fun(p);

cout << "New value of p is " << p;

return 0;

}

Single choice.

A )  New value of p is 5 ,

B )  New value of p is 30 ,

C )  New value of p is 15 ,

D )  None of the above ,

Correct answers : -   B )  New value of p is 30 ,


Post a Comment

0 Comments