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

1. The function whose prototype is void getData(Item *thing); receives
A a pointer to a structure
B a reference to a structure
C a copy of a structure
D nothing

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

2. You may override the class access specifier for_________
A public members
B public and protected members
C any specific class members you choose
D no clas smembers

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

3. The null character needs a space of
A zero bytes
B one byte
C three bytes
D four bytes

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

4. The number of structures that can be declared in a single statement is
A one
B two
C three
D unlimited

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

5. The cout << sales[0] + sales[1]; statement will__________
A display 22000
B display 10000 + 12000
C display sales[0] + sales[l]
D result in an error

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

6. The most efficient data type for a variable that stores the letter C is the _________ data type
A Character
B Double
C Float
D Long Integer

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

7. The C++ operator used to allocate memory is _________
A mem
B allocate
C new
D create

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

8. Assume that your version of C++ can recognize only the first 8 characters of an identifier name, through identifier names may be arbitrarily long. Which of the following identifier names is not distinct:
A list, list2
B address, Address
C identifier_l, identifier_2
D answer, ANSWER

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

9. A derived class may also be called a
A subclass
B super class
C parent class
D base class

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

10. The C++ keyword for declaring a variable that contains a decimal point is ________
A dec
B decimal
C float
D floater

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

11. When you define an object that is a member of a class, such as Student Abby; ________
A a block of memory is set aside and all data members are assigned valid values
B a block of memory is set aside
C no memory is set aside until values are defined
D no memory is set aside, but valid values are assigned to data members

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

12. A program can directly access the __________ members of a class
A hidden
B private
C public
D both (B) and (C)

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

13. Any output manipulator function you create _________
A should take as an argument an instance of ostream as a reference
B should return void
C must be a member function of the ostream class
D must inherit ostream

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

14. The instructions you enter into the computer are called the _____
A edited code
B machine code
C object code
D source code

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

15. The String data type is an extension of the _________ data type
A Character
B Double
C Letter
D Long

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

16. An advantage of using local variables is that _________
A they are known to all functions in the file
B names used in one function do not affect data stored in variables with the same names in other functions
C values given to local variables are retained when those parameters go out of scope
D the program does not become "crowded" with too many variable names

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

17. The difference between a return and a throw is that __________
A with a throw, no value can be sent
B with a return, no value can be sent
C with a throw, execution takes place at the location from which the function was called
D with a return, execution takes place at the location from which the function was called

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

18. Which is a good reason for passing a variable's address to a function?
A the function will have a copy of the variable
B the function cannot change the value of the variable in the calling function
C C++ requires that all variables used in a function be passed by address
D the called function can change the value of the variable in the calling function

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

19. Library header files usually contain
A complete functions
B parts of functions
C function prototypes for functions stored in other files
D function bodies, but not function headers

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

20. A C++ term meaning "generic" is
A argument
B parameterized
C universal
D global

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

21. Before object-oriented exception handling was practiced, ________
A no run-time errors occurred
B programmers could not deal with run-time errors
C the most popular error-handling method was to terminate the program
D the most popular error-handling method was to throw an exception

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

22. The preprocessor directive always ends with
A a comma
B a semicolon
C neither a semicolon nor a comma
D "/"

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

23. A constructor initialization list produces similar results to
A overriding
B assignment
C redeclaring
D output

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

24. Which of the following stream manipulators advances the cursor to the next line on the computer screen?
A adin
B advin
C edlin
D endl

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

25. The value 6.5 is a _________ constant.
A character literal
B named literal
C numeric literal
D string literal

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

26. The time and memory involved in calling a function represent the function's __________
A prototype
B overhead
C cost
D burden

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

27. Which function is most likely to have procedural cohesion?
A main()
B findSquareRoot()
C getSaleSubtractDiscountAddTax()
D openFiles()

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

28. A pointer is
A the address of a variable
B an indication of the variable to be accessed next
C a variable for storing addresses
D the data type of an address variable

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

29. The instruction "If it's raining outside, then take an umbrella to work" is an example of the _________ structure.
A control
B repetition
C selection
D sequence

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

30. Which of the following statements will assign the address of the age variable to the agePtr pointer?
A agePtr = &age;
B agePtr = *age;
C &agePtr = age;
D *agePtr = age;

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

31. The >> (extraction) operator stops reading characters from the keyboard as soon as the user __________
A presses the Enter key
B types a character that is inappropriate for the variable's data type
C types STOP
D both (A) and (B)

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

32. The null character is represented by
A \x0a
B \\0
C \\o
D \\r

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

33. The break statement is
A a preprocessor directive
B an operator in the C++ language
C a keyword in the C++ language
D switch in the C++ language

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

34. A variable w with a value 57 may be defined with ___________
A int w = 57;
B int w(57);
C int 57(w);
D both (A) and (B) , but not (C)

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

35. An expression contains relational, assignment and arithmetic operators. In the absence of parentheses, the order of evaluation will be
A assignment, relational, arithmetic
B arithmetic, relational, assignment
C relational, arithmetic, assignment
D assignment, arithmetic, relational

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

36. The keyword virtual indicates that
A a derived class has public access to a base class
B more than one base class exists
C a base class should be used only once in inheritance
D a derived class should have more than one base class constructed

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

37. Variables that are declared in a block are known as ___________ variables to that block.
A confined
B local
C global
D immediate

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

38. The pow and sqrt functions return a(n) __________ type number.
A double
B float
C integer
D long

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

39. Declaring variables is advantageous because it
A avoids errors from misspelled variable names
B helps the linker work efficiently
C simplifies the writing of very short programs
D All of the above

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

40. The generic name used for unexpected errors that occur during the execution of a program is
A infractions
B exceptions
C deviations
D anomalies

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

41. The switch variable can be of
A int type only
B char type only
C both int as well as char type
D any type

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

42. Reference variables and const class members ___________
A must be assigned values in any derived class
B must never be initialized in a base class
C must be initialized, rather than assigned values
D must not exist if a class is to be a base class

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

43. You can code a default exception handler by creating a catch block
A with no arguments
B with a void argument
C with an ellipsis as its argument
D with an argument identical to that thrown

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

44. Which of the following are void functions?
A main
B pow
C sqrt
D All of the above

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

45. Hiding individual components of an entry is __________
A polymorphism
B encapsulation
C scaling
D not recommended in C++

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

46. When all of the operations in a function contribute to the performance of only one task, a function has
A singular cohesion
B tight cohesion
C functional cohesion
D sequential cohesion

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

47. A function that uses variable types is called __________
A overloaded
B a template function
C a variable function
D a virtual function

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

48. Having more than one function with the same name is called
A overloading
B defaulting
C casting
D referencing

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

49. An object is ___________
A a category of classes
B a name given to a class
C an instance of a class
D the same as a class

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

50. Assume a class Derv that is privately derived from class Base. An object of class Derv located in main() can access
A public members of Base
B protected members of Base
C private members of Base
D public members of Derv

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