InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
How many types of modularization are there in c++?(a) 4(b) 3(c) 1(d) 2This question was addressed to me in quiz.The above asked question is from Modularization and Interfaces topic in chapter Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» The correct answer is (d) 2 |
|
| 2. |
How many types of returning values are present in c++?(a) 1(b) 2(c) 3(d) 4The question was asked in an online interview.I'd like to ask this question from Value Return topic in division Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» Correct OPTION is (C) 3 |
|
| 3. |
Which of the following is the default return value of functions in C++?(a) int(b) char(c) float(d) voidI had been asked this question in my homework.Question is from Functions topic in section Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» The CORRECT answer is (a) INT |
|
| 4. |
What is the scope of the variable declared in the user defined function?(a) whole program(b) only inside the {} block(c) the main function(d) header sectionI had been asked this question in an international level competition.This intriguing question originated from Function Declarations in portion Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» Correct answer is (b) only inside the {} block |
|
| 5. |
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 statusI have been asked this question in an interview.Question is taken from Pointer to Function in section Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» CORRECT choice is (C) both allocation & deallocation of memory The best I can EXPLAIN: As it is USED to execute a block of code, So we will not allocate or deallocate memory. |
|
| 6. |
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 functionsI got this question during an online interview.Asked question is from Overloaded Function Names topic in section Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» Right OPTION is (c) Two or more FUNCTIONS with the same name but different number of parameters or type |
|
| 7. |
How many types of comments are there in c++?(a) 1(b) 2(c) 3(d) 4This question was posed to me in exam.Asked question is from Comments and Indentation in section Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» The correct choice is (b) 2 |
|
| 8. |
Which operator is having the right to left associativity in the following?(a) Array subscripting(b) Function call(c) Addition and subtraction(d) Type castThis question was posed to me in an interview for job.I need to ask this question from Operators topic in division Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» Right answer is (d) Type cast |
|
| 9. |
Identify the correct statement.(a) Namespace is used to group class, objects and functions(b) Namespace is used to mark the beginning of the program(c) A namespace is used to separate the class, objects(d) Namespace is used to mark the beginning & end of the programThe question was posed to me in a national level competition.I want to ask this question from Namespaces topic in division Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» The correct ANSWER is (a) Namespace is USED to group class, objects and functions |
|
| 10. |
How many types do functions fall depends on modularization?(a) 1(b) 2(c) 3(d) 4The question was asked in an internship interview.Question is taken from Modularization and Interfaces topic in division Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» The correct ANSWER is (b) 2 |
|
| 11. |
Which symbol is used to declare the preprocessor directives?(a) #(b) $(c) *(d) ^I had been asked this question at a job interview.The doubt is from Macros topic in division Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» The correct ANSWER is (a) # |
|
| 12. |
By default how the value are passed in c++?(a) call by value(b) call by reference(c) call by pointer(d) call by objectI have been asked this question by my school teacher while I was bunking the class.Question is from Argument Passing topic in chapter Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» RIGHT ANSWER is (a) CALL by value Explanation: NONE. |
|
| 13. |
What happens to a function defined inside a class without any complex operations (like looping, a large number of lines, etc)?(a) It becomes a virtual function of the class(b) It becomes a default calling function of the class(c) It becomes an inline function of the class(d) The program gives an errorI got this question in homework.My question is based upon Functions topic in portion Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» Correct OPTION is (c) It becomes an inline function of the class |
|
| 14. |
Which is more effective while calling the functions?(a) call by value(b) call by reference(c) call by pointer(d) call by objectThe question was asked during an interview.My doubt stems from Function Declarations topic in chapter Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» CORRECT answer is (b) CALL by reference Explanation: In the call by reference, it will just passes the reference of the memory addresses of passed values rather than copying the value to NEW MEMORIES which reduces the overall time and memory USE. |
|
| 15. |
To where does the program control transfers when the exception is arisen?(a) catch(b) handlers(c) throw(d) tryThe question was posed to me during an online exam.I need to ask this question from Exceptions topic in division Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» Correct option is (b) HANDLERS |
|
| 16. |
What is an inline function?(a) A function that is expanded at each call during execution(b) A function that is called during compile time(c) A function that is not checked for syntax errors(d) A function that is not checked for semantic analysisThis question was addressed to me by my college director while I was bunking the class.The above asked question is from Functions topic in division Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» Right choice is (a) A function that is expanded at each CALL during execution |
|
| 17. |
which of the following is used to implement the c++ interfaces?(a) absolute variables(b) abstract classes(c) constant variables(d) default variablesThe question was posed to me during an online exam.This key question is from Modularization and Interfaces in chapter Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» RIGHT option is (b) abstract classes The best I can explain: Abstract classes in C++ are purposely defined for making base classes CONTAINING ATLEAST one virtual function which can be overloaded on inheritance, which means single function name for different sub-classes, hence ACTS as an interface. |
|
| 18. |
What is the maximum number of arguments or parameters that can be present in one function call?(a) 64(b) 256(c) 255(d) 16The question was asked during an online interview.This interesting question is from Unspecified Number of Arguments in section Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» RIGHT choice is (b) 256 To explain: C++ allows maximum number of 256 ARGUMENTS in a FUNCTION call. |
|
| 19. |
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 spaceThe question was asked by my school teacher while I was bunking the class.My question is taken from Overloaded Function Names in portion Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» Correct choice is (b) blank space |
|
| 20. |
Which of the following permits function overloading on c++?(a) type(b) number of arguments(c) type & number of arguments(d) number of objectsThe question was posed to me in an online quiz.The above asked question is from Overloaded Function Names in division Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» Correct option is (c) type & number of arguments |
|
| 21. |
Which operator is used to signify the namespace?(a) conditional operator(b) ternary operator(c) scope operator(d) bitwise operatorThe question was asked in a national level competition.The question is from Namespaces in chapter Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» Right option is (C) scope operator |
|
| 22. |
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 argumentsThis question was addressed to me in examination.Question is taken from Default Arguments in section Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» CORRECT answer is (c) DEFAULT arguments Explanation: As a RULE, the default argument must be FOLLOWED by default arguments only. |
|
| 23. |
Function overloading is also similar to which of the following?(a) operator overloading(b) constructor overloading(c) destructor overloading(d) function overloadingThis question was posed to me in semester exam.The doubt is from Overloaded Function Names in chapter Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» The correct answer is (b) constructor overloading |
|
| 24. |
In which of the following we cannot overload the function?(a) return function(b) caller(c) called function(d) main functionThe question was posed to me at a job interview.Question is from Overloaded Function Names in division Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» RIGHT ANSWER is (a) RETURN function To explain: While overloading the return function, it will rise a ERROR, So we can’t overload the return function. |
|
| 25. |
How many can max number of arguments present in function in the c99 compiler?(a) 99(b) 90(c) 102(d) 127This question was posed to me in an interview.This intriguing question comes from Function Declarations in section Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» The correct OPTION is (d) 127 |
|
| 26. |
What type of comments does c++ support?(a) single line(b) multiline(c) single line and multi-line(d) reusable lineThe question was posed to me at a job interview.The query is from Comments and Indentation in section Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» The CORRECT answer is (c) single line and multi-line |
|
| 27. |
The if..else statement can be replaced by which operator?(a) Bitwise operator(b) Conditional operator(c) Multiplicative operator(d) Addition operatorI had been asked this question by my college director while I was bunking the class.The question is from Statements topic in portion Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» Correct OPTION is (b) CONDITIONAL OPERATOR |
|
| 28. |
Which header file is used to pass unknown number of arguments to function?(a) stdlib.h(b) string.h(c) stdarg.h(d) stdio.hI had been asked this question in class test.I want to ask this question from Unspecified Number of Arguments in section Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» CORRECT OPTION is (c) stdarg.h The BEST I can explain: Because the cstdarg defines this HEADER file to process the unknown number of arguments. |
|
| 29. |
What will you use if you are not intended to get a return value?(a) static(b) const(c) volatile(d) voidThis question was addressed to me in final exam.I'd like to ask this question from Value Return topic in portion Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» RIGHT CHOICE is (d) VOID Easiest EXPLANATION - Void is USED to not to return anything. |
|
| 30. |
What is this operator called ?:?(a) conditional(b) relational(c) casting operator(d) unrelationalThe question was posed to me during an online exam.I would like to ask this question from Operators topic in chapter Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» RIGHT OPTION is (a) conditional To explain: In this operator, if the condition is true MEANS, it will return the first operator, otherwise second operator. |
|
| 31. |
What will happen when the exception is not caught in the program?(a) error(b) program will execute(c) block of that code will not execute(d) program will execute & displays wrong outputI have been asked this question in a national level competition.My doubt is from Exceptions topic in section Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» Right answer is (a) error |
|
| 32. |
Identify the correct statement.(a) c++ does not have built-in interfaces(b) c++ does have built-in interfaces(c) c++ have no concept of interfaces(d) c++ does have built-in interfaces & classesI had been asked this question in an interview.Origin of the question is Modularization and Interfaces in division Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» RIGHT choice is (a) C++ does not have built-in interfaces To explain: UNLIKE other programming languages like JAVA and others, C++ has no inbuilt interfaces. |
|
| 33. |
To which does the function pointer point to?(a) variable(b) constants(c) function(d) absolute variablesThe question was asked in homework.My question is based upon Pointer to Function in division Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» CORRECT OPTION is (C) function Easy explanation - A function POINTER POINTS to a function. |
|
| 34. |
What we can’t place followed by the non-default arguments?(a) trailing arguments(b) default arguments(c) both trailing & default arguments(d) leading argumentsThe question was asked during an interview.This is a very interesting question from Default Arguments in division Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» The correct answer is (b) default arguments |
|
| 35. |
What is used to write multi line comment in c++?(a) /* …. */(b) /$ ….$/(c) //(d) /$ …. */I have been asked this question in homework.My doubt is from Comments and Indentation in section Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» Right option is (a) /* …. */ |
|
| 36. |
How many types of loops are there in C++?(a) 4(b) 2(c) 3(d) 1I got this question in an interview for internship.Question is from Statements topic in division Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» CORRECT answer is (a) 4 For EXPLANATION: There are FOUR types of loop. They are the while, do while, NESTED, for the loop. |
|
| 37. |
How are many sequences of statements present in c++?(a) 4(b) 3(c) 5(d) 6The question was posed to me in a national level competition.Question is taken from Statements topic in portion Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» The CORRECT CHOICE is (C) 5 |
|
| 38. |
What does the client module import?(a) macro(b) records(c) interface(d) instanceI have been asked this question in a national level competition.I'd like to ask this question from Modularization and Interfaces topic in chapter Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» Right OPTION is (C) INTERFACE |
|
| 39. |
How many ways of passing a parameter are there in c++?(a) 1(b) 2(c) 3(d) 4I had been asked this question in an internship interview.This key question is from Argument Passing topic in chapter Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» The correct ANSWER is (C) 3 |
|
| 40. |
which of the following is used to terminate the function declaration?(a) :(b) )(c) ;(d) ]The question was posed to me in exam.This intriguing question originated from Function Declarations in section Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» Right answer is (c) ; |
|
| 41. |
What is the use of the indentation in c++?(a) distinguishes between comments and code(b) r distinguishes between comments and outer data(c) distinguishes between comments and outer data(d) r distinguishes between comments and inner dataThe question was asked in exam.This interesting question is from Comments and Indentation in portion Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» The correct CHOICE is (a) distinguishes between comments and code |
|
| 42. |
What is a comment in c++?(a) comments are parts of the source code disregarded by the compiler(b) comments are executed by the compiler to find the meaning of the comment(c) comments are executable(d) comments are executed by the compilerI have been asked this question by my college professor while I was bunking the class.The origin of the question is Comments and Indentation topic in chapter Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» Correct option is (a) COMMENTS are parts of the SOURCE code DISREGARDED by the compiler |
|
| 43. |
Which operator is having the highest precedence?(a) postfix(b) unary(c) shift(d) equalityI have been asked this question in class test.The question is from Operators topic in chapter Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» RIGHT choice is (a) postfix The BEST explanation: The operator which is having the HIGHEST precedence is postfix and lowest is EQUALITY. |
|
| 44. |
Which keyword is used to check exception in the block of code?(a) catch(b) throw(c) try(d) handlersThe question was asked during an internship interview.My doubt stems from Exceptions in section Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» CORRECT ANSWER is (c) try The best I can explain: The try() STATEMENT is used for EXCEPTIONS in c++. |
|
| 45. |
which keyword is used to define the macros in c++?(a) macro(b) define(c) #define(d) #macroThis question was addressed to me during a job interview.Question is taken from Macros in chapter Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» CORRECT OPTION is (c) #define The explanation is: #define is the KEYWORD which is USED to define the MACROS in c++. |
|
| 46. |
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) errorThe question was posed to me by my school principal while I was bunking the class.My enquiry is from Default Arguments in portion Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» The CORRECT choice is (a) default value |
|
| 47. |
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 $I got this question in examination.Query is from Overloaded Function Names topic in chapter Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» The CORRECT answer is (b) The location of variable in memory is passed to the FUNCTION so that it can use the same memory area for its processing |
|
| 48. |
What are mandatory parts in the function declaration?(a) return type, function name(b) return type, function name, parameters(c) parameters, function name(d) parameters, variablesThe question was asked in quiz.This is a very interesting question from Function Declarations in chapter Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» The correct option is (a) RETURN type, function name |
|
| 49. |
The destination statement for the goto label is identified by what label?(a) $(b) @(c) *(d) :I got this question by my college director while I was bunking the class.Question is from Statements topic in chapter Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» The correct choice is (d) : |
|
| 50. |
The switch statement is also called as?(a) choosing structure(b) selective structure(c) certain structure(d) bitwise structureThis question was posed to me in a national level competition.My question is from Statements in chapter Functions, Namespaces & Exceptions in C++ of C++ |
|
Answer» The correct ANSWER is (b) SELECTIVE structure |
|