Tuesday, March 4, 2014

3. BASIC STATEMENT

1. Which is a predefined object that corresponds to a standard input stream?

(a) cin (b) cout (c) cinput (d) coutput

2. Data is read from the keyboard during runtime by using the object

(a) c++in (b) cin (c) c++out (d) cout

3. In C++, which file comprises the combined properties of istream and ostream?

(a) iostream.h (b) stdio.h (c) string.h (d) conio.h

4. A preprocessor directive starts with the symbol

(a) \ (b) # (c) % (d) $

5. The operator >> is called as ------------

(a) Stream operator (b) Abstraction operator (c) Insertion operator (d) Extraction operator

6. The extraction operator is also called as

(a) Get from (b) Get to (c) Put to (d) Put from

7. Which of the following operators is called as insertion operator or put to operator?

(a) >> (b) > (c) < (d) <<

8. How many sections are there in C++ program?

(a) 5 (b) 2 (c) 3 (d) 4

9. Which of the following functions will be executed automatically when a C++ program is executed?

(a) call by reference (b) main (c) recursive (d) void

10. The program statements that cause a jump of control from one part of a program to another are called as

(a) Assignment (b) Control Structures (c) Loop (d) Declaration

11. How many major categories of control structures are there in C++?

(a) 5 (b) 2 (c) 3 (d) 4

12. Which is the simplest of all the decision statements?

(a) nested if (b) switch (c) Simple if (d) if - else

13. Which of the following execute a set of instructions repeatedly for a certain number of times?

(a) Loops (b) Selections (c) Statements (d) Operators

14. How many kinds of loops are there in C++?

(a) 3 (b) 4 (c) 2 (d) 1

15. Which loop is called as exit-check loop?

(a) while (b) do-while (c) do loop (d) for

16. Which of the following is an entry-check loop?

(a) while (b) switch (c) if (d) do-while

17. Which loop is called as an entry controlled loop?

(a) while (b) do loop (c) do-while (d) for

18. Which of the following statements forces the next iteration of the loop to take place by skipping the remaining code?

(a) break (b) end (c) continue (d) begin

19. Which of the following statements accomplishes jump from the current loop?

(a) Break (b) Switch (c) While (d) Continue

20. A program written in high level language is called as

(a) Executable code (b) User code (c) Object file (d) Source code

21. The machine-readable form of a program is called as ---------------

(a) User code (b) Computer code (c) Object file (d) Source code

22. Which translator programs create a machine-readable program from the source code ?

(a) Assembler (b) Interpreter (c) Converter (d) Compiler

23. Which operator extracts data from the input stream object and places the value in the variable to its right?

(a) Extraction (b) Abstraction (c) Stream (d) Insertion

24. Which operator directs the contents of the variable to its right to the object to its left?

(a) Abstraction (b) Extraction (c) Stream (d) Insertion

25. Which of the following variables get defined only when memory is fetched to store data?

(a) Function (b) Global (c) Local (d) Pointer

26. Which of the following statements chooses between two alternatives?

(a) switch (b) nested if (c) Simple if (d) if...else

27. Which decision statement creates branches for multiple alternatives sections of code, depending on the value of a single variable?

(a) switch (b) if...else (c) while (d) for

28. Every action block of switch statement should be terminated using

(a) break (b) continue (c) stop (d) return

29. Based on the position of the condition, how many classifications of loops are there in C++?

(a) 3 (b) 2 (c) 4 (d) 1

30. In which loop, condition marks the last statement of the body of the loop?

(a) while (b) for (c) switch (d) do-while

31. In for loop, which segment is evaluated before the commencement of every iteration?

(a) Increment (b) Any one of the choices (c) Test condition (d) Initialization

32. Nested if statement can be replaced by the statement of

(a) for (b) do-while (c) select case (d) switch case

33. An outer loop and an inner loop having the same control variable leads to

(a) Syntax error (b) Software error (c) Semantic error (d) Logical error

34. Which C++ file comprises of all standard declarations and definitions for predefined functions?

(a) Footer (b) Pointer (c) Program (d) Header

35. How many times the following loop will be executed? for(i=1;i<6;i++)

(a) 5 (b) 7 (c) 6 (d) 1

36. The break statement would exit only the

(a) Current function (b) Current program (c) None of these three choices (d) Current loop

37. The declarations for the object cin are available under the header file

(a) inputstream.h (b) stream.h (c) stdstream.h (d) istream.h

38. The statement which is used to exit from switch statement is

(a) exit (b) break (c) default (d) quit

39. Statement used in C++ to display messages and result is

(a) cin (b) print (c) printin (d) cout

40. Basic statements in C++ are constructed using

(a) operators (b) tokens (c) constants (d) variables

41. Read the following C++ program:
#i nclude < iostream.h>

void main()
{

int num=2;
do
{
cout << num*num <<'\t';
num +=1;
}
while (num<6);
}
Name the control variable used in the program.

(a) \t (b) num (c) None of these three choices (d) +=1

42. What is the test expression (condition) used?

(a) num (b) num * num (c) None of these three choices (d) (num<6)

43. How many times will the loop be executed?

(a) 4 (b) 5 (c) 3 (d) 6

44. What is the output of the following program?

(a) 4 9 16 25 (b) 0 4 9 25 (c) 2 4 9 16 25 (d) 6 4 6 8

45. The break statement would exit only the

(a) Current loop (b) Current program (c) Current function (d) None of these three choices

46. How many times will the following loop be executed? for(i =1; i<30; i++)

(a) 1 (b) 31 (c) 29 (d) 30

47. Which creates object files from source code?

(a) Program (b) C++ (c) Compiler (d) Computer

48. What is the error thrown by the compiler for the following snippet?
if(a>b);
cout <<"Greater";
e lse
cout <<"Lesser";

(a) Misplaced if ...... else (b) Misplaced if (c) Misplaced else (d) Misplaced else..... if

49. Which statement is used to skip a part of loop and start the next cycle of loop?

(a) Continue (b) Stop (c) Skip (d) Break

50. for(i =1;i<=10;i++) How many times is this loop executed?

(a) Ten times (b) Nine times (c) Not executed (d) Only one

51. Which is linked with libraries to create an executable file?

(a) Object code (b) Compiler (c) Programs (d) Source code

52. The declaration for the object cin is available in a header file called

(a) string.h (b) istream.h (c) conio.h (d) stdio.h

53. The appropriate declaration statement to initialize the variable 'name ' with the value 'Abdul Kalam' is

(a) char name[]= "Abdul Kalam";   
(b) char name= "Abdul Kalam";

(c) char[] name= "Abdul Kalam";    
(d) char []name= "Abdul Kalam";

54. Which of the following is an assignment operator?

(a) << (b) =  
(c) + (d) ==

55. While <( condition)> {...} loop is called as

(a) exit-check loop (b) nested loop  
(c) entry-check loop (d) multi-check loop

No comments:

Post a Comment