1. What is the only function all C++ programs must contain?
a. Start().
b. System().
c. Main().
d. Program().

Answer: C

2. What punctuation is used to signal the beginning and end of code blocks?
a. { }.
b. -> and <-.
c. BEGIN and END.
d. ( and ).

Answer: A

3. Which of the following is a correct comment?

a. */ Comments */.
b. ** Comment **.
c. /* Comment */.
d. { Comment }.

Answer: C

4. Which of the following is not a correct variable type?
a. Float.
b. Real.
c. Int.
d. Double.

Answer: B

5. Which of the following is the correct operator to compare two variables?

a. :=.
b. =.
c. equal.
d. = =.

Answer: D

6. Which of the following is the boolean operator for logical-and?
a. &.
b. &&.
c. |.
d. |&.

Answer: B

7. The directives for the preprocessors begin with_____________.
a. ampersand symbol (&).
b. two Slashes (//).
c. number Sign (#).
d. less than symbol (<).

Answer: C

8. There is a unique function in C++ program by where all C++ programs start
their execution with ______________.

a. start().
b. begin().
c. main().
d. output().

Answer: C

9. __________ storage class is the only request to the compiler.
a. Extern
b. Static
c. Register
d. Auto

Answer: A

10. How many times is a do while loop guaranteed to loop?
a. 0.
b. Infinitely.
c. 1.
d. Variable.

Answer: D

11. Which of the following is not a jump statement in C++?
a. Break.
b. Goto.
c. Exit.
d. Switch.

Answer: D

12. A continue statement causes execution to skip to ____________.
a. the return 0; statement.
b. the first statement after the loop.
c. the statement following the continue statement.
d. the next iteration of the loo.

Answer: D

13. In a group of nested loops, which loop is executed the most number of times?
a. The outermost loop
b. The innermost loop
c. All loops are executed the same number of times
d. Cannot be determined without knowing the size of the loops bottom of form

Answer: B

14. Each pass through a loop is called a/an _____________.
a. enumeration.
b. iteration.
c. culmination.
d. pass through.

Answer: B

15. Which looping process checks the test condition at the end of the loop?
a. For.
b. While.
c. Do-while.
d. No looping process checks the test condition at the end.

Answer: C

16. In C++, 14 % 4 = ___________.
a. 1.
b. 2.
c. 3.
d. 4.

Answer: B

17. Variables that are declared, but not initialized, contain __________.
a. blank spaces.
b. zeros.
c. "garbage" values.
d. nothing - they are empty.

Answer: C

18. Array indexing always starts with the number ____________.

a. 0.
b. 1.
c. 2.
d. \0.

Answer: A

19. Variables with names that describe the data stored at that particular

memory location are called ________________.

a. identifiers.

b. constant variables.

c. floating point variables.

d. mnemonic variables.

Answer: D

20. The name of a variable is known as its _______________.

a. identifier.

b. constant.

c. data type.

d. base.

Answer: A

21. In C++, the % refers to ______________.

a. percentages.

b. modulus operator.

c. division.

d. data storage.

Answer: B

22. When a data type contains decimal numbers, assign the type_____________.

a. int.

b. char.

c. double.

d. long int.

Answer: C

23. Setprecision requires the header file___________________.

a. stdlib.h

b. iomanip.h

c. console.h

d. conio.h

Answer: B

24. The memory address of the first element of an array is called ____________.

a. floor address.

b. foundation address.

c. first address.

d. base address.

Answer: D

25. A variable P is called pointer if_________.

a. P contains the address of an element in DATA.

b. P points to the address of first element in DATA.

c. P can store only memory addresses.

d. P contain the DATA and the address of DATA .

Answer: A

26. You have a variable myNum that has the value 5. You want to print your

variable to the screen. How would you do it?

a. cout<< "My number is", myNum << endl;

b. cout<< "My number is 5" << endl;

c. cout<< My number is << myNum << endl;

d. cout<< "My number is" << myNum << endl;

Answer: D

27. What will be output if you will execute following c code?

#include<stdio.h>

int main()

{

float a=0.5, b=0.9;

if(a&&b>0.9)

printf("Sachin");

else

printf("Rahul");

return 0;

}

a. Sachin.

b. Rahul.

c. Run time error.

d. Compilation error.

Answer: B

28. What function is used to release the allocated memory space?

a. Deallocate().

b. Release ().

c. Free ().

d. Empty ().

Answer: C

29. What will be output if you will execute following c code?

#include<stdio.h>

#include<conio.h>

void main()

{

char c=-'a';

printf("%d",c);

}

a. 65.

b. -65.

c. –a.

d. -97.

Answer: D

30. Find out the error in following block of code.

If (x = 100)

Cout << “x is 100”;

a.100 should be enclosed in quotations.

b. There is no semicolon at the end of first line.

c. Equals to operator mistake.

d. Variable x should not be inside quotation.

Answer: C

31. Looping in a program means _____________.

a. jumping to the specified branch of program.

b. repeat the specified lines of code.

c. both of above.

d. none of above.

Answer: B

32. The difference between while structure and do structure for looping is________.

a. in while statement the condition is tested at the end of first iteration.

b. in do structure the condition is tested at the beginning of first iteration.

c. the do structure decides whether to start the loop code or not whereas while

statement decides whether to repeat the code or not.

d. in while structure condition is tested before executing statements inside loop

where as in do structure condition is tested before repeating the statements

inside loop.

Answer: D

33. Which of the following is not a looping statement in C?

a. While.

b. Until.

c. Do.

d. For.

Answer: B

34. Which of the following is selection statement in C++?

a. Break.

b. Goto.

c. Exit.

d. Switch.

Answer: D

35. The continue statement _______________.

a. resumes the program if it is hanged.

b. resumes the program if it was break was applied.

c. skips the rest of the loop in current iteration.

d. all of above.

Answer: C

36. Which of the following is a valid C++ identifiers?

a. const.

b. _amount.

c. 2ndclass.

d. xyz123.

Answer: D

37. Observe the following statements and decide what do they do

string mystring;

getline(cin, mystring);

a. Reads a line of string from cin into mystring.

b. Reads a line of string from mystring into cin.

c. ‘cin’ can’t be used this way.

d. None of above.

Answer: A

38. Regarding string stream identify the invalid statement is _________.

a. stringstream is defined in the header file <sstream>.

b. it allows string based objects treated as stream.

c. it is especially useful to convert strings to numerical values and vice

versa.

d. none of above.

Answer: D

39. Which of the header file must be included to use string stream?

a. <iostream>

b. <string>

c. <sstring>

d. <sstream>

Answer: D

40. Which of the following header file does not exist?

a. <iostream>

b. <string>

c. <sstring>

d. <sstream>

Answer: C

41. If you use same variable for two getline statements ___________.

a. both the inputs are stored in that variable.

b. the second input overwrites the first one.

c. the second input attempt fails since the variable already got its value.

d. you can not use same variable for two getline statements.

Answer: B

42. The “return 0;” statement in main function indicates ____________.

a. the program did nothing; completed 0 tasks.

b. the program worked as expected without any errors during its execution.

c. not to end the program yet.

d. none of above.

Answer: B

43. Which of the following is not a reserve keyword in C++?

a. Mutable.

b. Default.

c. Readable.

d. Volatile.

Answer: C

44. The size of _______________ variable is not 4 bytes in 32 bit systems.

a. int.

b. long int .

c. short int.

d. float.

Answer: C

45. Identify the correct statement regarding scope of variables.

a. Global variables are declared in a separate file and accessible from any

program.

b. Local variables are declared inside a function and accessible within the

function only.

c. Global variables are declared inside a function and accessible from

anywhere in program.

d. Local variables are declared in the main body of the program and accessible

only from functions.

Answer: B

46. Comments in C++ are started with____________.

a. //.

b. {.

c. #.

d. ::.

Answer: A

47. When does the code block following while(x<100) execute?

a. When x is less than one hundred.

b. When x is greater than one hundred.

c. When x is equal to one hundred.

d. While it wishes.

Answer: A

48. Which of the following is not a valid escape code?

a. \t.

b. \v.

c. \f.

d. \w.

Answer: D

49. Which of the following operator cannot be overloaded ?

a. ++.

b. - -.

c. -.

d. :: (scope resolution operator).

Answer: D

50. In an assignment statement

a=b;

Which of the following statement is true?

a. The variable a and the variable b are equal.

b. The value of b is assigned to variable a but the later changes on variable b will

not effect the value of variable a.

c. The value of b is assigned to variable a and the later changes on variable b will

effect the value of variable a.

d. The value of variable a is assigned to variable b and the value of variable b is

Assigned to variable a.

Answer: B

51. What is the correct value to return to the operating system upon the successful

completion of a program?

a. -1.

b. 1.

c. 0.

d. Programs do not return a value.

Answer: C

52. What is the only function all C++ programs must contain?

a. Start().

b. System().

c. Main().

d. Program().

Answer: C

53. What punctuation is used to signal the beginning and end of code blocks?

a. { }.

b. -> and <-.

c. BEGIN and END.

d. ( and ).

Answer: A

54. What punctuation ends most lines of C++ code?

a. . (dot).

b. ; (semi-colon).

c. : (colon).

d. ' (single quote).

Answer: B

55. Which of the following is a correct comment?

a. */ Comments */.

b. ** Comment **.

c. /* Comment */.

d. { Comment }.

Answer: C

56. Which of the following is not a correct variable type?

a. Float.

b. Real.

c. Int.

d. Double.

Answer: B

57. Which of the following is the correct operator to compare two variables?

a. :=.

b. =.

c. equal.

d. ==.

Answer: D

58. A/An _____________ local variable preserves its variable between function

calls.

a. extern

b. static

c. register

d. auto

Answer: B

59. Which of the following is the boolean operator for logical-and?

a. &.

b. &&.

c. |.

d. |&.

Answer: B

60. Identify the correct statement.

a. Programmer can use comments to include short explanations within the source

code itself

b. All lines beginning with two slash signs are considered comments.

c. Comments very important effect on the behaviour of the program.

d. Comments are keywords.

Answer: B

61. The directives for the preprocessors begin with ____________.

a. ampersand symbol (&).

b. two slashes (//).

c. number sign (#).

d. less than symbol (<).

Answer: C

62. The file iostream includes________________.

a. the declarations of the basic standard input-output library.

b. the streams of includes and outputs of program effect.

c. both of these.

d. none of these.

Answer: A

63. The data members of ___________ share the same memory.

a. union

b. structure

c. function

d. class

Answer: A

64. There is a unique function in C++ program by where all C++ programs start

their execution.

a. Start().

b. Begin().

c. Main().

d. Output().

Answer: C

65. Every function in C++ are followed by_______________.

a. parameters.

b. parenthesis.

c. curly braces.

d. none of these.

Answer: B

66. Which of the following is false?

a. Cout represents the standard output stream in c++.

b. Cout is declared in the iostream standard file.

c. Cout is declared within the std namespace.

d. none of above.

Answer: D

67. Every statement in C++ program should end with a ___________.

a. full stop (.).

b. comma (,).

c. semicolon (;).

d. colon (:).

Answer: C

68. Which of the following statement is true about preprocessor directives?

a. These are lines read and processed by the pre-processor.

b. They do not produce any code by themselves.

c. These must be written on their own line.

d. They end with a semicolon.

Answer: D

69. A block comment can be written by __________________.

a. starting every line with double slashes (//).

b. starting with /* and ending with */.

c. starting with //* and ending with *//.

d. starting with <!- and ending with -!>.

Answer: B

70. When writing comments you can _________________.

a. use code and /* comment on the same line.

b. use code and // comments on the same line.

c. use code and //* comments on the same line.

d. use code and <!- comments on the same line.

Answer: B

71. A variable is/are _________________.

a. string that varies during program execution.

b. a portion of memory to store a determined value.

c. those numbers that are frequently required in programs.

d. none of these.

Answer: B

72. Which of the following can not be used as identifiers?

a. Letters.

b. Digits.

c. Underscores.

d. Spaces.

Answer: D

73. Which of the following identifiers is invalid?

a. Papername.

b. Writername.

c. Typename.

d. Printname.

Answer: C

74. A ________ function is a function that has no body inside its base class.

a. inline

b. friend

c. constructor

d. pure virtual

Answer: D

75. 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.

Answer: A

76. Which of the following is not a valid escape code?

a. \t.

b. \v.

c. \f.

d. \w.

Answer: D

77. When a function returns a reference it ___________.

a. returns an implicit pointer to its return value.

b. displays that pointer.

c. returns the value referring to it.

d. does not return anything.

Answer: A

78. ____________is a relationship.

a. Polymorphism

b. Inheritance

c. Overloading

d. Overriding

Answer: B

79. Regarding following statement which of the statements is true?

const int pathwidth=100;

a. Declares a variable pathwidth with 100 as its initial value.

b. Declares a construction pathwidth with 100 as its initial value.

c. Declares a constant pathwidth whose value will be 100.

d. Constructs an integer type variable with pathwidth as identifier and 100 as

value.

Answer: C

80. The variables in an array are called its _____________.

a. data.

b. index.

c. elements.

d. subscripts.

Answer: C

81. The operands converted upto the type of largest operands is called _________.

a. integral promotion.

b. type promotion.

c. value promotion.

d. cast.

Answer: B

82. To increase the value of c by one, which of the following statement is wrong?

a. c++;

b. c = c + 1;

c. c + 1 => c;

d. c += 1;

Answer: C

83. When following piece of code is executed, what happens? b = 3; a = b++;

a. a contains 3 and b contains 4.

b. a contains 4 and b contains 4.

c. a contains 4 and b contains 3.

d. a contains 3 and b contains 3.

Answer: A

84. The result of a relational operation is always ________________.

a. either True or False.

b. is less than or is more than.

c. is equal or less or more.

d. all of these.

Answer: A

85. Which of the following is not a valid relational operator?

a. ==.

b. =>.

c. >=.

d. !=.

Answer: B

86. What is the final value of x when the code int x; for(x=0; x<10; x++) {} is run?

a. 10.

b. 9.

c. 0.

d. 1.

Answer: A

87. When does the code block following while(x<100) execute?

a. When x is less than one hundred.

b. When x is greater than one hundred.

c. When x is equal to one hundred.

d. While it wishes.

Answer: A

88. Which is not a loop structure?

a. For.

b. Do while.

c. While.

d. Repeat until.

Answer: D

89. How many times is a do while loop guaranteed to loop?

a. 0.

b. infinitely.

c. 1.

d. variable.

Answer: C

90. Each pass through a loop is called a/an_____________.

a. enumeration.

b. iteration.

c. culmination.

d. pass through.

Answer: B

91. Which looping process checks the test condition at the end of the loop?

a. for.

b. while.

c. do-while.

d. no looping process checks the test condition at the end.

Answer: C

92. A variable is given a value through _____________.

a. osmosis
b. the cout statement.
c. the <iomanip.h> header file.
d. an assignment statement.

Answer: D

93. In C++, the % refers to __________________.
a. percentages.
b. modulus operator.
c. division.
d. data storage.

Answer: B

94. Variables with names that describe the data stored at that particular
memory location are called _________________.

a. identifiers.
b. constant variables.
c. floating point variables.
d. mnemonic variables.

Answer: D

95. In C++, 14 % 4 = ___________.

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

Answer: B

96. Variables that are declared, but not initialized, contain ______________.

a. blank spaces.
b. zeros.
c. "garbage" values.
d. nothing - they are empty.

Answer: C

97. Array indexing always starts with the number__________________.

a. 0.
b. 1.
c. 2.
d. \0.

Answer: A

98. When a data type must contain decimal numbers, assign the type__________.

a. int.
b. char.
c. double.
d. long int.

Answer: C

99. When using a built-in function, you must ________________.
a. include the function's prototype.
b. include the proper header file.
c. include the function's definition.
d. specify the length of the library function.

Answer: B

100. The library function isalpha( ) requires the header file _____________.

a. <ctype.h>.
b. <math.h>.
c. <time.h>.
d. <stdlib.h>.

Answer: A



Leave a Reply

Subscribe to Posts | Subscribe to Comments

All Notes on BCA

All Notes  on BCA
BCA all subjects notes

Total Pageviews

Translate

Powered by Blogger.

Copyright © All Notes on BCA