Академический Документы
Профессиональный Документы
Культура Документы
Concepts
1. Inventor
of C++ language is
A. John Dell
B. Bjarne Stroustrup
C. Thomusn Steve
D. Karl Thomus
Answer : B
2.Which of the following is not a type of constructor?
A. Copy constructor
B. Friend constructor
C. Default constructor
D. Parameterized constructor
Answer: B
Friend is a function to access private members of 2 different classes
to which it has been declared as friend.
D. Inherited
Answer : B
10. The null character will take space of
A. 0 byte
B. 2 byte
C.1 byte D. 8 byte
Answer :C
that can be modified by other than the statement in the source codes
itself, such as interrupt service routine and memory-mapped I/O port or
concurrent thread execution.
iii) Mutable - particular member of a structure or class can be altered
even if a particular structure variable, class, or class member
function is constant..
struct data
{
char name[80];
mutable double salary;
}
const data MyStruct = { "Satish ", 1000 }; //initlized by complier
strcpy ( MyStruct.name, "Shilpa "); // compiler error
MyStruct.salaray = 2000 ; // complier is happy allowed
12. What happens when a class with parameterized constructors and
having no default constructor is used in a program and we create an
object that needs a zero-argument constructor?
A. Compile-time error.
B. Preprocessing error.
C. Runtime error.
D. Runtime exception.
Answer: Option A
22.What is a template?
Answer: Templates allow us to create generic functions that admit any
data type as parameters and return a value without having to overload the
function with all the possible data types
23. What is an incomplete type?
Ans: Incomplete type refers to pointers in which there is non availability
of the implementation of the referenced location or it points to some
location whose value is not available for modification.
Example:
int *i=0400 // i points to address 400
*i=0; //set the value of memory location pointed by i.
Incomplete types are otherwise called uninitialized pointers.
34. Which of the following two statements call copy constructor and
which one calls assignment operator?
MyClass t1, t2;
MyClass t3 = t1; // ----> (1) //copy constructor
t2 = t1;
// -----> (2) //Copy constructor is called when a new object
is created from an existing object. Assignment operator is called when
an already initialized object is assigned a new value from another
existing object. 2) calls assignment operator..
35. Which pointer is implicit pointer passed as the first argument for
non-static member functions?
A. self pointer
B.std::auto_ptr pointer
C. Myself pointer
D.this pointer
Answer : D
36. How should runtime errors be handled in C++?
The runtime errors in C++ can be handled using exceptions.
class b:public x
{public: b();
};
b::b()
{ a=20; cout<<a;}
main ()
{ b temp; }
What will be the output of this program?
a) 10
b) 20
c) 20 10
Answer: b
d) 10 20
http://skillgun.com/cpp/constructors/i
nterview-questions-andanswers/paper/237