C++
Knowledge Assignment test MCQ by Krishna Rajput
Info:- Dear student this test is based on your
best practice result that u know about this test how more knowledge of C++
computer programming (chapter covered this test function to Polymorphism) so
read question carefully and given answer this is not decide only your result
it’s my result also so best of luck.
Instruction: - total question 35 all question
are MCQ (Multiple Choice Question) in Red Color is
all Question and Black color is your choice for given answer each question
marks 2 marks total 70 marks
Time
Duration: 1h15m
1) What syntax of Function?
a)
Type name ( parameter1, parameter2, ...) {
statement }
b)
Name (parameter1, parameter2,...) { statement }
c)
( parameter1, parameter2, ...) name { statement
}
d)
( parameter1, parameter2, ...) { statement }
2) What Output of below this program?
#include <iostream>
int addition (int a, int b)
{
int r;
r=a+b;
return (r);
}
int main ()
{
int z;
z = addition (5,3);
cout << "The result is " << z;
return 0;
}
a) 5
b) 3
c) 8
d) 15
3) What is Output of below given program?
#include <iostream>
void duplicate (int& a,
int& b, int& c)
{
a*=2;
b*=2;
c*=2;
}
int main ()
{
int x=1, y=3, z=7;
duplicate (x, y, z);
cout << "x=" << x << ", y="
<< y << ", z=" << z;
return 0;
}
a) x=2,
y=6, z=14
b) x=1,
y=3, z=7
c) x=2,
y=2, z=2
d) x=a,
y=b, z=c
4) What Syntax of inline
function?
a) inline
type name ( arguments ... ) { instructions ... }
b) (
arguments ... ) { instructions ... } inline type name
c) inline
type name { instructions ... } ( arguments ... )
d) None
of these.
5) In Arithmetic Pointer Using
Char data type and variable name assign mypointer and using increment operater(Where
mypointer value is 100000
For example char=*mypointer++
what is value of mypointer after increment?
a)
10000
b)
100002
c)
1000
d)
100001
6) In Arithmetic Pointer Using
longint data type and variable name assign mypointer and using increment
operater(Where mypointer value is 1991
For example longint=*mypointer++
what is value of mypointer after increment?
a)
1995
b)
1992
c)
1993
d)
1994
7) Which allows you
to create a derived class that inherits properties from more than one base
class?
a) Multilevel inheritance
b) Multiple
inheritance
c) Hybrid
Inheritance
d) Hierarchical
Inheritance
8) The function
whose prototype is void get Data (Item *thing); receives?
a)
a pointer to a
structure
b)
a reference to a structure
c)
a copy of a structure
d)
Nothing
9) Which of the following statements declares a variable that can contain a
decimal number?
a)
dec payRate;
b)
dec hourlyPay
c)
float payRate
d)
float hourlyPay;
10) A pointer to
a block of memory is effectively same as an array?
a)
True
b)
False
11) The keyword used to transfer control from a function back to
the calling function is?
a)
switch
b)
goto
c)
go back
d)
return
12) What is
error below given program?
#include<iostream.h>
#include<conio.h>
Main(
{
Cout<”Hello Welcome to C++”;
Cout<<”\n”
Cout<”Find the error this program”;
Getch()
Return 0;
}
a)
function missing
b)
operator missing
c)
semicolon missing
d)
all of above
13) A Derived class with only one
base class is called?
a)
Multiple inheritance
b)
Single inheritance
c)
Hybrid inheritance
d)
None of these
14) The member function of a
friend class can have direct access to data?
a)
Public
b)
Private
c)
Protected
d)
b & c both
15) In which type of inheritance,
constructors are executed in the order of inheritance?
a)
Single inheritance
b)
Multiple inheritance
c)
Multilevel inheritance
d)
None of these
16) A virtual function, equated
to zero is called a?
a)
Pointers
b)
Pure virtual function
c)
Polymorphism
d)
None of these
17) What means one name, multiple
forms?
a)
Inheritance
b)
Polymorphism
c)
Function
d)
Abstraction
18) The member function could be
selected while the program is running known as?
a)
Compile-time polymorphism
b)
Run-time polymorphism
c)
Abstraction
d)
Function
19) Mechanism of driving a class
from ‘derived class’ known as multi-level inheritance?
a)
True
b)
False
c)
None of these
d)
Koi nahi option
20) What is output of below given
program?
1.
#include<iostream.h>
2.
#include<conio.h>
3.
cout<<”Welcome to
C++ programming\n”;
5.
main()
6.
{
7.
cout<<”Education
is need to all human people\n”;
8.
cout<<”Please
Indian people get education free of coast it’s my aim”;
9.
getch();
10.
return 0;
11.
}
a) Lines
3,8,7,& 4
b) Lines
4,7,8& 3
c) Lines
8,7,4& 3
d) Lines
7,8,3& 4
21) Operator function must me?
a)
Member function
b)
Friend function
c)
Both a & b
d)
None of these
22) Unary overloaded operator
function can be invoked by expression?
a)
Op x
b)
X op
c)
None of these
d)
Both a & b
23) A minus operator when used as
unary, take just how many operator?
a)
Two
b)
One
c)
Three
d)
Both a & b
24) Member function has one
argument for unary operator a two argument for binary operator?
a)
True
b)
False
c)
Both a & b
d)
None of these
25) Constructor does not have?
a)
Void
b)
Return type
c)
Both a & b
d)
Ine mai se koi nahi
26) Integer int 1=integer
(0,100); The following declaration of constructor is?
a)
Implicit
b)
Explicit
c)
Ine mai se koi nahi
d)
Both a & b
27) The constructor can also be
used to allocated memory which creating?
a)
Class
b)
Object
c)
Function
d)
None of these
28) Dynamic initialization of
object can provide various initialization formats using?
a)
Constructor
b)
Overloaded constructor
c)
All of above
d)
None of these
29) What is used to destroy the
object that have been created by a?
a)
Constructor
b)
None of these
c)
Destructor
d)
Function
30) Constructor should declare in
the private section?
a)
False
b)
True
c)
Both a & b
d)
None of these
31) Destructor takes argument and
also returns value?
a)
True
b)
None of these
c)
False
d)
Both a & b
32) In class functions and
variables are collectively called?
a)
Members
b)
Declaration
c)
Definitions
d)
None of these
33) Which function is used to
assign values to member variables number and cost?
a)
Put data()
b)
Get data()
c)
Show data()
d)
Both a
& b
34) Private and public members
are known as?
a)
Visibility labels
b)
Access specified
c)
Data member
d)
Function
35) The variable declared inside
the classes are known as?
a)
Data member
b)
Class
c)
Object
d)
None of these
No comments:
Post a Comment
Please Comment Your Valuable Feedback....