Вы находитесь на странице: 1из 4

1. What is the only function all C++ programs must contain? A. start() C. main() Ans c 2.

What punctuation is used to signal the beginning and end of code blocks? A. { } C. BEGIN and END Ans- a 3. Which of the following is a correct comment? A. */ Comments */ C. /* Comment */ Ans- c 4. Evaluate !(1 && !(0 || 1)). A. True C. Unevaluatable Ans- a 5. Which of the following is not a correct variable type? A. float C. int Ans- b 6. The difference between x and x is a. The first one refers to a variable whose identifier is x and the second one refers to the character constant x. b. The first one is a character constant x and second one is the string literal x c. Both are same d. None of above B. real D. double B. False B. ** Comment ** D. {Comment} B. -> and <D. ( and ) B. system() D. program()

Ans a 7. What is output of follwoing int main() { cout << "R4R" << endl; return 0; } a. Execution time error c. R4R Ans- b b. Syntax error d. None

8. We declare a function with ______ if it does not have any return type a. long c. void ans- c 9. The keyword endl a. Ends the execution of program where it is written b. Ends the output in cout statement c. Ends the line in program. There can be no statements after endl d. Ends current line and starts a new line in cout statement. Ans- d b. double d. int

10. Overloaded functions are

a. b. Very long functions that can hardly run One function containing another one or more functions inside it.

c. d.

Two or more functions with the same name but different number of parameters or type. None of above

ans- d 11. C contains two special pointer operators: a. * and & c. & and && Ans- c 12. Main() is an example of a. library function c. header ans- a 13. In which statements, does a CONTINUE statement cause the control to go directly to the test condition and then continue the looping process? a. FOR and WHILE c. DO-WHILE and IF-ELSE ans- d 14. Find out the incorrect statement for strlen() function a. Returns the length of a string b. Does not count the null terminator c. Has general form strlen(); d. All of above ans- a b. WHILE and IF-ELSE d. While and DO-WHILE b. user-defined function d. statement b. * and && d. % and &

15. The advantage of a SWITCH statement over an ELSE-IF statement a. A default condition can be used in the SWITCH b. The SWITCH is easier to understand c. Several different condition can cause one set of statements to be executed in a SWITCH d. Several different statements can be executed in a SWITCH e. None of above ans- b

16. To increase the value of c by one which of the following statement is wrong? a. c++; c. c + 1 => c; ans- c 17. Find out the error in following block of code. If (x = 100) Cout << x is 100 ; a. b. c. d. 100 should be enclosed in quotations There is no semicolon at the end of first line Equals to operator mistake Variable x should not be inside quotation b. c = c + 1; d. c += 1

ans- c 18. Code: int a=10,b; b=a++ + ++a; printf("%d,%d,%d,%d",b,a++,a,++a); what will be the output when following code is executed a.12,10,11,13 c.12,11,11,11 b.22,10,11,13 d.22,13,13,13[Ans]

19. How many classes occurs in the concept of inheritance a.2 c.3 Ans- a 20. A FRIEND function is a a. Static function b. Member function Ans- b b.1 d.4

b.Non- member function d.Dynamic function