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

RAJALAKSHMI ENGINEERING COLLEGE

Thandalam, Chennai – 602 105


Department of Computer Science and Engineering
CS17302 - OBJECT ORIENTED PROGRAMMING
Unit-I-Class Test
Reg. No. : Name :
Year : Branch: Section:

I. Choose the best answer:

1. #include <iostream> is called _____.


a) Preprocessor directive b) Inclusion directive
c) File inclusion directive d) None of the mentioned

2. The #include directive:


a) Tells the preprocessor to grab the text of a file and place it
directly into the current file
b) Statements are not typically placed at the top of a program
c) All of the mentioned
d) None of the mentioned

3. If the file name is enclosed in double quotation marks:


a) The preprocessor treats it as a user-defined file
b) The preprocessor treats it as a system-defined file
c) The preprocessor treats it as a user-defined file & system-defined
file
d) None of the mentioned

4. If the file name is enclosed in angle brackets:


a) The preprocessor treats it as a user-defined file
b) The preprocessor treats it as a system-defined file
c) The preprocessor treats it as a user-defined file & system-defined
file
d) None of the mentioned

5. How many types of comments are there in C++?


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

6. What type of comments does C++ support?


a) single line b) multiline
c) single line and multi-line d) none of the mentioned

7. What is a comment in C++?


a) comments are parts of the source code disregarded by the compiler
b) comments are executed by the compiler to find the meaning of the
comment
c) comments are executable
d) none of the mentioned

8. Comments in C++ starts with _____ symbol.


a) // b) \\ c) ** d) None of the above
9. What is used to write multi line comment in C++?
a) /* …. */ b) /$ …. $/ c) // d) none of the mentioned

10. Pick the odd one out:


a) array typeb) character type c) boolean type d) integer type

11. Which data type is used to represent the absence of parameters?


a) int b) short c) void d) float

12. Which type is best suited to represent the logical values?


a) integer b) Boolean c) character d) all of the mentioned

13. Is bool a fundamental data type in C++?


a) Yes
b) No, it is a typedef of unsigned char
c) No, it is an enum of {false, true}
d) No, it is expanded from macros

14. Which of the following is not one of the sizes of the floating point
types?
a) short float b) float c) long double d) double

15. The size of an object or a type can be determined using which


operator?
a) malloc b) sizeof c) malloc d) calloc

16. It is guaranteed that a _____ has at least 8 bits and a _____ has at
least 16 bits.
a) int, float b) char, int c) bool, char d) char, short

17. Which of the following will not return a value?


a) null b) void c) empty d) free

18. Which operator is having the highest precedence?


a) postfix b) unary c) shift d) equality

19. The precedence of arithmetic operators is (from highest to lowest):


a) %, *, /, +, – b) %, +, /, *, – c) +, -, %, *, / d) %, +, -, *, /

20. Where does the execution of the program starts?


a) user-defined function b) main function
c) void function d) none of the mentioned

21. How many minimum numbers of functions need to be presented in C++?


a) 0 b) 1 c) 2 d) 3

22. All keywords in C++ are in


a) LowerCase b) UpperCase letters c) CamelCase letters d) None

23. Which of the following is not a valid C++ variable name?


a) int number; b) float rate;c) int variable_count; d) int $main;

2 B.BHUVANESWARAN | AP (SG) | CSE | Rajalakshmi Engineering College | Chennai


24. Which of the following is true for variable names in C++?
a) They can contain alphanumeric characters as well as special
characters
b) It is not an error to declare a variable to be one of the
keywords(like goto, static)
c) Variable names cannot start with a digit
d) Variable can be of any length

25. Which is valid C++ expression?


a) int my_num = 100,000; b) int my_num = 100000;
c) int my num = 1000; d) int $my_num = 10000;

26. Which of the following is not an arithmetic operation?


a) a *= 10; b) a /= 10; c) a != 10; d) a %= 10;

27. Operation “a = a * b + a” can also be written as:


a) a *= b + 1; b) (c = a * b)!=(a = c + a);
c) a = (b + 1)* a; d) All of the mentioned

28. Which of the following data type will throw an error on modulus
operation (%)?
a) char b) short c) int d) float

29. Which among the following is NOT a logical or relational operator?


a) != b) == c) || d) =

30. Which of the following are unary operators?


a) sizeof b) – c) ++ d) all of the mentioned

31. Associativity of an operator are:


a) Right to Left b) Left to Right
c) Random fashion d) Both Right to Left and Left to Right

32. Which of the following method are accepted for assignment?


a) 5 = a = b = c = d; b) a = b = c = d = 5;
c) a = b = 5 = c = d; d) None of the mentioned

33. Which of the following operators has the lowest precedence?


a) != b) && c) ?: d) ,

34. Which operator is used for input stream?


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

35. The if...else statement can be replaced by which operator?


a) Bitwise operator b) Conditional operator
c) Multiplicative operator d) None of the mentioned

36. The switch statement is also called as?


a) choosing structure b) selective structure
c) certain structure d) none of the mentioned

B.BHUVANESWARAN | AP (SG) | CSE | Rajalakshmi Engineering College | Chennai 3


37. What is this operator called ?:?
a) conditional b) relational c) casting operator d) none

38. Which of the following is a ternary operator?


a) && b) >>= c) ?: d) ->

39. Which operator works only with integer variables?


a) increment b) decrement
c) both increment & decrement d) none of the mentioned

40. How many types are there in increment/decrement operator?


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

41. Pick out the correct statement.


a) Increment operator ++ adds 1 to its operand
b) Increment operator ++ adds 2 to its operand
c) Decrement operator ++ subtracts 1 to its operand
d) None of the mentioned

42. Example of iteration in C.


a) for b) while c) do-while d) all of the mentioned

43. Which looping process is best used when the number of iterations is
known?
a) for b) while c) do-while d) all looping processes

44. The following code ‘for(;;)’ represents an infinite loop. It can be


terminated by.
a) break b) exit(0) c) abort() d) all of the mentioned

45. Which loop is most suitable to first perform the operation and then
test the condition?
a) for loop b) while loop c) do-while loop d) none

46. The keyword ‘break’ cannot be simply used within:


a) do-while b) if-else c) for d) while

47. Which keyword is used to come out of a loop only for that iteration?
a) break b) continue c) return d) none of the mentioned

48. The insertion operator is another name for


a) input operator b) output operator
c) extraction operator d) None of the above

49. The extraction operator is another name for


a) input operator b) output operator
c) extraction operator d) None of the above

50. When will the cin can start processing of input?


a) After pressing return key b) By pressing blank space
c) After pressing return key & BY pressing blank space d) None

4 B.BHUVANESWARAN | AP (SG) | CSE | Rajalakshmi Engineering College | Chennai

Вам также может понравиться