Upload
anonymous-boresf
View
217
Download
0
Embed Size (px)
Citation preview
7/27/2019 C++ Questionsshekhar.doc
1/3
Questons for C++ Test #1
Name:............. Roll No .............. Marks ........
1. How many times the program will print "IndiaBIX" ?
#include
int main()
{ Cout
7/27/2019 C++ Questionsshekhar.doc
2/3
9. To increase the value of c by one which of the following statement is wrong?
a. c++;
b. c = c + 1;
c. c + 1 => c;
d. c += 1
10. Which of the following can not be used as identifiers?
a. Letters
b. Digits
c. Underscores
d. Spaces
11. Which of the following statement is true?
a. String Literals can extend to more than a single line of code by putting a backslash sign at the end of eachunfinished line.
b. You can also concatenate several string constants separating them by one or several blank spaces, tabulators,new line or any other valid blank character
c. If we want the string literal to explicitly made of wide characters, we can precede the constant with the L prefix
d. All of above12. The continue statement
a. resumes the program if it is hanged
b. resumes the program if it was break was applied
c. skips the rest of the loop in current iteration
d. all of above
13. How many copies of a class static member are shared between objects of the class if objects are 3?
a) 0
b) 1
c) 2
d) 3
e) 4
14. Which of the following is true about const member functions?
a) const members can be invoked on both const as well as nonconst objects.
b) nonconst members can not be invoked on const object (and naturally, can be invoked only on nonconst objects)
c) Both a and b
d) irrelevent
15. Which of the following keyword supports dynamic method resolution?
a) free
b) dynamic
c) virtual
d) alloc
7/27/2019 C++ Questionsshekhar.doc
3/3
16. Can two classes contain member functions with the same name?
a) No.
b) Yes, but only if the two classes have the same name.
c) Yes, but only if the main program does not declare both kinds.
d) Yes, this is always allowed
17. What does STL stand for?
a) Super Template Library
b) Super Template Linking
c) Standard Template Library
d) None of the above
18. Which of the following operator cannot be overloaded?
a) +
b) =
c) :: (scope resolution operator)
d) All of the above
19. A derived class
a) Inherits data members and member functions from base class.
b) Inherits constructors and destructor.
c) Object can access protected members with the dot operator.
d) Inherits data members and member functions from base class as well as Inherits constructors and destructor.
20. What is the implicit pointer that is passed as the first argument for nonstatic member functions?
a) Void
b) Nullc) this pointer
d) garbage