Home

1000+ C++ Programming MCQ for LSAT [Solved]

Thursday 9th of March 2023

Sharing is caring

1. Delete operator is used
A. To allocate storage
B. To deallocate storage
C. To delete variable name
D. None of the above are correct
Answer : B
2. The declaration int **var1; shows that
A. var1 can not be accessed
B. var1 is a pointer to a pointer of type int
C. var1 is a protected data type of integer
D. this type declaration shows an error
Answer : B
3. The member of a structure can be accessed through a pointer by
A. ->
B. dot operator
C. ::
D. >>
Answer : A
4. In C++, the exception handler is invoked with a-
A. try block
B. throw exception
C. catch function
D. abort()
Answer : B
5. The ?: can be used to replace
A. if-else statement
B. wild cards
C. no meaning in C++
D. returns the value
Answer : A
6. Which of the following relationship is known as inheritancerelationship?
A. ‘has-a’ relationship
B. ‘is-a’ relationship
C. association relationship
D. none of the above
Answer : A
7. Pick out the most appropriate statement from the following
A. references are pointers
B. array of references can be created
C. you can not reference a reference variable
D. all of the above
Answer : C
8. In a class, only the member function can access data, which is not accessible to outside. This feature is called:
A. Data security
B. Data hiding
C. Data manipulation
D. Data definition
Answer : B
9. By using protected, one can create class members that are private to their class but
A. that can not be inherited and accessed by a derived class
B. that can still be inherited and accessed by a derived class
C. that can be public
D. none of the above
Answer : B
10. By default, C++ uses the following method of passing arguments
A. Call-by-Reference
B. Call-by-Value
C. Call-by-Pointer
D. None of the above
Answer : B
11. _____________ operator must have one class object
A. +
B. new
C. all
D. None of these
Answer : B
12. We can make function inline by using the keyword 'inline'.
A. True
B. False
C.
D.
Answer : A
13. Static member functions have file scope.
A. True
B. False
C.
D.
Answer : A
14. Data objects can be initialized when allocating memory using 'new'.
A. True
B. False
C.
D.
Answer : A
15. A destructor can have arguments like constructor.
A. True
B. False
C.
D.
Answer : B
16. The getch() library function
A. Returns a character when any key is pressed
B. Returns a character when ENTER is pressed
C. Display a character on the screen when a key is pressed
D. Does not display a character on the screen
Answer : A
17. new operator is used
A. To dynamically allocate storage
B. To statically allocate storage
C. To allocate storage for a new variable
D. None of the above are correct
Answer : C
18. The string table in C++ holds the
A. string constants in your program
B. program statements in string form
C. variables whose type is of string
D. none of the above
Answer : A
19. A class that contains at least one pure virtual function is called as
A. pure class
B. abstract class
C. base class
D. derived class
Answer : B
20. The new operator always returns a void pointer.
A. True
B. False
C.
D.
Answer : A
21. You can read input that consists of multiple lines of text using
A. The normal cout<< combination
B. The cin.get() function with one argument
C. The cin.get() function with two argument
D. The cin.get() function with three argument
Answer : C
22. Friend function have access to the
A. private and protected members
B. public members only
C. private members only
D. None of the above are correct
Answer : B
23. cc ___________ option is used only to create object file
A. -a
B. -o
C. -c
D. none of these
Answer : B
24. Class is similar to a variable.
A. True
B. False
C.
D.
Answer : B
25. Which of the following can legitimately be passed to a function?
A. A constant
B. A variable
C. A structure
D. A header file
Answer : B
26. "[]" Operator is a unary operator.
A. True
B. False
C.
D.
Answer : A
27. A function that is called automatically when an object is destroyed is known as
A. instantiation
B. function prototype
C. constructor
D. destructor
Answer : D
28. Operator overloading is
A. Making C++ operators work with objects
B. Making C++ operators more then they can handle
C. Giving new meaning to existing c++ operators
D. Making new C++ operators
Answer : C
29. Scope resolution operator has the highest precedence.
A. True
B. False
C.
D.
Answer : A
30. The characteristic that data can be manipulated only through member functions that are part of the class is called
A. Encapsulation
B. Data dependency
C. Inheritance
D. Instantiation
Answer : A
31. Objects get destroyed in the reverse order as they are created.
A. True
B. False
C.
D.
Answer : A
32. this' pointer has to be used while accessing data members in a member function.
A. True
B. False
C.
D.
Answer : A
33. Pick out the most appropriate statement
A. All variables must be declared before they are used
B. Variables in C++ need not be declared and the type can be assigned dynamically
C. Variables in C++ can be declared at the end of the program (before the main function terminates)
D. Variables can not be used explicitly in C++
Answer : A
34. Which of the following is not a component of file system
A. Access method
B. Auxiliary storage management
C. Free integrity mechanism
D. None of the above
Answer : C
35. Public data members can be accessed
A. Only from the base class itself
B. Both form the base class and from its derived classes
C. From the class which is friend of the base class
D. None of the above are correct
Answer : B
36. One of the major disadvantage with late binding is
A. the source code should be made available at compile time
B. the program runs slower
C. dynamic variables can not be used in the program
D. static variables can not be used
Answer : B
37. A destructor can have a return type.
A. True
B. False
C.
D.
Answer : B
38. The scope resolution operator is -
A. ::
B. ;
C. <<
D. ->
Answer : A
39. this' is an implicit pointer.
A. True
B. False
C.
D.
Answer : A
40. The template function declaration specifies
A. template class
B. a generic class
C. exception
D. identifier
Answer : B
41. :: is known as
A. scope resolution operator
B. global operator
C. Both (a) & (b)
D. None of these
Answer : A
42. A direct access file is:
A. A file in which recoreds are arranged in a way they are inserted in a file
B. A file in which records are arranged in a particular order
C. Files which are stored on a direct access storage medium
D. None of the above
Answer : C
43. In C++, the keyword auto can be used for
A. Automatic assignment of data to object during instantiation
B. Automatic call of a function
C. To declare a local variable
D. It is not a keyword in C++
Answer : C
44. main() returns a value of type
A. real
B. char
C. int
D. null
Answer : C
45. _______ argument(s) are passed in case of binary overloaded operators.
A. Two
B. One
C. No
D. None of the above
Answer : A
46. By default, members cannot be inherited.
A. True
B. False
C.
D.
Answer : A
47. The && and || operators
A. Compare two numeric values
B. Combine two numeric values
C. Compare two Boolean values
D. Combine two Boolean values
Answer : C
48. Protected members cannot be inherited.
A. True
B. False
C.
D.
Answer : B
49. Class members are _______________ by default
A. Private
B. protected
C. public
D. None of the above are correct
Answer : A
50. When a language has the capacity to produce new data type, it is said to be
A. Reprehensible
B. Encapsulated
C. Overload
D. Extensible
Answer : D

Sharing is caring