0% found this document useful (0 votes)
6 views5 pages

More Mcqs Object Oriented Programming (Set 2)

The document contains a series of multiple-choice questions related to Object Oriented Programming (OOP) concepts, including function arguments, return values, overloaded functions, static variables, arrays, and string handling in C++. Each question is followed by answer options, with the correct answers indicated. The content is structured as a quiz format aimed at assessing knowledge of OOP principles in C++.

Uploaded by

mmaimsalim95
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views5 pages

More Mcqs Object Oriented Programming (Set 2)

The document contains a series of multiple-choice questions related to Object Oriented Programming (OOP) concepts, including function arguments, return values, overloaded functions, static variables, arrays, and string handling in C++. Each question is followed by answer options, with the correct answers indicated. The content is structured as a quiz format aimed at assessing knowledge of OOP principles in C++.

Uploaded by

mmaimsalim95
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Object Oriented Programming (OOP)

2 of 4 sets

51. When arguments are passed by value, the function works with the original
arguments in the calling program.
A. true
B. false
Answer:B

52. Which of the following can legitimately be passed to a function?


A. a constant
B. a variable
C. a structure
o m
D. all of the above
. c
Answer:D
te
a
M
53. How many values can be returned from a function?
q
A. 0
c
B. 1
C. 2
M
D. 3
Answer:B

54. When a function returns a value, the entire function call can appear on the
right side of the equal sign and be assigned to another variable.
A. true
B. false
Answer:A

55. 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.
Answer:D

56. Overloaded functions


A. are a group of functions with the same name.
B. all have the same number and types of arguments.
C. make life simpler for programmers.
D. a and c
Answer:D

57. A static local variable is used to


A. make a variable visible to several functions.
B. make a variable visible to only one function.
C. retain a value when a function is not executing.
D. b and c
Answer:D

58. In C++ there can be an array of four dimensions.


A. true
B. false
Answer:A

59. When an array name is passed to a function, the function


A. accesses exactly the same array as the calling program.
B. refers to the array using a different name than that used by the calling program.
C. refers to the array using the same name as that used by the calling program.
D. a and b
Answer:D

60. The compiler will complain if you try to access array element 14 in a 10-
element array.
A. true
B. false
Answer:B

61. The extraction operator (>>) stops reading a string when it encounters a space.
A. true

View all MCQ's at McqMate.com


B. false
Answer:A

62. 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 arguments.
D. the cin.get() function with three arguments.
Answer:D

63. You should prefer C-strings to the Standard C++ string class in new programs.
A. true
B. false
Answer:B

64. Objects of the string class


A. are zero-terminated.
B. can be copied with the assignment operator.
C. do not require memory management.
D. both b and c
Answer:D

65. Can destuctors be private in C++?


A. yes
B. no
Answer:A

66. What is value of size?


A. 28
B. 32
C. 20
D. 24
Answer:C

67. What value will be printed for data.i?

View all MCQ's at McqMate.com


A. 10 220.5 230.5 unpredictable value
B. 220
C. 230.5
D. unpredictable value
Answer:D

68. What is the compilation error for this program?


A. each undeclared identifier is reported only once
B. cout and cin not declared in scope
C. invalid conversion from int to float
D. all of the above
Answer:B

69. What will be the output of the program?


A. 1
B. default value
C. will not compile
D. none of the above
Answer:C

70. What is the output of the program?


A. 0 0
B. x = 0 y = 0
C. 0
D. compilation error
Answer:D

71. Which function will change the state of the object?


A. only set()
B. only display()
C. display() and set() both
D. none of the above
Answer:A

72. What will be the output of the following program?

View all MCQ's at McqMate.com


A. compilation error: display() cannot be accessed in application
B. compilation error:test class object cannot be accessed in function demo
C. compilation error: variable x is private in test
D. both a and b
Answer:C

73. The only integer that can be assigned directly to a pointer is


A. 0
B. -1
C. 999
D. -999
Answer:A

74. Which of the following feature is not supported by C++?


A. exception handling
B. reflection
C. operator overloading
D. namespace
Answer:B

75. The operators that cannot be overloaded is


A. *
B. -
C. ::
D. ()
Answer:C

View all MCQ's at McqMate.com

You might also like