Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 3

Questons for C++ Test #1 Name:............. #include<iostream.

h> int main() {


Cout<<IndiaBIX"; main();

Roll No ..............

Marks ........

1. How many times the program will print "IndiaBIX" ?

return 0; Ans--Infinite

2. Functions cannot return more than one value at a time. 3. In C++ all functions except main() can be called recursively. 4. How many of the following statements are correct about an array? a. The array int num[26]; can store 26 elements.

True Yes

False No

b. The expression num[1] designates the very first element in the array. c. It is necessary to initialize the array at the time of declaration. d. The declaration num[SIZE] is allowed if SIZE is a macro. 5. Opertor Overloading is like that a. giving new meaning to existing C++ operators b. making c++ operators works with objects c. both a and b d. None of the above 6. What is output of follwoing int main() { cout << "R4R" << endl; return 0; } a) Execution time error b) Syntax error c) R4R d) None 7. In an assignment statement a=b; Which of the following statement is true? a. b. c. d. The variable a and the variable b are equal. The value of b is assigned to variable a but the later changes on variable b will not effect the value of variable a The value of b is assigned to variable a and the later changes on variable b will effect the value of variable a The value of variable a is assigned to variable b and the value of variable b is assigned to variable a. a = 2 + (b = 5); a = b = c = 5; a = 11 % 3 a. b. True False

8. All of the following are valid expressions in C++

9. To increase the value of c by one which of the following statement is wrong? a. b. c. d. 10. a. b. c. d. 11. c++; c = c + 1; c + 1 => c; c += 1 Letters Digits Underscores Spaces a. String Literals can extend to more than a single line of code by putting a backslash sign at the end of each unfinished 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 above 12. The continue statement a. b. c. d. 13. 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 resumes the program if it is hanged resumes the program if it was break was applied skips the rest of the loop in current iteration all of above

Which of the following can not be used as identifiers?

Which of the following statement is true?

How many copies of a class static member are shared between objects of the class if objects are 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) Null c) this pointer d) garbage

You might also like