Computer Science - Object Oriented Programming Using C++ MCQs Part 4

1. You typically initialize a String variable to _____

A.
an asterisk
B.
a space enclosed in single quotes
C.
the number 0
D.
a zero-length string

 Answer Option D

2. The set of instructions for how to tie a bow is an example of the _____ structure

A.
control
B.
repetition
C.
selection
D.
sequence
E.
switching

 Answer Option D

3. If no exception is thrown ________

A.
a catch block will cause an error
B.
the first catch block coded will execute
C.
the last catch block coded with execute
D.
any catch blocks coded with be bypassed

 Answer Option D

4. A program that predicts the exact sequence in which events will take place is said to be ________

A.
compiled
B.
interpreted
C.
procedural
D.
object-oriented

 Answer Option C

5. A blueprint for creating an object in C++ is called _____

A.
a class
B.
an instance
C.
a map
D.
a pattern
E.
a sketch

 Answer Option A

6. The prototype for a derived class constructor may include arguments for

A. data members of the derived class
B. data members of the base class
C. both (a) and (b)
D. neither (a) nor (b)

 Answer Option C

7. Overloading involves writing two or more functions with ________

A. different names and different argument lists
B. different names and the same argument list
C. the same name and different argument lists
D. the same name and the same argument list

 Answer Option C

8. You___________overload function templates

A. may, as long as each version has the same arguments
B. may, as long as each version has different arguments
C. must
D. must not

 Answer Option B

9. You typically initialize Character variables to _____

A. a space enclosed in double quotes
B. a space enclosed in single quotes
C. the letter O
D. the number 0
E. the value false

 Answer Option B

10. One way pointers are useful is to refer to a memory address that has no _____

A. name
B. constant
C. location
D. field

 Answer Option A

11. A member function uses the correct object when you call it because

A. a copy of the object is passed to the function
B. the address of the object is passed to the function
C. the address of the function is passed to another function
D. the address of the object is returned from the function

 Answer Option B

12. Two access specifiers in C++ are

A. public and private
B. int and double
C. formal and informal
D. void and free

 Answer Option A

13. Which of the following is the fourth problem-solving step?

A. analyze the problem
B. evaluate and modify (if necessary) the program
C. code the algorithm
D. plan the algorithm
E. desk-check the program

 Answer Option C

14. Within parentheses, catch blocks can have _____

A. no arguments
B. one argument
C. two arguments
D. as many arguments as necessary

 Answer Option B

15. The while loop is referred to as a(n) _____ loop because the loop condition is tested at the beginning of the loop

A. beginning
B. initial
C. pretest
D. priming

 Answer Option C

16. The word case used in the switch statement represents a

A. function in the C++ language
B. data type in the C++ language
C. keyword in the C++ language
D. global variable in the C++ language
E. None of the above

 Answer Option C

17. Function templates _____________

A. must have exactly one parameter
B. may have more than one parameter as long as they are of the same type
C. may have more than one parameter of any type
D. may not have parameters

 Answer Option C

18. The statement int num[2][3]={ {3,8,6}, {9,4,7}};

A. assigns a value 4 to num[1][2]
B. assigns a value 7 to num[1][2]
C. assigns a value 8 to num[1][2]
D. assigns a value 9 to num[1][2]

 Answer Option B

19. Private data can be accessed by

A. class member functions
B. functions in derived classes
C. both (a) and (b)
D. neither (a) nor (b)

 Answer Option A

20. The store of memory available to programs is the _____

A. store
B. stack
C. pile
D. heap

 Answer Option D

21. The most common operation used in constructors is _____

A. addition
B. overloading
C. assignment
D. polymorphism

 Answer Option C

22. When a function performs tasks based on a decision, it has _____

A. functional cohesion
B. coincidental cohesion
C. logical cohesion
D. no cohesion

 Answer Option C

23. To create a template class, you begin with _________

A. the template definition
B. the keyword class
C. the function definitions
D. the keyword definition

 Answer Option A

24. Which of the following is a C++ object?

A. >>
B. read()
C. cin
D. iostream

 Answer Option C

25. A variable is _____

