Q#1: What is the output of the following statement?
int i = 2.5; do { cout << i * 2; } while (i > 3 && i < 10);
(A) 510
(B) 5
(C) 48
(D) error
Answer: (B) 5
Q#2: Searching is easier when an array is already sorted.
(A) True
(B) False
Answer: (A) True
Q#3: If an array has 100 elements, what is allowable range of subscripts?
(A) 0 – 99
(B) 1 – 99
(C) 0 – 100
(D) 1 – 100
Answer: (A) 0 – 99
Q#4: What is the correct syntax to initialize all elements of two-dimensional array to value 0?
(A) int arr[2][3] = {0,0};
(B) int arr[2][3] = {{0},{0}};
(C) int arr[2][3] = {0},{0};
(D) int arr[2][3] = {0};
Answer: (D) int arr[2][3] = {0};
Q#5: Which of the following function returns the size of a string variable?
(A) strlength()
(B) stringlen()
(C) strlen()
(D) strLength()
Answer: (C) strlen()
Q#6: Computer can understand only machine language code.
(A) True
(B) False
Answer: (A) True
Q#7: What does 5 ^ 6 evaluate to in decimal?
(A) 1
(B) 2
(C) 3
(D) 4
Answer: (C) 3
Q#8: Which header file includes string conversion functions?
(A) string.h
(B) stdlib.h
(C) ctype.h
(D) sconvert.h
Answer: (B) stdlib.h
Q#9: What does the statement const int *ptr = &x; mean?
(A) ptr is a constant pointer
(B) ptr points to constant integer data
(C) x is constant
(D) ptr cannot store address
Answer: (B) ptr points to constant integer data
Q#10: The function of cin is:
(A) To display message
(B) To read data from keyboard
(C) To display output on screen
(D) To send data to printer
Answer: (B) To read data from keyboard
Q#11: In C/C++ the header file used for manipulation of character data is:
(A) cplext.h
(B) ctype.h
(C) stdio.h
(D) delay.h
Answer: (B) ctype.h
Q#12: Each pass through a loop is called:
(A) Enumeration
(B) Iteration
(C) Culmination
(D) Pass through
Answer: (B) Iteration
Q#13: What is the correct syntax to declare an array of size 10 of int type?
(A) int [10] name;
(B) name[10] int;
(C) int name[10];
(D) array int[10];
Answer: (C) int name[10];
Q#14: Which operator is used to access the value pointed by a pointer?
(A) *
(B) ->
(C) &&
(D) &
Answer: (A) *
Q#15: Analysis is the ______ step in designing a program.
(A) Last
(B) Middle
(C) Post design
(D) First
Answer: (D) First
Q#16: Paying attention to detail in designing a program is:
(A) Time consuming
(B) Redundant
(C) Necessary
(D) Somewhat good
Answer: (C) Necessary
Q#17: Which tool is helpful in tracing logical errors?
(A) Compiler
(B) Debugger
(C) Linker
(D) Loader
Answer: (B) Debugger
Q#18: The while loop becomes infinite when:
(A) Condition is always false
(B) Condition is less than zero
(C) Condition is always true
(D) Condition contains logical operator
Answer: (C) Condition is always true
Q#19: If we want to store string “abc”, the array size must be at least:
(A) 2
(B) 3
(C) 4
(D) 5
Answer: (C) 4
Q#20: Word processor is:
(A) Operating system
(B) Application software
(C) Device driver
(D) Utility software
Answer: (B) Application software
Q#21: Which is correct way to initialize integer variable x with value 10?
(A) int x; x = 10;
(B) int x = 10;
(C) int x, x = 10;
(D) x = 10;
Answer: (B) int x = 10;
Q#22: If there is more than one statement in a for loop block, we use:
(A) Parentheses ( )
(B) Braces { }
(C) Brackets [ ]
(D) Arrows < >
Answer: (B) Braces { }
Q#23: Name of an array is a constant pointer.
(A) True
(B) False
Answer: (A) True
Q#24: Loader loads executable code from hard disk to main memory.
(A) True
(B) False
Answer: (A) True
Q#25: Which data type is commonly used for bit manipulation?
(A) Signed integer
(B) Unsigned integer
(C) Signed double
(D) Unsigned double
Answer: (B) Unsigned integer
Q#26: Which values represent true and false in C++?
(A) 1 and 0
(B) 1 and -1
(C) 11 and 00
(D) Any numeric value
Answer: (A) 1 and 0
Q#27: A precise sequence of steps to solve a problem is called:
(A) Statement
(B) Program
(C) Utility
(D) Algorithm
Answer: (D) Algorithm
Q#28: Compiler of C language is written in:
(A) Java
(B) UNIX
(C) FORTRAN
(D) C language
Answer: (D) C language
Q#29: In if structure the block executes when:
(A) Condition is false
(B) Arithmetic operator exists
(C) Logical operator exists
(D) Condition is true
Answer: (D) Condition is true
Q#30: Which looping process is best when number of iterations is known?
(A) for
(B) while
(C) do-while
(D) all loops
Answer: (A) for