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. |
Pick out the correct statement.(a) Pre Increment is faster than post-increment(b) post-increment is faster than Pre Increment(c) pre increment is slower than post-increment(d) pre decrement is slower than post-incrementThe question was asked in quiz.The question is from Increment and Decrement topic in chapter Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» Correct option is (a) PRE Increment is FASTER than post-increment |
|
| 2. |
What is the syntax of overloading operator + for class A?(a) A operator+(argument_list){}(b) A operator[+](argument_list){}(c) int +(argument_list){}(d) int [+](argument_list){}I got this question by my college professor while I was bunking the class.My question is from Operator Overloading topic in portion Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» The CORRECT ANSWER is (a) A OPERATOR+(argument_list){} |
|
| 3. |
How many specifiers are present in access specifiers in class?(a) 1(b) 2(c) 3(d) 4I had been asked this question in an interview for internship.My query is from Classes in section Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» The CORRECT CHOICE is (C) 3 |
|
| 4. |
What is operator overloading in C++?(a) Overriding the operator meaning by the user defined meaning for user defined data type(b) Redefining the way operator works for user defined types(c) Ability to provide the operators with some special meaning for user defined data type(d) All of the mentionedThe question was asked during an internship interview.The above asked question is from Operator Overloading in section Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» CORRECT answer is (d) All of the mentioned Explanation: Operator overloading helps programmer to GIVE his/her own meaning to an operator for user defined DATA types(eg, CLASSES). |
|
| 5. |
How many types of user-defined data type are in c++?(a) 1(b) 2(c) 3(d) 4This question was posed to me by my college professor while I was bunking the class.This question is from User Defined Types in chapter Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» Correct choice is (c) 3 |
|
| 6. |
Which of the following keyword is used to declare the header file?(a) include(b) exclude(c) string(d) namespaceI got this question in semester exam.Origin of the question is Header Files Usage in section Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» Correct choice is (a) INCLUDE |
|
| 7. |
What is the name of | operator?(a) sizeof(b) or(c) and(d) modulusThis question was posed to me during an interview for a job.This intriguing question originated from Essential Operators in chapter Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» Right OPTION is (B) or |
|
| 8. |
Which header file is used to declare the complex number?(a) complexnum(b) complex(c) complex number(d) complexargI got this question in an interview for job.This question is from Complex Number Type in chapter Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» The CORRECT CHOICE is (b) complex |
|
| 9. |
Which of the following operator can be used to overload when that function is declared as friend function?(a) [](b) ()(c) ->(d) |=This question was posed to me in class test.My doubt stems from Operator Overloading in division Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» Correct answer is (d) |= |
|
| 10. |
Constructors are used to ____________(a) initialize the objects(b) construct the data members(c) both initialize the objects & construct the data members(d) delete the objectsI have been asked this question in examination.I'm obligated to ask this question of Classes topic in division Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» RIGHT choice is (a) initialize the objects The best I can explain: Once the object is declared means, the constructor are ALSO declared by DEFAULT. |
|
| 11. |
How many arguments will the subscript operator will take for overloading?(a) 1(b) 2(c) 0(d) as many as possibleThis question was addressed to me in my homework.I'm obligated to ask this question of Subscripting in portion Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» Correct choice is (a) 1 |
|
| 12. |
In which direction does the assignment operation will take place?(a) left to right(b) right to left(c) top to bottom(d) bottom to topI got this question during a job interview.Question is taken from Essential Operators in chapter Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» CORRECT CHOICE is (b) right to left Easy explanation - In ASSIGNMENT operation, the flow of EXECUTION will be from right to left only. |
|
| 13. |
What is the syntax of friend function?(a) friend class1 Class2;(b) friend class;(c) friend class(d) friend class()The question was asked in an online quiz.My query is from Friends in section Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» Correct answer is (a) FRIEND class1 CLASS2; |
|
| 14. |
How many approaches are used for operator overloading?(a) 1(b) 2(c) 3(d) 4This question was posed to me during an interview.I'd like to ask this question from Operator Overloading in chapter Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» Correct choice is (c) 3 |
|
| 15. |
What is the scope of typedef defined data types?(a) inside that block only(b) whole program(c) outside the program(d) main functionI had been asked this question during an interview for a job.I'm obligated to ask this question of User Defined Types topic in division Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» Right choice is (b) whole PROGRAM |
|
| 16. |
What does a default header file contain?(a) prototype(b) implementation(c) declarations(d) pointingThe question was posed to me in quiz.Asked question is from Header Files Usage in section Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» Correct answer is (c) declarations |
|
| 17. |
What is the size of the heap?(a) 10MB(b) 500MB(c) 1GB(d) Size of the heap memory is limited by the size of the RAM and the swap memoryThis question was posed to me in a national level competition.My doubt stems from Large Objects in chapter Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» Correct answer is (d) SIZE of the heap MEMORY is limited by the size of the RAM and the swap memory |
|
| 18. |
In the case of friend operator overloaded functions how many maximum object arguments a unary operator overloaded function can take?(a) 1(b) 2(c) 3(d) 0This question was addressed to me by my school principal while I was bunking the class.Enquiry is from Operator Overloading in chapter Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» The correct choice is (a) 1 |
|
| 19. |
Which of the following operator cannot be used to overload when that function is declared as friend function?(a) -=(b) ||(c) ==(d) []This question was posed to me during an interview.This key question is from Operator Overloading in chapter Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» CORRECT choice is (d) [] For explanation: When an OPERATOR overlaoded function is DECLARED as friend function then [] cannot be OVERLOADED. |
|
| 20. |
Which of the following operator can be overloaded?(a) ?:(b) ::(c) .(d) ==The question was posed to me during an internship interview.My enquiry is from Operator Overloading topic in division Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» CORRECT CHOICE is (d) == To EXPLAIN: ?:, :: and . cannot be OVERLOADED WHEREAS == can be overloaded. |
|
| 21. |
What does the data type defined by union will do?(a) It allow one different portion of memory to be accessed as same data types(b) It allow one same portion of memory to be accessed as same data types(c) It allow one different portion of memory to be accessed as different data types(d) It allow one same portion of memory to be accessed as different data typesThe question was posed to me by my school principal while I was bunking the class.The doubt is from User Defined Types in portion Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» Correct choice is (d) It allow one same PORTION of MEMORY to be accessed as different data types |
|
| 22. |
Identify the correct statement.(a) typedef does not create different types. It only creates synonyms of existing types(b) typedef create different types(c) typedef create own types(d) typedef will not creates synonyms of existing typesThis question was addressed to me in examination.Query is from User Defined Types topic in division Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» The correct answer is (a) typedef does not CREATE different types. It only creates synonyms of EXISTING types |
|
| 23. |
How the objects are self-referenced in a member function of that class.(a) Using a special keyword object(b) Using this pointer(c) Using * with the name of that object(d) By passing self as a parameter in the member functionI have been asked this question in class test.Enquiry is from Classes topic in division Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» The correct option is (b) Using this POINTER |
|
| 24. |
setprecision requires which of the following header file?(a) stdlib.h(b) iomanip.h(c) console.h(d) conio.hThe question was asked in class test.Origin of the question is Header Files Usage topic in chapter Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» CORRECT answer is (b) iomanip.h Easy explanation - The iomanip header FILE is USED to correct the PRECISION of the values. |
|
| 25. |
When we are using heap operations what do we need to do to save the memory?(a) rename the objects(b) delete the objects after processing(c) both rename & delete the objects(d) add the objectsThis question was posed to me in exam.This intriguing question originated from Large Objects in portion Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» Correct OPTION is (b) delete the OBJECTS after processing |
|
| 26. |
Pick the correct statement.(a) Friend functions are in the scope of a class(b) Friend functions can be called using class objects(c) Friend functions can be invoked as a normal function(d) Friend functions can access only protected members not the private membersThis question was addressed to me during an interview.My question is from Friend Function topic in division Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» The correct ANSWER is (C) Friend functions can be invoked as a normal function |
|
| 27. |
Inline functions are avoided when ____________________________(a) function contains static variables(b) function have recursive calls(c) function have loops(d) all of the mentionedThis question was addressed to me during an interview for a job.My question is based upon Classes in division Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» The CORRECT answer is (d) all of the mentioned |
|
| 28. |
What is the user-defined header file extension in c++?(a) cpp(b) h(c) hf(d) hgI have been asked this question in an interview for internship.Enquiry is from Header Files Usage in chapter Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» Right choice is (B) h |
|
| 29. |
To use external linkage we have to use which keyword?(a) static(b) extern(c) const(d) argcThis question was addressed to me in an interview for job.The origin of the question is Linkage topic in section Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» Right answer is (B) EXTERN |
|
| 30. |
How many types of representation are in the string?(a) 1(b) 2(c) 3(d) 4I have been asked this question in semester exam.This interesting question is from String Class topic in section Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» Correct OPTION is (b) 2 |
|
| 31. |
subscript operator is used to access which elements?(a) string(b) char(c) array(d) floatThe question was posed to me during an interview.My question is from Subscripting topic in chapter Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» Correct answer is (c) ARRAY |
|
| 32. |
How to unlimit the size of the stack?(a) setrlimit()(b) unlimit()(c) both setrlimit() & unlimit()(d) setflimit()This question was posed to me in a job interview.Question is taken from Large Objects topic in section Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» Correct choice is (a) SETRLIMIT() |
|
| 33. |
The data members and functions of a class in C++ are by default ____________(a) protected(b) private(c) public(d) public & protectedThe question was asked in an interview for job.My doubt stems from Classes in section Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» The correct OPTION is (b) PRIVATE |
|
| 34. |
Pick the correct statement about string objects in C++.(a) String objects must be terminated by a null character(‘\0’)(b) String objects have a static size(c) String objects have a dynamic size(d) String objects use extra memory than required.I got this question in an interview for job.I'd like to ask this question from String in chapter Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» Correct answer is (C) STRING objects have a dynamic size |
|
| 35. |
Pick the incorrect statement about Character-Array.(a) Character-Array can be terminated by a null character(‘\0’)(b) Character-Array has a static size(c) Character-Array has a dynamic size(d) Character-Array has a threat of array-decayThis question was posed to me in exam.This interesting question is from String topic in chapter Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» RIGHT choice is (C) CHARACTER-ARRAY has a DYNAMIC size Easy explanation - As Character-Array is an array, its size should be defined during its declaration hence the size of Character-Array is static. A Character-Array is not necessarily to be terminated by a null character. Also, it has a threat of array-decay. |
|
| 36. |
Pick out the correct statement.(a) A friend function may be a member of another class(b) A friend function may not be a member of another class(c) A friend function may or may not be a member of another class(d) None of the mentionedI got this question in an internship interview.My question is from Friends in chapter Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» Correct choice is (C) A friend function MAY or may not be a member of another class |
|
| 37. |
Which function is used to get the length of a string object?(a) str.length()(b) str.size()(c) str.max_size()(d) both size() and length() functionI have been asked this question in an online interview.This interesting question is from String topic in division Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» CORRECT CHOICE is (d) both SIZE() and length() function Easy explanation - Both size() and length() are USED to get the size of the string OBJECTS. |
|
| 38. |
Which of the following is not a modifier function in string class?(a) operator+=()(b) operator[]()(c) push_back()(d) erase()The question was asked in a national level competition.The query is from String in section Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» CORRECT option is (b) operator[]() To explain I would say: [] operator is USED to access one of the characters of the string objects whereas other FUNCTIONS are used to MODIFY the string in some way. |
|
| 39. |
How to store the large objects in c++ if it extends its allocated memory?(a) memory heap(b) stack(c) queue(d) stack & queueThis question was addressed to me in final exam.This interesting question is from Large Objects in chapter Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» The CORRECT choice is (a) MEMORY HEAP |
|
| 40. |
In case of non-static member functions how many maximum object arguments a unary operator overloaded function can take?(a) 1(b) 2(c) 3(d) 0This question was addressed to me at a job interview.My question is based upon Operator Overloading topic in portion Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» RIGHT answer is (d) 0 Best explanation: In the case of non-static member functions unary OPERATOR OVERLOADED FUNCTION should not take any OBJECT argument. |
|
| 41. |
Which keyword is used to define the user defined data types?(a) def(b) union(c) typedef(d) typeI have been asked this question in class test.Question is from User Defined Types in division Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» Right option is (c) TYPEDEF |
|
| 42. |
Pick the correct statement.(a) Macros and inline functions are same thing(b) Macros looks like function calls but they are actually not(c) Inline functions looks like function but they are not(d) Inline function are always largeI had been asked this question in an internship interview.The above asked question is from Classes in portion Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» The correct option is (b) MACROS looks like FUNCTION CALLS but they are ACTUALLY not |
|
| 43. |
Which of the header file must be included to use stringstream?(a) (b) (c) (d) This question was addressed to me in an interview.The question is from Header Files Usage in chapter Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» Right CHOICE is (B) |
|
| 44. |
Which operator works only with integer variables?(a) increment(b) decrement(c) both increment & decrement(d) binary operatorI had been asked this question during an interview.I'd like to ask this question from Increment and Decrement in division Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» Right answer is (c) both increment & decrement |
|
| 45. |
What is the associativity of add(+);?(a) right to left(b) left to right(c) right to left & left to right(d) top to bottomI got this question in an interview.My doubt stems from Essential Operators in portion Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» Correct CHOICE is (b) left to RIGHT |
|
| 46. |
How to declare the complex number?(a) (3, 4)(b) complex(3, 4)(c) (3, 4i)(d) (3, 4g)I have been asked this question by my college director while I was bunking the class.My doubt stems from Complex Number Type topic in division Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» Right ANSWER is (b) complex(3, 4) |
|
| 47. |
Which other keywords are also used to declare the class other than class?(a) struct(b) union(c) object(d) both struct & unionI have been asked this question in semester exam.Origin of the question is Classes topic in division Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» CORRECT OPTION is (d) both STRUCT & union Easiest explanation - Struct and union take the same definition of CLASS but differs in the access techniques. |
|
| 48. |
Identify the incorrect statement.(a) iostream is a standard header and iostream.h is a non-standard header(b) iostream is a non-standard header and iostream.h is a non-standard header(c) iostream is a standard header and iostream.h is a standard header(d) iostream is a non-standard headerI have been asked this question in semester exam.This intriguing question comes from Header Files Usage in chapter Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» The CORRECT answer is (a) iostream is a standard header and iostream.h is a non-standard header |
|
| 49. |
How many types of linkages are there in C++?(a) 1(b) 2(c) 3(d) 4I got this question in unit test.The doubt is from Linkage in portion Source Files, Classes and Operator Overloading in C++ of C++ |
|
Answer» Correct choice is (C) 3 |
|
| 50. |
What are the essential operators in c++?(a) +(b) |(c) |
|
Answer» RIGHT answer is (d) All of the mentioned Easy EXPLANATION - Essential operators in C++ are +, |, <=. |
|