1 ) A function is invoked with a _______ . A ) constructor , B ) begin ( ) , C ) function parameters , D ) function call ,

1 )  A function is invoked with a _______ .

A )  constructor ,

B )  begin ( ) ,

C )  function parameters  ,

D )  function call ,

Correct answers : -       D )  function call ,

 

2 )  Which of the following statement is correct ?

A )  Only one parameter of a function can be a default parameter .

B )  Minimum one parameter of a function must be a default parameter .

C )  All the parameters of a function can be default parameters .

D )  No parameter of a function can be default .

Correct answers : -    C )  All the parameters of a function can be default parameters .

 

3 )  The default case is required in the switch selection structure .

A ) True ,

B )  False ,

Correct answers : -   B )  False ,

 

4 )  A variable declared outside any block or function is a  ______  variable .

Correct answers : -   global .

 

5 )  Which of the following statement is correct ?

A )  A constructor is called at the time of declaration of an object .

B )  A constructor is called at the time of use of an object .

C )  A constructor is called at the time of declaration of a class .

D )  A constructor is called at the time of use of a class .

Correct answers : -   A )  A constructor is called at the time of declaration of an object .

 

6 )  Variable names must begin with  ______   . 

A )   # ,

B )  $ ,

C )  Number ,

D )  Letter ,

Correct answers : -   D )  Letter ,

 

7 )  What is the output of the following program ?

#include<iostream>

using namespace std;

 main() {

float t = 2;               

switch(t) {

 case 2: cout<<”Hi”;                

default: cout<<"Hello";

}

}

Single  choice.

A )  Hi  ,

B )  HiHello ,

C ) Hello ,

D )  Error ,

Correct answers : -   D )  Error ,

 

8 ) In CPP , members of a class are _____  by default .

A )  Public ,

B )  Protected ,

C )  Private ,

D )  Static ,

Correct answers : -   C )  Private ,

 

9 )  An array subscript should normally be of data type float .

A )  True ,

B )  False ,

Correct answers : -   B )  False ,

 

10 )  The process of determining if an array contains a certain key value is called ____ the array .

A )  sorting ,

B )  indexing ,

C )  searching ,

D )  accessing ,

Correct answers : -   C )  searching ,

 

11 )  Reusability of code in C++ is achieved through  ______ .

A ) Functions ,

B )  Arrays ,

C )  Encapsulation ,

D )  Inheritance ,

Correct answers : -   D )  Inheritance ,

 

12 )  The  ______  statement in a called function passes the value of an expression back to the calling function .

A )  return ,

B )  goto ,

C ) break ,

D )  call ,

Correct answers : -  A )  return ,

 

13 )  What is a constant that contains a single character enclosed within single quotes ?

A )  Character ,

B )  Numeric ,

C )  Fixed ,

D )  Floating point ,

Correct answers : -   A )  Character ,

 

14 )  Does both the loops in the following programs prints the correct string length ?

#include<iostream>

using namespace std;

main() {

 int i;

 char s[] = "hello";

 for(i=0; s[i]; ++i);

 cout<<i<<endl;

 i=0;

while(s[i++]);

 cout<<i;

}

Single choice.

A )  Yes , both the loops prints the correct length .

B )   Only while loop prints the correct length ,

C )  Only for loop prints the correct length ,

D )  Compile error in the program ,

Correct answers : -   C )  Only for loop prints the correct length ,

Post a Comment

0 Comments