C++ Programming MCQ (Multiple Choice Questions) - SchoolingAxis

C++ Programming MCQ (Multiple Choice Questions)

 Que- If an argument from the parameter list of a function is defined constant then _______________ 

a. It can be modified inside the function 

b. It cannot be modified inside the function 

c. Error occurs 

d. Segmentation fault 


Answer- It cannot be modified inside the function 


Que- Which of the following feature is used in function overloading and function with default argument? 

a. Encapsulation 

b. Polymorphism 

c. Abstraction 

d. Modularity 


Answer- Abstraction 


Que- From which function the execution of a C++ program starts? 

a. start() function 

b. main() function 

c. new() function 

d. end() function 


Answer- main() function 


Que- Which of the following is important in a function? 

a. Return type 

b. Function name 

c. Both return type and function name 

d. The return type, function name and parameter list 


Answer- Both return type and function name 


Que- How many ways of passing a parameter are there in c++? 

a. 1 

b. 2 

c. 3 

d. 4 


Answer- 3 


Que- Which is used to keep the call by reference value as intact? 

a. static 

b. const 

c. absolute 

d. virtual 


Answer- const 


Que- By default how the value are passed in c++? 

a. call by value 

b. call by reference 

c. call by pointer 

d. call by object 


Answer- call by value 


Que- What will happen when we use void in argument passing? 

a. It will not return value to its caller 

b. It will return value to its caller 

c. Maybe or may not be return any value to its caller 

d. It will return value with help of object 


Answer- It will not return value to its caller 


Que- How many types of returning values are present in c++? 

a. 1 

b. 2 

c. 3 

d. 4 


Answer- 3 


Que- What will you use if you are not intended to get a return value? 

a. static 

b. const 

c. volatile 

d. void 


Answer- void 


Que- Where does the return statement returns the execution of the program? 

a. main function 

b. caller function 

c. same function 

d. block function 


Answer- caller function 


Que- When will we use the function overloading? 

a. same function name but different number of arguments 

b. different function name but same number of arguments 

c. same function name but same number of arguments 

d. different function name but different number of arguments 


Answer- same function name but different number of arguments 


Que- Which of the following permits function overloading on c++? 

a. type 

b. number of arguments 

c. type & number of arguments 

d. number of objects 


Answer- type & number of arguments 


Que- In which of the following we cannot overload the function? 

a. return function 

b. caller 

c. called function 

d. main function 


Answer- return function 


Que- Function overloading is also similar to which of the following? 

a. operator overloading 

b. constructor overloading 

c. destructor overloading 

d. function overloading 


Answer- constructor overloading 


Que- Overloaded functions are ________________ 

a. Very long functions that can hardly run 

b. One function containing another one or more functions inside it 

c. Two or more functions with the same name but different number of parameters or type 

d. Very long functions 


Answer- Two or more functions with the same name but different number of parameters or type 


Que- What will happen while using pass by reference? 

a. The values of those variables are passed to the function so that it can manipulate them 

b. The location of variable in memory is passed to the function so that it can use the same memory area for its processing 

c. The function declaration should contain ampersand (& in its type declaration) 

d. The function declaration should contain $ 


Answer- The location of variable in memory is passed to the function so that it can use the same memory area for its processing 


Que- What should be passed in parameters when function does not require any parameters? 

a. void 

b. blank space 

c. both void & blank space 

d. tab space 


Answer- blank space 


Que- What are the advantages of passing arguments by reference? 

a. Changes to parameter values within the function also affect the original arguments 

b. There is need to copy parameter values (i.e. less memory used) 

c. There is no need to call constructors for parameters (i.e. faster) 

d. All of the mentioned 


Answer- All of the mentioned 


Que- If the user did not supply the value, what value will it take? 

a. default value 

b. rise an error 

c. both default value & rise an error 

d. error 


Answer- default value 


Que- Where can the default parameter be placed by the user? 

a. leftmost 

b. rightmost 

c. both leftmost & rightmost 

d. topmost 


Answer- rightmost 


Que- Which value will it take when both user and default values are given? 

a. user value 

b. default value 

c. custom value 

d. defined value 


Answer- user value 


Que- What we can't place followed by the non-default arguments? 

a. trailing arguments 

b. default arguments 

c. both trailing & default arguments 

d. leading arguments 


Answer- default arguments 


Que- If we start our function call with default arguments means, what will be proceeding arguments? 

a. user argument 

b. empty arguments 

c. default arguments 

d. user & empty arguments 


Answer- default arguments 


Que- What is the default return type of a function? 

a. int 

b. void 

c. float 

d. char 


Answer- void 


Que- Which header file is used to pass unknown number of arguments to function? 

a. stdlib.h 

b. string.h 

c. stdarg.h 

d. stdio.h 


Answer- stdarg.h 


Que- How can you access the arguments that are manipulated in the function? 

a. va_list 

b. arg_list 

c. both va_list & arg_list 

d. vg_list 


Answer- va_list 


Que- What is the maximum number of arguments or parameters that can be present in one function call? 

a. 64 

b. 256 

c. 255 

d. 16 


Answer- 256 


Que- What will initialize the list of arguments in stdarg.h header file? 

a. va_list 

b. va_start 

c. va_arg 

d. vg_arg 


Answer- va_start 


Que- To which does the function pointer point to? 

a. variable 

b. constants 

c. function 

d. absolute variables 


Answer- function 


Que- What will we not do with function pointers? 

a. allocation of memory 

b. deallocation of memory 

c. both allocation & deallocation of memory 

d. finds memory status 


Answer- both allocation & deallocation of memory 


Que- What is the default calling convention for a compiler in c++? 

a. _cdecl 

b. _stdcall 

c. _pascal 

d. _fastcall 


Answer- _cdecl 


Que- What is the mandatory part to present in function pointers? 

a. & 

b. return values 

c. data types 

d. $ 


Answer- data types 


Que- which of the following can be passed in function pointers? 

a. variables 

b. data types 

c. functions 

d. objects 


Answer- functions 


Que- What is the meaning of the following declaration? int(*ptr[5])(); 

a. ptr is pointer to function 

b. ptr is array of pointer to function 

c. ptr is pointer to such function which return type is array 

d. ptr is pointer to array of function 


Answer- ptr is array of pointer to function 


Que- which keyword is used to define the macros in c++? 

a. macro 

b. define 

c. #define 

d. #macro 


Answer- #define 


Que- Which symbol is used to declare the preprocessor directives? 

a. "#" 

b. "$" 

c. "*" 

d. " 


Answer- "#" 


Que- How many types of macros are there in c++? 

a. 1 

b. 2 

c. 3 

d. 4 


Answer- 2 


Que- What is the mandatory preprocessor directive for c++? 

a. #define <iostream> 

b. #include <iostream> 

c. #undef <iostream> 

d. #macro <iostream> 


Answer- #include <iostream> 


Que- What is the other name of the macro? 

a. scripted directive 

b. executed directive 

c. link directive 

d. executed & link directive 


Answer- scripted directive 


Que- which of the following is used to implement the c++ interfaces? 

a. absolute variables 

b. abstract classes 

c. constant variables 

d. default variables 


Answer- abstract classes 


Que- What is the ability to group some lines of code that can be included?in the program? 

a. specific task 

b. program control 

c. modularization 

d. macros 


Answer- modularization 


Que- How many types do functions fall depends on modularization? 

a. 1 

b. 2 

c. 3 

d. 4 


Answer- 2 


Que- How many types of modularization are there in c++? 

a. 4 

b. 3 

c. 1 

d. 2 


Answer- 2

Previous Post Next Post