C++ Programming - C++ Functions Multiple Choice Questions and Answers

C++ Programming : C++ Functions

C++ Functions Multiple Choice Questions with Answers and Explanations asked in Programmers Interviews in Various Companies.
1. The signature of a function is its ..... ?
[A] Function code
[B] Prototype
[C] Call
[D] Parameter list
Loading...
2. What is true about inline functions ?
[A] It's a compulsion on the compiler to make function inline
[B] It's a request to the compiler to make te function inline
[C] It's the indication to the compiler that the function is recursive
[D] It's the indication to the compiler that the function is member function
Loading...
3. Which member function of class cannot modify its objects attributes ?
[A] friend functions
[B] Private member functions
[C] Constant member functions
[D] Static member functions
Loading...
4. Which of the following parameter passing mechanism is/are supported by C++ but not in C?
[A] Pass by value
[B] Pass by reference
[C] Pass by value result
[D] All of the above
Loading...
5. Which of the following type of function is an ideal candidate for being declared inline ?
[A] A function that is small and is not called frequently
[B] A function that is small and is called frequently
[C] A function that is not small and is not called frequently
[D] A function that is not small and is called frequently
Loading...
6. One of the disadvantage of pass by reference is that the called function may inadvertently corrupt the called data.This is avoided by ?
[A] passing pointers
[B] declaring the formal parameters constant
[C] declaring the actual parameters constant
[D] all of above
Loading...
7. The library function exit() causes an exit from ?
[A] The loop in which it occurs
[B] The block in which it occurs
[C] The function in which it occurs
[D] The program in which it occurs
Loading...
8. The getche() library function
[A] returns a character when any key is pressed
[B] returns a character when ENTER is pressed
[C] displays a character on the screen when any key is pressed
[D] does not display a character on the screen
Loading...
9. When an argument is passed by reference
[A] a variable is created in function to hold the argument value
[B] the function cannot access the argument value
[C] a temporary variable is created in the calling program to hold arguments value
[D] None of these
Loading...
10. Overloaded function
[A] are a group of functions,with the same value
[B] all have the same number and types of arguments
[C] make life simpler for programmers
[D] may fail unexpectedly due to stress
Loading...

Are these questions helpful for you?



Comments: (Your feedback is valuable to us)

NAGENDRA PRASAD 2 months ago Reply

how to make function easy for +2 students


Manoj Hargude 1 year ago Reply

In a C++ language program, will an inline function be compiled inline always?
(i) Yes, always
(ii) Only sometimes
(iii) No, never
(iv) None of the above
please give me answer