Object Oriented Programming in C Mcqs
Object Oriented Programming in C Mcqs
UNIT 1
20. What is the process of interacting between different objects in a program called?
A. Abstract classes
B. Message passing
C. Concrete classes
D. Encapsulation
UNIT 2
21. In any programming language, writing even an elementary program requires the knowledge and
clear understanding of ___________.
A. Data types
B. Variables and constants
C. Operators
D. All of the above
22. A character set can be defined as a set of characters that____________represents information.
A. Individually or in combination
B. In combination
C. Do not
D. Both (a) and (b)
23. When a program is compiled, what scans the source code and parses it into tokens to find the
syntax errors?
A. Data types
B. Compiler
C. Horizontal tab
D. None of the above
24. __________________ are the predefined words that have special significance in any
language.
A. Variables
B. Data types
C. Constants
D. Keywords
25. Every keyword is reserved for a specific purpose and hence must not be used
as__________________.
A. User-defined names
B. Identifiers
C. Plain
D. Both (a) and (b)
26. Identifiers are the names given to uniquely identify various programming elements
like________.
A. Variables and arrays
B. Functions and classes
C. Structures and namespaces
D. All of the above
27. An identifier must contain only____________.
A. Upper case and lower case letters
B. Underscore character (_) or digits 0 to 9
C. Both (a) and (b)
D. None of the above
28. What should an identifier start with?
A. Letter
B. Underscore
C. Letter or underscore
D. Digits 0 to 9
29. Identifiers that start with a double underscore ‘__’ or an underscore followed by an upper case
letter must be avoided as these names are reserved by the__________.
A. Standard C++ Library
B. Standard C Library
C. C++ Library
D. None of the above
30. Numeric constants refer to the numbers consisting of a sequence of digits (with or without
decimal point) that can be________.
A. Positive
B. Negative
C. Alphanumeric
D. Both (a) and (b)
31. In to how many categories can C++ constants be broadly classified into?
A. Four
B. Two
C. Three
D. Multiple
32. There are few character constants that cannot be included in a program directly through a
keyboard, such as__________.
A. Backspace
B. Newline
C. Both (a) and (b)
D. Insert
33. Wide character literal uses how many bytes of memory?
A. Two
B. One
C. Multiple
D. None of the above
34. A data type determines the _______________ that can be performed on the data.
A. Type
B. Operations
C. Memory
D. Both (a) and (b)
35. What is termed as a set of named integer constants that specify all the permissible values that
can be assigned to enumeration variables?
A. Enumeration
B. Reference
C. Pointer
D. None of the above
36. What forms an expression?
A. Variables
B. Constants
C. Operators
D. All of the above
37. The expressions that produce a bool type value, that is, either true or false are called______.
A. Integral expressions
B. Float expressions
C. Relational or Boolean expressions
D. Constant expressions
38. The statements that cause a set of statements to be executed repeatedly either for a specific
number of times or until some condition is satisfied are known as_____________.
A. Iteration statements or loops
B. Conditional operator
C. The if-else statement
D. The if statement
39. The bool data type can hold only boolean values that is either true or false, where true represents
________ and false represents__________.
A. 0,-1
B. 0,1
C. 1, 0
D. None of the above
40. In addition to char data type, C++ provides another data type wchar_t which is used to store
_________ wide characters.
A. 10 bit
B. 32 bit
C. 16 bit
D. 64 bit
41. Which variable stores the memory address of another variable?
A. Reference
B. Pointer
C. Array
D. None of the above
42.What are the significant features of C language?
A. Structure and union
B. Class
C. Enumerations
D. None of the above
43. If a variable is used prior to its initialization, what is produced?
A. Garbage results
B. Undesirable results
C. Both (a) and (b)
D. 10
44. The expressions that produce a bool type value after combining two or more relational
expressions are called ________________.
A. Logical expressions
B. Big Theta θ(f)
C. Boolean expressions
D. None of the above
45.____________ is an assignment expression, which is enclosed within other assignment
expression.
A. Chained assignment
B. Binary arithmetic operator
C. Compound assignment
D. Embedded assignment
46 Like built-in data types, memory can also be allocated dynamically to derived and userdefined
data types such as__________.
A. Arrays
B. Structures
C. Classes
D. All of the above
47. A single statement specifies a single action and is always terminated by a_________.
A. Inverted commas
B. Colon
C. Semi colon
D. Brackets
48. The for loop is one of the most widely used loops in____________.
A. C++
B. C
C. Iterations
D. None of the above
49. The break statement is extensively used in___________.
A. Loops
B. switch statements
C. Both (a) and (b)
D. continue statement
UNIT 3
50. Handling real world data requires a mechanism that deals with a collection of_________?
A.Structures
B. Data items
C. Arrays
D. None of the above
51. __________ is defined as a fixed size sequence of same type of data elements.
A. C++
B. Data items
C. Arrays
D. None of the above
52. What is the simplest form of an array?
A. One- dimensional array
B. Multi- dimensional array
C. Single- dimensional array
B. explicit call
C. operator float
A. Publicly inherited
B. Protectedly inherited
C. Privately inherited
D. All of the above
120. When the access specifier of the base class in the derived class definition is public, the base
class is __________.
A. Publicly inherited
B. Protectedly inherited
C. Privately inherited
D. None of the above
121. When a base class is protectedly inherited, public and protected members of the base class are
not accessible by the objects of the__________.
A. Base class
B. Derived class
C. Friend classes
D. Member functions
122. By default, the access specifier of a base class in the derived class definition is_________.
A. protected member
B. perimeter
C. private base_class
D. private
123. What is also allocated to the objects of a class?
A. Array
B. Memory
C. Variables
D. None of the above
124. When a derived class inherits from a single base class, it is referred to as_________.
A. Hybrid inheritance
B. Multiple inheritances
C. Single inheritance
D. Multi-level inheritance
125. The size of an object of the derived class is equal to the sum of the size of all the data members
of the___________.
A. Base class
B. Derived class
C. Both (a) and (b)
D. Virtual base class
126. When a derived class inherits from more than one base class simultaneously, it is referred to
as___________.
A. Hybrid inheritance
B. Multiple inheritances
C. Single inheritance
D. Multi-level inheritance
127. Multilevel inheritance comprises of how many levels?
A. Only two
B. Two or more
C. More than three
D. None of the above
128. Virtual base class is an indirect base class declared using the keyword _________in order to
prevent its duplication.
A. derived
B. derived_class
C. virtual
D. None of the above
129. What is required in inheritance to initialize the data members of the base class through derived
class?
A. Object declaration
B. Destructor
C. Constructor
D. Inheritance
130. What are used to dynamically initialize the object of the class?
A. base class constructor
B. Parameterized constructors
C. Destructor of the virtual base class
D. None of the above
UNIT 8
UNIT 9
150. Most real-life applications require large amount of input and output data to be handled that is
difficult to manage using the commonly used console input/output (I/O) devices like_________.
A. Keyboard
B. Screen
C. Mouse
D. Both (a) and (b)
151. With what type of devices can the C++ I/O system function?
A. Terminals
B. Disks
C. Tape drives
D. All of the above
152. __________ refers to the flow of data in the form of sequence of bytes.
A. Stream
B. C++ I/O system
C. I/O operations
D. All of the above
153. The streams help to consume data from which all sources?
A. Keyboard
B. Mouse
C. Storage device
D. All of the above
154. Streams also receive data from the program and direct it to the___________.
A. Different programs
B. Physical devices
C. Both (a) and (b)
D. Files
155. What is a collection of related data stored on some storage device called?
A. Arrays
B. Streams
C. Files
D. Pointers
156. A file stream refers to the flow of data between__________.
A. Programs
B. Files
C. Newline character
D. Both (a) and (b)
157. If a number, say12345, is stored in text format, it occupies how many bytes of memory?
A. Five
B. Two
C. Three
D. One
158. Since data is stored in the same format as in the internal memory, saving and accessing the data
from binary files is ___________ than the text files.
A. Staggered
B. Slower
C. Faster
D. None of the above
159. Which input file stream class provides functions for performing reading operations only?
A. ifstream
B. istream class
C. read()
D. None of the above
160. What is used to manage the buffered I/O of file stream?
A. ifstream
B. filebuf
C. ofstream
D. None of the above
161. The fstream contains all the functions of __________ classes which are inherited through
iostream class.
A. istream
B. ostream
C. Both (a) and (b)
D. None of the above
162. To perform any operation on a file, it needs to be_________first.
A. Cleaned
B. Opened
C. Closed
D. Organized
163. In C++, each file is __________ of a particular stream class.
A. An argument
B. A function
C. An object
D. None of the above
164. The functions ________also known as binary I/O functions are used to handle blocks of binary
data.
A. read()
B. write()
C. Both (a) and (b)
D. get(and put())
165. The process of reading and writing sequence of bytes is known__________.
A. Object serialization
B. Binary serialization
C. Both (a) and (b)
D. Streams
166. Which signal can be detected by using the function eof()which is a member function of the ios
class?
A. End-of-file (EOF)
B. streamsize gcount();
C. char title[30];
D. None of the above
167. In C++, every file is associated with how many file pointers?
A. Three
B. Two
C. Four
D. One
168. A file stream refers to the flow of data between a__________.
A. Program and object
B. Program and stream
C. Program and file
D. None of the above
169. Depending on the flow of data from file or to file, stream can be classified into___________.
A. Input stream and output stream
B. Mode and binary mode
C. ofstream and fstream
D. None of the above
UNIT 10
186. The exceptions that occur at specific program statements are called__________.
A. Synchronous exceptions
B. Exception handling
C. Asynchronous exceptions
D. None of the above
187. The point within the function at which the throw statement is executed is called the_________.
A. Throw point
B. Synchronous exceptions
C. Asynchronous exceptions
D. None of the above
188. How many types of exceptions are there?
A. Three
B. Two
C. One
D. None of the above
189. An exception is an unexpected event that occurs during the execution of a___________.
A. Statement
B. Code
C. Program
D. None of the above
190. C++ exception handling mechanism mainly uses how many keywords?
A. Four
B. Three
C. Two
D. None of the above
191. What allows multiple catch blocks to handle different types of exceptions?
A. C
B. C++
C. Exceptions
D. None of the above
192. A throw statement without any argument is used to rethrow an________.
A. Try block
B. Catch block
C. Exception
D. None of the above
193. The calling function checks for the return values and then appropriately handles
the___________.
A. Exceptions
B. Error
C. Both (a) and (b)
D. None of the above
194.____________ an exception allows multiple handlers to access the same exception.
A. Blocking
B. Throwing
C. Rethrowing
D. None of the above
195. Sometimes it is not possible to predict all types of exceptions that can occur during the program
execution and hence, separate __________- cannot be provided to handle all the exceptions.
A. Try block
B. Ellipsis (...)
C. Catch blocks
D. Executions
196. Whenever an exception is thrown, ___________ are searched in sequential order for an
appropriate match.
A. Try block
B. Executions
C. Catch blocks
D. Programs
197. When an exception is thrown, it needs to be______________.
A. Executed
B. Handled appropriately
C. Resolved
D. None of the above
198. Whenever an exception occurs it is thrown using the____________.
A. User-defined function
B. throw exception
C. throw statement
D. None of the above
199. The argument exception used with the throw statement can be either of built-in data
type such as____________ or a user-defined data type such as class, struct, etc.
A. float
B. int
C. Both (a) and (b)
D. throw;
200. The point within the function at which the throw statement is executed is called the
__________.
A. Try block
B. Throw point
C. Catch block
D. None of the above