Object Oriented Programming (OOPs) MCQs > FREE SET - 7

1. A default catch block in C++ catches
A all thrown objects
B no thrown objects
C any thrown object that has not been caught by an earlier catch block
D all thrown objects that have been caught by an earlier catch block

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

2. To expose a data member to the program in C++, you must declare the data member in the _____ section of the class
A common
B exposed
C public
D unrestricted

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

3. Which of the following are valid characters in C++ for a numeric literal constant?
A a comma
B a dollar sign ($)
C a percent sign (%)
D None of the above

Free MCQs www.sharemcq.com     Answer: Option D
Explanation:
Available Soon.

4. When the compiler cannot differentiate between two overloaded constructors in C++, they are called
A overloaded
B destructed
C ambiguous
D dubious

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

5. If you design a class in C++ that needs special initialization tasks, you will want to design a(n) _____
A housekeeping routine
B initializer
C constructor
D compiler

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

6. To be called object-oriented, a programming language must allow
A functions that return only a single value
B #include files
C inheritance
D All of the above

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

7. A function in C++ that is called automatically each time an object is destroyed is a
A constructor
B destructor
C destroyer
D terminator

Free MCQs www.sharemcq.com     Answer: Option B
Explanation:
Available Soon.

8. Which of the following statements in C++ allows the user to enter data at the keyboard?
A cin << currentPay;
B cin >> currentPay;
C cout << currentPay;
D cout >> currentPay;

Free MCQs www.sharemcq.com     Answer: Option B
Explanation:
Available Soon.

9. Paying attention in C++ to the important properties while ignoring inessential details is known as________
A selectiveness
B polymorphism
C abstraction
D summarizing

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

10. Redirection redirects
A a stream from a file to the screen
B a file from a device to a stream
C a device from the screen to a file
D the screen from a device to a stream

Free MCQs www.sharemcq.com     Answer: Option A
Explanation:
Available Soon.

11. To use either an input or output file in C++, the program must include the _________ header file
A filestream.h
B fstream.h
C instream.h
D iostream.h

Free MCQs www.sharemcq.com     Answer: Option B
Explanation:
Available Soon.

12. A base class in C++ may also be called a
A child class
B subclass
C derived class
D parent class

Free MCQs www.sharemcq.com     Answer: Option D
Explanation:
Available Soon.

13. When you omit parameters from a C++ function call, values can be provided by
A formal parameters
B reference parameters
C overloaded parameters
D default parameters

Free MCQs www.sharemcq.com     Answer: Option D
Explanation:
Available Soon.

14. Variables declared outside a block in C++ are called ___________
A global
B universal
C stellar
D external

Free MCQs www.sharemcq.com     Answer: Option A
Explanation:
Available Soon.

15. The compiler converts your C++ instructions into _____
A edited code
B object code
C source code
D translated code

Free MCQs www.sharemcq.com     Answer: Option B
Explanation:
Available Soon.

16. The return type you code for all constructors in C++ is _____
A void
B the class type
C the same type as the first data member defined in the class
D no type

Free MCQs www.sharemcq.com     Answer: Option D
Explanation:
Available Soon.

17. When an object-oriented program detects an error within a function in C++, the function _________
A throws an exception
B throws a fit
C catches a message
D catches an exception

Free MCQs www.sharemcq.com     Answer: Option A
Explanation:
Available Soon.

18. Using a statement at the wrong time or with an inappropriate object in C++ creates a
A logical error
B syntax error
C compiler error
D language error

Free MCQs www.sharemcq.com     Answer: Option A
Explanation:
Available Soon.

19. When you create a derived class in C++ and instantiate an object _________
A the parent class object must be constructed first
B the child class object must be constructed first
C the parent class object must not be constructed
D the child class object must not be constructed

Free MCQs www.sharemcq.com     Answer: Option A
Explanation:
Available Soon.

20. A constructor in C++ always has
A communicational cohesion
B temporal cohesion
C logical cohesion
D no cohesion

Free MCQs www.sharemcq.com     Answer: Option B
Explanation:
Available Soon.

21. A normal C++ operator that acts in special ways on newly defined data types is said to be
A glorified
B encapsulated
C classified
D overloaded

Free MCQs www.sharemcq.com     Answer: Option D
Explanation:
Available Soon.

22. A function in a C++ derived class that has the same name as a function in the parent class
A will override the base class function
B will cause an error message to display
C will be overridden by the base class function
D will execute immediately often the base class function executes

Free MCQs www.sharemcq.com     Answer: Option A
Explanation:
Available Soon.

23. In which statements, does a 'continue' statements cause the control to go directly to the test condition and then continue the looping process?
A 'for' and 'while'
B 'while' and 'if-else'
C 'do-while' and 'if-else'
D 'while' and 'do-while'

Free MCQs www.sharemcq.com     Answer: Option D
Explanation:
Available Soon.

24. In a class specifier, data or functions designated private are accessible
A to any function in the program
B only if you know the password
C to member functions of that class
D only to public members of the class

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

25. When a function includes a throw statement for errors, the call to the potentially offending function should be placed within a ________ block
A throw
B try
C catch
D scope

