High Level Programming MCQ - 240427 - 171534
High Level Programming MCQ - 240427 - 171534
High Level Programming MCQ - 240427 - 171534
5) The keyword friend does not appear in 12) Which of the following cannot be friend?
A. The class allowing access to another class A. Function
B. The class desiring access to another class B. Class
C. The private section of a class C. Object
D. The public section of a class D. Operator function
Answer: C Answer: C
6) The term __________ means the ability to 13) Which of the following concepts of OOPS
take many forms. means exposing only necessary information
A. Inheritance to client?
B. Polymorphism A. Encapsulation
C. Member function B. Abstraction
D. Encapsulation C. Data hiding
Answer: B D. Data binding
Answer: C
7) C++ was originally developed by
A. Clocksin and Melish
B. Donald E.Knuth
C. Sir Richard Hadlee
D. Bjarne Stroustrup
Answer: D
lOMoAR cPSD| 23221915
14) In structured programming, the problem 21) Preventing direct access of data-members
is divided into various ______. of the class from outside world is known as
A. modules ____.
B. functions (A)Polymorphism
C. structures (B)Encapsulation
D. objects (C)Data Hiding
Answer: B (D) scope resolution.
15) In Object-oriented programming, Answer: C
the problem is divided into _____.
A. classes & objects 22) What are cin and cout?
B. functions (A) pointers
C. structures (B) functions
D. modules (C) operator
Answer: A (D) stream objects
Answer: C
16) A class is ____ datatype.
A. primitive 23) Which header file must be included for
B. derived cin and cout?
C. user-defined (A) stdio.h
D. All of these (B) conio.h
Answer: C (C) iostream.h
(D) Both iostream.h and conio.h
17) A class is a collection of ____ and_____. Answer: C
(A)data-members & member functions
(B)data-members, member functions 24) Creating a new class using one or
and main() more existing classes is known as ____.
(C) data-members, member (A)Polymorphism
functions,main() and include statements (B)Encapsulation
(D)None of these (C)overloading
Answer: A (D)inheritance
Answer: D
18) An object is ......
(A)a variable of class datatype. 25) Ability of an operator or function call
(B)same as a class. to take different forms is known as ____.
(C)just like a global variable. (A) Polymorphism
(D)collection of data-members and (B) Encapsulation
member functions. (C) overloading
Answer: A (D)inheritance
Answer: A
19) Wrapping up of data & functions 26) cout is a/an __________ .
together in a class is known as _____. A. operator
(A)Overloading B. function
(B) Data Abstraction C. object
(C) Polymorphism D. macro
(D)Encapsulation Answer: C
Answer: D
27) Which of the following concepts
20) Including only necessary details and provides facility of using object of one class
ignoring additional details while defining inside another class?
a class is known as ____. A. Encapsulation
(A) Overloading B. Abstraction
(B) Data Abstraction C. Composition
(C) Polymorphism D. Inheritance
(D) Encapsulation Answer: C
Answer: B
lOMoAR cPSD| 23221915
66) How many constructors can a class have? 71) Which of the following statements are
(A) 0 true in c++?
(B) 1 (A) Classes cannot have data as
(C) 2 public members
(D) any number (B) Structures cannot have functions
Answer: D as members
(C) Class members are public by default
66) The new operator (D) None of these
A) returns a pointer to the variable Answer: B
B) creates a variable called new
C) obtains memory for a new variable 72) The following can be declared as friend in
D) tells how much memory is available a class
Answer: C (A) an object
(B) a class
67) A static function (C) a public data member
A. should be called when an object is (D) a private data member
destroyed B. is closely connected with and Answer: B
individual object of a class
C. can be called using the class name 73) A copy constructor takes
and function name (A) no argument
D. is used when a dummy object must (B) one argument
be created (C) two arguments
Answer: C (D) arbitrary no. of arguments
Answer: B
68) We can output text to an object of
class ostream using the insertion 74) Which can be passed as an argument to
operator<< because a function?
(A) the ostream class is a stream (A) constant
(B) the insertion operator works with (B) expression
all classes (C) another function
(C) we are actually outputting to cout (D) all of the above.
(D) the insertion operator is overloaded Answer: A
in ostream
Answer: D 75) Member functions, when defined
within the class specification:
69) Which of the following is not (A) are always inline.
the characteristic of constructor ? (B) are not inline.
(A) They should be declared in the (C) are inline by default, unless they are too
public section. big or too complicated.
(B) They do not have return type. (D) are not inline by default.
(C) They can not be inherited. Answer: A
(D) They can be virtual.
Answer: D 76) An entity representing
some characteristics and
70) A class defined within another class is: behaviour is-a) object
(A) Nested class b) class
(B) Inheritance c) struct
(C) Containership d) none of the above
(D) Encapsulation Answer: A
Answer: A
lOMoAR cPSD| 23221915
77) Which of the following is not the feature 84) Which of the following features of
of OOPs? object oriented programming is false?
a) Data Encapsulation a) Data is hidden and is not available
b) Inheritance to external functions.
c) Polymorphism b) New data & functions can be added
d) None of the above easily. c) Objects may communicate with
Answer: D each other through functions.
d) Emphasis is on the procedure rather
78) The wrapping up of data and functions than data.
into a single unit is Answer: D
a) Data Abstraction b)
Data Encapsulation c) 85) The following is the C++ style
Both (a) & (b) comment a) //
d) None of the above b) /*..*/
Answer: B c) –
d) None of the above
79) Which of the following feature supports Answer: A
reusability and extensibility of classes?
a) Inheritance b) 86) Which of the following statements is
Overloading c) false? a) Every C++ program must have a
Polymorphism main(). b) In C++, white spaces and carriage
d) None of the above returns are ignored by the compiler.
Answer: A c) C++ statements terminate with semicolon.
d) Main() terminates with semicolon.
80) Inheritance is ………..in nature. Answer: D
a) Intransitive
b) Transitive 87) An identifier in C++
c) Both (a) & (b) a) Must begin with a letter only
d) None of the above b) Is not differentiated by cases
Answer: B c) Contains all characters as significant
81) ………… is the ability for a message or d) None of the above
data to be processed in more than one form Answer: C
a) Class
b) Abstraction 88) ………. Provides a value for a
c) Polymorphism variable a) declaration statement
d) None of the above b) assignment statement
Answer: C c) definition statement
d) None of the above
82) The smallest individual unit in a program is Answer: B
………
a) Keyword 89) A collection of variables referred under
b) Identifier one name
c) Token a) Structure
d) None of the above b) Class
Answer: C c) Union
d) None of the above
83) Which of the following features of Answer: A
procedure oriented programming is false
a) Large programs are divided into small 90) A memory location shared by two or
or units called functions. more different variables
b) Employs bottom-up approach in a) Structure
program design. b) Class
c) Most of the functions share global c) Union
data. d) None of the above. d) None of the above
Answer: B Answer: C
lOMoAR cPSD| 23221915
96) In C++, the statements are enclosed 103) 31. In C++, ………. is the
within a) parenthesis statement terminator
b) square brackets a) semicolon
c) curly brackets d) b) colon
None of the above c) new line
Answer: C d) None of the above
Answer: A
97) The following tells the compiler where
the program begins 104) Modules operator (%) has
a) Function prototype higher precedence than
b) Forward declaration of a) Divide (/) operator b)
class c) main() Multiply (*) operator c)
d) None of the above Negation (unary minus) d)
Answer: C Bitwise left shift operator
Answer: C
lOMoAR cPSD| 23221915
105) The result of the following statement 110) Data members and member functions
is int y = 7; are enclosed within
int ans = ++y; a) class
cout<<”ans=”<<ans; b) structure
cout<<”y”<<y; c) union
a) ans=7, y=7 d) None of the above
b) ans=8,y=7 Answer: A
c) ans=8,y=8;
d) none of the above 111) Inline functions are
Answer: C a) Declared in the class defined outside
the class
106) Consider the following if b) Defined outside the class using
construct If(x=0) keyword intime
cout<<”Inside loop!”; c) Defined inside the class using keyword inline
cout<<”Outside loop”; d) None of the above
The result of the above code segment Answer: B
is. a) inside loop
b) outside loop 112) The default class access scope
c) both (a) & (b) is a) Private
d) none of the above b) Public
Answer: B c) Protected
d) None of the
107) The result of 2 & 3 is above Answer: A
a) 2
b) 3 113) The default scope for a structure
c) 5 is a) Private
d) none of the above b) Public
Answer: A c) Protected
d) None of the above
108) Which of the following statements Answer: B
regarding enumerators is false?
a) Enumeration is an alternative method 114) The private data members of a class
for naming integer constants/ are accessible
b) An enumerator value can’t be changed in a) Directly to objects of that class
a program b) Only to the member functions
c) An integer value may be assigned to c) To any function defined outside a
an enumerated variable class d) None of the above
d) An enum defined within a structure is Answer: B
local to the structure
Answer: C 115) The objects can directly access
a) Public members
109) Which of the following statements b) Private members
is false? c) Both (a) & (b)
a) typedef defines new data types d) None of the
b) Using typedef does not replace the standard above Answer: A
C++ data type name with the new name
c) The new name defined by typedef, can 116) The following is a valid statement in
be used as a type for another typedef C++ a) int x=(int)2.50;
d) None of the above b) int x=int(2.50);
Answer: A c) Both (a) & (b)
d) None of the above
Answer: C
Downloaded by William Turkson Sam (willturksam@gmail.com)
lOMoAR cPSD| 23221915
117) Which of the following operator can 123) When a member function of a class
be overloaded call another member function, it is
a) Member access operator ( . & a) Nesting of classes b)
.*) b) Conditional operator (?:) Nesting of functions c)
c) Scope resolution operator Nesting of objects d)
(::) d) None of the above None of the above
Answer: D Answer: B
118) Using same function name to 124) A function defined inside a class is
perform different tasks is called a) A class function
a) Function polymorphism b) A friend function c)
b) Runtime polymorphism A member function d)
c) Function prototype None of the above
d) None of the above Answer: C
Answer: A
125) Information is made shareable
119) Default argument is through a) inheritance
a) Specified in function definition b) data encapsulation
b) Specified in function declaration c) data abstraction d)
c) Specified from left to right none of the above
d) None of the above Answer: A
Answer: B
126) Functions can returns
120) What is wrong with the a) arrays
following statement? b) reference
float s_interest (float principal, int c) object
rate=0.25, int time); d) all of the above
a) variables must not be specified in Answer: D
function prototype
b) arguments may only be defaulted from 127) The memory for date members
right to left is allocated
c) the default value must be specified a) When a class is defined
when making a function call b) When an object is initialized
d) none of the above c) When an object is created d)
Answer: B None of the above
Answer: B
121) Which of the following statements
regarding function overloading is not true. 128)The memory for member functions
a) If is used to handle different data types is allocated
at one place a) When a class is defined
b) When making a function call, if no exact b) When a object is created
match is found, promotion is the only c) When an object is initialized
criteria to find a match. d) None of the above
c) The default arguments can not be Answer: A
used instead of overloading
d) Unrelated functions should not 129) The dot operator relates
be overloaded a) A class member and a class object
Answer: C b) A class object and a class
122) The private members of a class c) A class and a member of that class
implement the OOP concept of d) A class object and member of that class
a) Data abstraction Answer: D
b) Data hiding
c) Message passing
d) None of the above
Answer: B
130) A class having another class definition 137) new operator is used
is a) Nested class a) to define a new variable
b) Subordinate class b) to create a new data type
c) Enclosing class d) c) to allocate memory
None of the above dynamically d) none of the above
Answer: C Answer: C
132) The data members of a class 139) A class having no public constructors
are initialized is a) A private class
a) in class definition b) A public class c)
b) by a non-member function An abstract class d)
c) through constructor function when a None of the above
class object is created Answer: A
d) none of the above
Answer: C 140) If a constructor function is defined
in private section of a class, then
133) A constructor function is a) The object cannot be created
a) A friend function to a class b) Only member functions and friends
b) A member function with the same name may declare objects of the class
as its class c) Both (a) & (b)
c) A non-member function d) None of the above
d) None of the above Answer: C
Answer: B
141) A constructor with no argument is
134) An enumerated type is composed of a) Default constructor
a) Integer values with user defined name b) Parameterized constructor
b) Variables of different data types c) Copy constructor
c) Constant numeric values d) None of the above
d) None of the above Answer: A
Answer: A
142) If default arguments are provided to
135) In C++, the arguments by default a constructor function, then it becomes
are passed by a) Default constructor
a) call be reference b) Copy instructor
b) call be value c) Parameterized constructor
c) both (a) & (b) d) None of the above
d) none of the above Answer: A
Answer: B
143) The class of which the objects are
136) is an example of not instantiated is
a) unary operator a) Abstract class
b) binary operator b) Virtual class
c) ternary operator c) Static class
d) none of the above d) None of the above
Answer: C Answer: A