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

1. The printer can be accessed using the predefined filename ________ in C or C++.
A printer file
B print
C cout
D PRN, LPT1, etc

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

2. The best functions have _________.
A high cohesion and tight coupling
B high cohesion and loose coupling
C low cohesion and tight coupling
D low cohesion and loose coupling

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

3. One of the valid escape sequences used in the C language is
A \\z
B \\N
C \\t
D \\s

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

4. A default constructor
A takes no arguments
B has default values for all its arguments
C either (A) or (B)
D neither (A) nor (B)

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

5. Which of the following will increase the value stored in the first element of the fee array by 2?
A amount[0] = amount[0] + 2;
B amount, fee[0] = amount, fee [0] + 2;
C feelnfo.amount[0] = feelnfo.amount[0] + 2;
D fee[0].amount = fee[0].amount + 2;

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

6. Which loop always processes its instructions at least once?
A do-while
B for
C while
D All of the above

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

7. When a new class is derived from an existing class, the derived class member functions _________ have names that differ from base class function names.
A may
B may if the two classes have the same name
C must
D must not

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

8. A static data member is given a value
A within the class definition
B outside the class definition
C when the program is executed
D never

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

9. __________ refers to the process of locating and removing the errors in a program
A Analyzing
B Correcting
C Debugging
D Executing

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

10. You can pass __________ to functions.
A copies of individual structure members
B copies of entire structures
C pointers to structures
D All of the above

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

11. Element doubleArray[7] is which element of the array?
A The sixth
B The seventh
C The eighth
D Impossible to tell

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

12. Which of the following statements opens a file named temp.dat for output?
A outFile.open("temp .dat");
B fileOut.output("temp .dat");
C openFile.out("temp .dat");
D fileOpen.out("temp .dat");

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

13. Which of the following will store the letter H in a Character variable named initial?
A initial = 'H'
B initial = 'H';
C initial = "H"
D initial = "H";

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

14. Compared with the classes from which they are derived, inherited classes may have _________
A additional data members
B additional member functions
C both (A) and (B)
D neither (A) nor (B)

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

15. A class named Student must have a constructor whose name is
A Student
B ~Student
C constructor
D any legal C++ name

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

16. The main difference in operation between an 'if statement and a 'while' statement is
A the 'while' loop body is executed
B the body of the 'while' statement may be executed many times, the body of the 'if statements only once
C the conditional expression following the keyboard is evaluated differently
D All of the above

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

17. If a class object is thrown with a throw statement, then a subsequent catch block has a usable match if the type of the catch argument is_________.
A a parent class of the thrown class
B a child class of the thrown class
C either (A) or (B)
D neither (A) nor (B)

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

18. The weakest form of cohesion is
A coincidental
B functional
C logical
D communicational

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

19. The 'continue' statement is used to
A permit two different expressions to appear in situations where only one expression would ordinarily be used
B terminate loops or to exit from a switch
C alter the normal sequence of program execution by transferring control to some other part of the program
D None of the above

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

20. The 'break' statement is used to exist from
A a do-while loop
B a for loop
C a switch statement
D All of the above

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

21. You have assigned the address of Value to the pointer P, Which statement will display the value stored in Value?
A cout<
B cout<<*Value;
C cout<<&P;
D cout<<*P;

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

22. A constructor initialization list is preceded by
A a. semicolon
B a colon
C two colons
D a space

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

23. Which of the following statements will create and initialize a feelnfo array named fee?
A fee feeInfo = {{0}, {0}};
B fee as feeInfo = 0, 0;
C feeInfo fee = 0, 0;
D feeInfo fee = {0,0};

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

24. Which of the following is the scope resolution operator?
A ->>
B ::
C *
D &

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

25. A function that changes an object's state belongs to the category of
A inspector functions
B mutator functions
C auxiliary functions
D manager functions

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

26. The int type of constants are whole numbers in the range
A - 23677 to 23678
B - 32768 to 32767
C - 32767 to 32768
D - 32864 to 32865

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

27. When the function char someFunction(int x) is executed,
A it will throw nothing
B it will throw an integer
C it will throw a character
D it may or may not throw anything

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

28. Variables that hold memory addresses are called _________.
A subscripts
B holders
C pointers
D indicators

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

29. The general form of do-while statement is
A do expression while statement;
B do while expression;
C do statement while (expression);
D do statement while statement;

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

30. The measure of how well the operations in a function relate to one another is __________.
A coupling
B cohesion
C adhesion
D conversion

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

31. The extraction operator >> is a(n) _________.
A overloaded function
B C++ class
C C++ object
D static reference variables

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

32. Modules in C++ programs are
A functions
B procedures
C subroutines
D miniprograms

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

33. The return type for all destructors is
A the class
B void
C the same as the first data in the class
D None

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

34. If an exception is thrown and no catch block matches the type of the thrown parameter, then _________.
A the program terminates
B the first catch block is executed
C the last catch block is executed
D the program proceeds with the code following the catch blocks

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

35. The comma operator (,) is used to
A permit two different expressions to appear in situations where only one expression would ordinarily be used
B terminate loops or to exit from switch
C alter the normal sequence of program execution by transferring control to some other part of the program
D carry out a logical test and then take one of two possible actions, depending upon the outcome of the test

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

36. Which of the following statements creates a named constant called driverAge whose value is 16?
A const driverAge = 16;
B const short driverAge = 16;
C driverAge =16;
D driverAge const =16;

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

37. Which functions do not have a this pointer?
A access functions
B inspector functions
C member functions
D static functions

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

38. When a program calls a function that has default parameters, if you omit an argument, you must _________.
A not omit any other arguments
B omit all arguments
C omit all arguments to the right of that argument
D omit all arguments to the left of that argument

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

39. Each generic type in a template function definition is preceded by the keyword _________.
A template
B function
C type
D class

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

40. The declaration section holds
A data members
B data members and function prototypes
C data members, function prototypes, and the functions themselves
D None of the above

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

41. A derived class __________ override attributes of a parent class.
A may
B may if the two classes have the same name
C must
D must not

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

42. In object-oriented terms, an exception may be considered a(n) __________.
A child
B encapsulation
C message
D scalar type

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

43. A(n) __________ is a numeric variable used for counting something.
A accumulator
B adder
C constant
D counter

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

44. The element of an array is
A the name of the array
B a member of an array
C a value assigned to an array
D All of the above

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

45. When the function void someFunction(int x) throw(char) is executed,___________.
A it will throw nothing
B it may throw an integer
C it may throw a character
D it may not throw anything

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

46. Which of the following is NOT included in the header of a function?
A the type of variable returned by the function to the function that calls it
B the name of the program or function that calls the function
C the name of the function
D the types and names of any variables that will be passed to the function

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

47. The logical NOT operator is a
A unary operator
B binary operator
C ternary operator
D octal operator

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

48. When variables refer to attributes of an entity (such as name, address, and phone number of a person), those attributes form a ___________.
A file
B record
C field
D program

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

49. Which of the following is false?
A You enclose a function's statements in a set of braces
B The function header is considered a C++ statement, so it must end in a semicolon.
C The keyword void tells the C++ compiler that the function does not return a value
D A function can receive information that you send (pass) to it

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

50. A function's single most important role is to
A give a name to a block of code
B reduce program size
C accept arguments and provide a return value
D help organize a program into conceptual units

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


No comments:

Post a Comment

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

Popular Posts