Que.1. Which type of class has only one unique value for all the
objects of that same class?
A: this
B: Friend
C: Static
D: both a and b
Right Answer: C
Que.2. What is a constructor?
A: A class
automatically called whenever a new object of this class is created.
B: A class
automatically called whenever a new object of this class is destroyed.
C: A function
automatically called whenever a new object of this class is created.
D: A function
automatically called whenever a new object of this class is destroyed.
Right Answer: C
Que.3. Under which of the following circumstances, synchronization
takes place?
A: When the file is
closed
B: When the buffer is
empty
C: Explicitly, with
manipulators
D: both a and c
Right Answer: D
Que.4. Which of the following functions below can be used Allocate
space for array in memory?
A: calloc()
B: malloc()
C: Realloc()
D: both a and b
Right Answer: A
Que.5. C++ provides facility to specify that the compiler should match
function calls with the correct definition at the run time. This process is
called as
A: Static binding
B: Dynamic Binding
Right Answer: B
Que.6. By default, all members of a class have ___________ access for
all its members
A: Public
B: Protected
C: No access
D: private
Right Answer: D
Que.7. How would you read the expression x.y as?
A: member y of object
pointed by x
B: member y of object x
C: member x of object y
D: All choices are
correct.
Right Answer: B
Que.8. Under what conditions a destructor destroys an object?
A: Scope of existence
has finished
B: Object dynamically
assigned and it is released using the operator delete.
C: Program terminated.
D: Both a and b.
Right Answer: D
Que.9. Which operator is used to define a member of a class from
outside the class definition itself?
A: ::
B: :
C: >>
D: <<
Right Answer: A
Que.10. if no constructor is declared, the compiler assumes the class
to have a default constructor with no arguments
A: True
B: False
Right Answer: A
Que.11. ios::ate is used for
A: Set the initial
position at the end of the file.
B: Set the initial
position at the start of the file.
C: Set the last
position at the end of the file.
D: Set the last
position at the start of the file.
Right Answer: A
Que.12. What defines a general set of operations that will be applied
to various types of data?
A: Template class
B: Function template
C: Class template
D: Both a and c above
Right Answer: B
Que.13. What is deep copy?
A: A deep copy creates
a copy of the dynamically allocated objects too.
B: A deep copy just
copies the values of the data as they are.
C: A deep copy creates
a copy of the statically allocated objects too
D: Both b and c above
Right Answer: A
Que.14. How do we check if the file has reached its end?
A: Use if_file_end()
B: use end_of_file()
C: use eof()
D: both a and c
Right Answer: C
Que.15. There is nothing like a virtual constructor of a class.
A: False
B: True
Right Answer: B
Que.16. What happens when a pointer is deleted twice?
A: It can abort the
program
B: It can cause a
failure
C: It can cause an
error
D: It can cause a trap
Right Answer: D
Que.17. What is the Difference between struct and class in terms of
Access Modifier?
A: By default all the
struct members are private while by default class members are public.
B: By default all the
struct members are protected while by default class members are private.
C: By default all the
struct members are public while by default class members are private.
D: By default all the
struct members are public while by default class members are protected.
Right Answer: C
Que.18. Vtables
A: creates a static
table per class
B: creates a static
table per object
C: creates a dynamic
table per class
D: creates a dynamic table
per object
Right Answer: A
Que.19. Which of the following library function below by default aborts
the program?
A: Terminate()
B: end()
C: Abort()
D: exit()
Right Answer: A
Que.20. What is the output of the following code snippet?
class test {
public:
static int n;
test () { n++; };
~test () { n--; };
};
int test::n=0;
int main () {
test a;
test b[5];
test * c = new test;
cout << a.n << endl;
delete c;
cout << test::n << endl;
return 0;
}
A: 7 6
B: 6 7
C: 5 6
D: 6 5
Right Answer: A
No comments:
Post a Comment