C++ MCQ -9

Question 1:

A function can not be overloaded only by its return type.

a. True

b. False

 
Question 2:

A function can be overloaded with a different return type if it has all the parameters same.

a. True

b. False

 
Question 3:

Inline functions involves some additional overhead in running time.

a. True

b. False

 
Question 4:

A function that calls itself for its processing is known as

a. Inline Function

b. Nested Function

c. Overloaded Function

d. Recursive Function

 
Question 5:

We declare a function with ______ if it does not have any return type

a. long

b. double

c. void

d. int

 
Question 6:

Arguments of a functions are separated with

a. comma (,)

b. semicolon (Wink

c. colon (Smile

d. None of these

 
Question 7:

Variables inside parenthesis of functions declarations have _____ level access.

a. Local

b. Global

c. Module

d. Universal

 
Question 8:

Observe following function declaration and choose the best answer:

int  divide ( int a, int b = 2 )

a. Variable b is of integer  type and will always have value 2

b. Variable a and b are of int type and the initial value of both variables is 2

c. Variable b is international scope and will have value 2

d. Variable b will have value 2 if not specified when calling function

 
Question 9:

The keyword endl

a. Ends the execution of program where it is written

b. Ends the output in cout statement

c. Ends the line in program. There can be no statements after endl

d. Ends current line and starts a new line in cout statement.

 
Question 10:

Strings are character arrays. The last index of it contains the null-terminated character

a. \n

b. \t

c. \0

d. \1

 

 
Answers:

1. a. True

2. b. False

3. a. True

4. d. Recursive Function

5. c. Void

6. a. Comma (,)

7. a. Local

8. d. Variable b will have value 2 if not specified when calling function

9. d. Ends current line and starts a new line in cout statement

10. c. \0

Similar Posts

  • C++ MCQ -5

    Question 1 Streams are a.       Abstraction to perform input and output operations in sequential media b.      Abstraction to perform input and output operations in direct access media c.       Objects  where a program can either insert or extract characters to and from it d.      Both a and c   Question 2 Which of the following is…

  • C++ MCQ -1

    Question 1. What is the correct value to return to the operating system upon the successful completion of a program? A. -1 B. 1 C. 0 D. Programs do not return a value.   Question 2. What is the only function all C++ programs must contain? A. start() B. system() C. main() D. program()  …

  • C++ MCQ-15

    Q.76   Which of the following expressions is illegal? (A)  ( ) 6 10 .  (B)  (false && true) (C)  bool (x) = (bool)10;  (D)  float y = 12.67;       Ans:C   Q.77  The actual source code for implementing a template function is created when   (A) The declaration of function appears. (B) The…

  • C++ MCQ-12

    Q.1   The address of a variable temp of type float is          (A) *temp  (B) &temp     (C) float& temp  (D) float temp&     Ans: B   Q.2   What is the output of the following code           char symbol[3]={ΓÇÿaΓÇÖ,ΓÇÿbΓÇÖ,ΓÇÿcΓÇÖ};            for (int index=0; index<3; index++)         cout << symbol…

  • C++ MCQ-11

    Q.31  Use of virtual functions implies (A)  overloading.  (B)  overriding. (C)  static binding.  (D)  dynamic binding. Ans: D   Q.32   this pointer      (A)  implicitly points to an object.    (B)  can be explicitly used in a class. (C)  can be used to return an object.   (D)  All of the above.    Ans: D…

  • C++ MCQ -6

    Question 1 In an assignment statement a=b; Which of the following statement is true? a.    The variable a and the variable b are equal. b.    The value of b is assigned to variable a but the later changes on variable b will not effect the value of variable a c.    The value of b is…

Leave a Reply

Your email address will not be published. Required fields are marked *