Anda di halaman 1dari 3

OPTIM TEST 3

I.CHOOSE THE CORRECT ANSWER:


35 X
1 = 35
1._____ is the increment operator in C++.
a) ~~
b) ++
c)+*
d)*+
2. ____ is the escape sequence for backspace.
a) \b
b) \n
c) \o
d) \u
3. Operators are classified as __ numbers.
a) 11
b) 13
c) 14
d) 15
4. A block of code begins and ends with ____
a) <>
B) ()
C) {}
D) {}
5. In order to exit from switch statement ____ is used.
a)break
b) continue
c) switch
d) case
6. The preprocessor directive starts with ___
a)#
b) $
c) @
d) %
7. If a=5,b=5 what will be the value stored in the variables aof the snippet a = a + b++;
a) 10
b)11
c) 6
d)P 1
8.Which of the following is used to represent a pointer variable.
a) ::
b) &
c) !
d) *
9. unsigned int data type has ____ bits length.
a) 8
b) 16
c)32
d) 64
10. ___ have special meaning to the language compiler, these are reserved words for
special purpose.
a)keyword
b) tokens
c)identifier
d)punctuators.
11. x=10 , f=20 , c= x++ + ++f . value of c is __
a) 30
b) 31
c) 32
d) none of these
12. statements in a program need not necessarily be executed in a ___ order.
a)top down
b) sequential
c) bottom up
d) right to left
13. The sequence of digits starting with OX are treated as ___ constants.
a)octal
b) binary
c) hexadecimal
d) decimal
14. What is the prefix character used to represent escape sequence.
a)*
b) /
c)&
d) \
15. The constants that should not have a fractional part is ___
a)float
b) integer
c) double
d) single
16. Which of the following is the conditional operator
a) <
b) >
c) =
d) ?:
17. ___ is used to enclose a single character.
a)
b)
c) { }
d) [ ]
18. Which punctuator is used to terminate a C++ statement.
a) :
b) }
c) ;
d) ,
19. The machine readable form of the program is called ___
a) program
b) object code
c) source code
d) machine
readable code.
20. Which of the following is a multiple branching statement.
a) if
b) if else
c) nested if
d) switch
21. Which of the following is called the insertion operator.
a) <<
b) >>
c) <<=
d)>>=
22. Statement used in C++ to display message and result is
a) printf
b)scanf
c) cin
d) cout
23. Which of the following is the indirect component selection operator in C++
a)
b) *
c) *
d) &
24. Which data type is used to declare a generic pointer
a) int
b) float
c) char
d) void
25. ___ creates branches for multiple alternative selections of code, depending on the
value of a single variable.
a) switch
b) if
c) while
d)for
26. The range of int data type is
a) -32678 to 32678 b)-32768 to 32767 c) -32767 to 32768 d)-32768 to 32768
27. Which returns the size in terms of bytes.
a) int
b) sizeof
c) pointer
d) implicit conversion
28. int x; x = 7/3. The value of x is

a)2
b)2.33
c)0
d) a and b
29. for(int I = 1;i<50;i++); The loop will be executed ____ times.
a) 48
b)49
c)50
d)47
30. Inner and outer loop may not have same control variable as it will lead to ___ error.
a)syntax
b)runtime
c)compilation
d)logical
31. The ___ instructs the compiler to store the variable in the CPU registers to optimize
access.
a) auto
b) static
c)extern
d) register
32. ___ is called as exit-check loop.
a)while
b) if
c) for
d) do- while
33. How many storage specifiers are there in C++
a) 1
b) 2
c) 3
d) 4
34. Static and register variables are automatically initialized to ____ value when they are
declared.
a) 0
b) 1
c) null
d) -1
35. switch expression should be evaluated on ___ constants only.
a) int
b) float
c) char
d) void
ANSWER ANY TEN OF THE FOLLOWING:
10 X 2
= 20
36. What is enumeration. Specify with syntax and example.
37. Write short notes on The extraction operator.
38. Debug the program.
#include<IOSTREAM.H>
main[]
{
Int a,b;
cin<< \n Enter two numbers ;
result := a* b;
cout<<\n<<Result;
}
39. Differentiate entry check loop and exit check loop.
40. What are the rules to be followed while writing variable names.
41. Write the syntax of switch case statement./
42. Evaluate the expression where a=5, b=6, c=7.
b += a%2*c
43. What are the rules for the formation of nested loops.
44. Define conditional operator with example.
45. What are the sections of C++ program.
46. Explain the types of operator classification based on operand requirements.
47. What are control structures.
ANSWER ANY FOUR OF THE FOLLOWING:
4X5
= 20
48. Explain the various forms of if statement.
49. Explain the types of loops in C++ with example.
50. Explain the steps involved in program development of C++ programs.
51. Explain in detail the data types of C++
52. How many storage specifiers are there in C++. Explain in detail.
53. Give a detailed explanation on the operators used in C++.
54.Answer the following questions based on the program
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int num =2;
do
{
cout<<num * num<<\t;
num += 1;
}while(num>6);
getch();
}
a)Identify the
(i) control variable used
(ii) identify the statements that form the body of the loop.
(iii) the test expression.
b)How many times the loop be executed.

c)What is the output of the program.


d)What type of loop is this.

Anda mungkin juga menyukai