A. an item of data
B. a memory location whose value can change while the program is running
C. a memory location whose value cannot change while the program is running

 Answer Option B

26. A function can

A. return a value
B. perform a task
C. change value of actual arguments in call by reference
D. a, b, c above are all true
E. None of the above

 Answer Option D

27. The statement float values[]={3.14, -7.86, 36.96, 4.87};

A. assigns 36.96 to values[2]
B. assigns -7.86 to values[2]
C. gives an error message
D. assign 14 to values[2]

 Answer Option A

28. A constructor initialization list is preceded by _____

A. a semicolon
B. a colon
C. two colons
D. a space

 Answer Option B

29. When the compiler places a copy of a small function's statements directly into a program, the function is said to be _____

A. overloaded
B. mangled
C. inline
D. redundant

 Answer Option C

30. A group of related fields that contain all of the data about a specific person, place, or thing is called a

A. data file
B. field file
C. program file
D. record

 Answer Option D

31. To send output to a file, you need to include the _____ header file in your program

A. file.h
B. fstream.h
C. iomanip.h
D. iostream.h
E. of stream.h

 Answer Option B

32. A C++ _____ is a program that runs in a DOS window

A. algorithm
B. cast application
C. console application
D. source application

 Answer Option C

33. A difference, between reference variables and pointers is that

A. reference variables are easier to use
B. pointers are easier to use
C. reference variables are more flexible
D. no difference exists between reference variables and pointers

 Answer Option A

34. A 'C function does not contain

A. a function header
B. argument declarations
C. other 'C' functions
D. function body
E. None of the above

 Answer Option C

35. _____ variables remain in memory until the program ends

A. Area
B. Global
C. Local
D. Reference
E. Value

 Answer Option B

36. The outline or the definition of a function is called its

A. beta test
B. forerunner
C. outline
D. prototype

 Answer Option D

37. Which of the following is false?

A. Data stored in an array can be accessed faster than data stored in a disk file
B. Data stored in an array needs to be entered only once, typically at the beginning of the program
C. Arrays allow the programmer to store information in the computer's internal memory
D. When using arrays, you will have fewer variable names to remember
E. None of the preceding statements are false

 Answer Option E

38. A function stub typically contains

A. the function header
B. the function braces
C. the return statement, if it's value- returning function
D. a display message
E. All of the above

 Answer Option E

39. A variable's _____ indicates which portions of the program can use the variable

A. area
B. extent
C. lifetime
D. reach
E. scope

 Answer Option E

40. If an integer 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. const int &
B. int &
C. either (a) or (b)
D. neither (a) nor (b)

 Answer Option C

41. _____ variables are declared outside of any statement block

A. Area
B. Global
C. Local
D. Reference
E. Value

 Answer Option B

42. The end of string is recognized by

A. the null character
B. the newline character
C. the $ sign
D. the / sign
E. None of the above

 Answer Option A

43. Variable names known only to the procedure in which they are declared are ________

A. local
B. global
C. recent
D. internal

 Answer Option A

44. Whis is true?

A. A derived class may have more than one base class
B. A base class may have more than one derived class
C. both (a) and (b)
D. neither (a) nor (b)

 Answer Option C

45. The keyword used to define a structure is

A. stru
B. stt
C. struct
D. unlimited

 Answer Option C

46. If you omit any constructor argument when you instantiate an object, you must use default values

A. for all parameters to the constructor
B. for all parameters to the right of the argument
C. for all parameters to the left of the argument
D. for no other parameters

 Answer Option B

47. The C++ expression p --> val means the same thing as

A. *p.val
B. *(p.val)
C. (*p).vai
D. p.val

 Answer Option C

48. Which of the following tells C++ to display numbers with zero decimal places?

A. setiosflags(0)
B. setiosflags(zero)
C. setprecision(0)
D. setprecision(zero)

 Answer Option C

49. Code that has already been tested is said to be _____

A. inherited
B. reusable
C. reliable
D. polymorphic

 Answer Option C

Comments

Most Popular

Remove Unicode Zero Width Space PHP

PhpStorm, return value is expected to be 'A', 'object' returned

Laravel file upload returns forbidden 403, file permission is 700 not 755