Q#1: Return type of a function that does not return any value must be:
(A) char
(B) int
(C) void
(D) double
Answer: (C) void
Q#2: A function’s prototype is written ___ the function call.
(A) After
(B) Before
(C) With
(D) At the end of
Answer: (B) Before
Q#3: What will be the size of the following character array? char name[] = “Adeel”;
(A) 5
(B) 6
(C) 4
(D) 7
Answer: (B) 6
Q#4: In switch statement there can be ___ default statements.
(A) 1
(B) 2
(C) 3
(D) 4
Answer: (A) 1
Q#5: ___ will be used for enclosing function statements into a block.
(A) ” “
(B) ()
(C) []
(D) {}
Answer: (D) {}
Q#6: Which one is the correct syntax of an array initialization? Array size is 10 and it is of double data type to value 0.
(A) arr[10] = {0.0};
(B) double arr[10] = 0.0;
(C) double arr[10] = {0.0};
(D) double arr[] = 0.0;
Answer: (C) double arr[10] = {0.0};
Q#7: Which function call is call by value for the function prototype float add(int);
(A) add(&x);
(B) add(x);
(C) add(int x);
(D) add(*x);
Answer: (B) add(x);
Q#8: A function is a block of statements that can be defined once and used ___ in the program.
(A) One time
(B) 2 times
(C) Three times
(D) As many times as user wants
Answer: (D) As many times as user wants
Q#9: What will be the size of following array? int arr[29];
(A) 30
(B) 29
(C) 18
(D) 0
Answer: (B) 29
Q#10: Which of the following function call is “call by reference” for the function prototype int add(int *);
(A) add(&x);
(B) add(int x);
(C) add(x);
(D) add(*x);
Answer: (A) add(&x);
Q#11: The string in the array is terminated by:
(A) 0
(B) nil
(C) null
(D) * on
Answer: (C) null
Q#12: ___ statement is used to terminate the processing of a particular case and exit from switch structure.
(A) if
(B) goto
(C) break
(D) continue
Answer: (C) break
Q#13: ___ will be used for enclosing function statements into a block.
(A) “”
(B) ()
(C) []
(D) {}
Answer: (D) {}
Q#14: Default mechanism of calling a function by passing it array is call by ___ and in case of passing variable is call by ___
(A) Reference, Reference
(B) Reference, Value
(C) Value, Reference
(D) Value, Value
Answer: (B) Reference, Value
(A) apple
(B) apple any fruit
(C) apple banana mango
(D) apple banana mango any fruit
Answer: (D) apple banana mango any fruit
Q#16: Null character is represented by ___ in C++.
(A) /0
(B) \0
(C) \n
(D) \t
Answer: (B) \0
Q#17: The string in the array is terminated by:
(A) zero
(B) nil
(C) null
(D) one
Answer: (C) null
Q#18: We can define a matrix as ___ array.
(A) Sorted
(B) Unsorted
(C) Single dimensional
(D) Multi dimensional
Answer: (D) Multi dimensional
Q#19: ___ character is used to indicate the end of the string.
(A) string
(B) New line
(C) Blank space
(D) Null
Answer: (D) Null
Q#20: In call by reference, ___ of a variable is passed to the called function.
(A) Name
(B) Data type
(C) Value
(D) Address
Answer: (D) Address
Q#21: A function’s prototype is written ___ the function call.
(A) After
(B) Before
(C) With
(D) At the end of
Answer: (B) Before
Q#22: Characters of a string stored in an array can be accessed directly using array ___
(A) Manipulation
(B) Superscript
(C) Postscript
(D) Subscript
Answer: (D) Subscript
Q#23: Null character is used to indicate the ___ of string.
(A) start
(B) end
(C) begin
(D) middle
Answer: (B) end
Q#24: If an array has 50 elements, what is allowable range of subscripts?
(A) 0 – 49
(B) 1 – 49
(C) 0 – 50
(D) 1 – 50
Answer: (A) 0 – 49
Q#25: Return type of a function that does not return any value must be:
(A) char
(B) int
(C) void
(D) *
Answer: (C) void