Free MCQs www.sharemcq.com     Answer: Option B
Explanation:
Available Soon.

26. The scope resolution operator in C++ is
A a comma
B a semicolon
C a colon
D two colons

Free MCQs www.sharemcq.com     Answer: Option D
Explanation:
Available Soon.

27. The items listed in the function header are called _________
A actual arguments
B formal parameters
C passed parameters
D sent arguments

Free MCQs www.sharemcq.com     Answer: Option B
Explanation:
Available Soon.

28. The feature in object-oriented programming that allows the same operation to be carried out differently, depending on the object, is__________
A inheritance
B polymorphism
C overfunctioning
D overriding

Free MCQs www.sharemcq.com     Answer: Option B
Explanation:
Available Soon.

29. When an argument is passed by reference,
A a variable is created in the function to hold the argument's value
B the function cannot access the argument's value
C a temporary variable is created in the calling program to hold the argument's value
D the function accesses the argument's original value in the calling program

Free MCQs www.sharemcq.com     Answer: Option D
Explanation:
Available Soon.

30. The process of extracting the relevant attributes of an object is known as
A polymorphism
B inheritance
C abstraction
D data hiding

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

31. If you want to override constructor
A all other parameters to that constructor
B all parameters to the left of that value
C all parameters to the right of that value
D no other parameters to that constructor

Free MCQs www.sharemcq.com     Answer: Option B
Explanation:
Available Soon.

32. Errors in a program are called
A accidents
B annoyances
C bugs
D mistakes

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

33. If a derived class uses the public access specifier, then __________
A public base class members remain public in the derived class
B protected base class members become public in the derived class
C both (a) and (b)
D neither (A) nor (B)

Free MCQs www.sharemcq.com     Answer: Option A
Explanation:
Available Soon.

34. The operator in C++ that releases previously allocated memory is _____
A release
B return
C delete
D destroy

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

35. When a language has the capability to produce new data types, it is said to be
A reprehensible
B encapsulated
C overloaded
D extensible

Free MCQs www.sharemcq.com     Answer: Option D
Explanation:
Available Soon.

36. The preprocessor directive always starts with the symbol
A %
B &
C #
D ""

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

37. The base class for most stream classes is the _________ class
A ios
B out
C in
D app

Free MCQs www.sharemcq.com     Answer: Option A
Explanation:
Available Soon.

38. Which of the following can be used to declare the main function in C++?
A void main
B void Main()
C void main()
D main

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

39. The highest level of cohesion is
A functional cohesion
B temporal cohesion
C logical cohesion
D sequential cohesion

Free MCQs www.sharemcq.com     Answer: Option A
Explanation:
Available Soon.

40. You separate a derived class name from its access specifier with
A a colon
B two colons
C at least one space
D a semicolon

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

41. The last statement in a function is often a(n) ________
A return
B goodbye
C finish
D endfunction

Free MCQs www.sharemcq.com     Answer: Option A
Explanation:
Available Soon.

42. The two statements that can be used to change the flow of control are
A if and switch
B if and while
C switch and do-while
D break and continue

Free MCQs www.sharemcq.com     Answer: Option A
Explanation:
Available Soon.

43. If p and q are assigned the values 2 and 3 respectively then the statement p = q++
A gives an error message
B assigns a value 4 to p
C assigns a value 3 to p
D assigns a value 5 to p

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

44. Which of the following is the insertion operator?
A >>
B <<
C //
D /*

Free MCQs www.sharemcq.com     Answer: Option B
Explanation:
Available Soon.

45. If you want only one memory location to be reserved for a class variable, no matter how many objects are instantiated, you should declare the variable as
A static
B unary
C dynamic
D volatile

Free MCQs www.sharemcq.com     Answer: Option A
Explanation:
Available Soon.

46. To use a template class member function in C++, use the __________ with the instantiation
A scope resolution operator
B dot operator
C class definition
D keword template

Free MCQs www.sharemcq.com     Answer: Option B
Explanation:
Available Soon.

47. If you assign a default value to any variable in a function prototype's parameter list, then __________
A all other parameters in the function prototype must have default values
B all parameters to the right of that variable must have default values
C all parameters to the left of that variable must have default values
D no other parameters in that prototype can have default values

Free MCQs www.sharemcq.com     Answer: Option B
Explanation:
Available Soon.

48. The feature that allows you to use the same function name for separate functions that have different argument lists is called _________
A Overriding
B Overloading
C Constructing
D Destructing

Free MCQs www.sharemcq.com     Answer: Option B
Explanation:
Available Soon.

49. Which of the following are valid characters constants in C++?
A '\x0a'
B '\\'
C '\\0'
D All of the above

Free MCQs www.sharemcq.com     Answer: Option D
Explanation:
Available Soon.

50. If you want to use a class to define objects in many different programs, you should define the class in a C++ _________ file
A header
B program
C source
D text

Free MCQs www.sharemcq.com     Answer: Option A
Explanation:
Available Soon.


No comments:

Post a Comment

Your Feedback is hearty Requested to make the MCQs Collection better.

Popular Posts