CP Module 3 MCQ
CP Module 3 MCQ
Which keyword is used to make the array size optional in C language during array
declaration?
a) auto
b) static
c) extern
d) register
2. 3. Which of the following is the correct syntax to send an array as a parameter to a C
function?
a) Both func(&array) and func(*array);
b) Both func(#array) and func(&array);
c) Both func(array) and func(&array);
d) Both func(array[size]) and func(*array);
3. 4. What are the different ways to initialize an array with all elements as zero?
a) int array[5] = {};
b) int array[5] = {0};
c) int a = 0, b = 0, c = 0;
int array[5] = {a, b, c};
d) All of the mentioned
4. What are the elements present in the array of the following C code ?
int array[5] = {5};
a) 5, 5, 5, 5, 5
b) 5, 0, 0, 0, 0
c) 5, (garbage), (garbage), (garbage), (garbage)
d) (garbage), (garbage), (garbage), (garbage), 5
5. Which of the following declaration is illegal?
a) int a = 0, b = 1, c = 2
int array[3] = {a, b, c};
b) int size = 3;
int array[size];
c) int size = 3;
int array[size] = {1, 2, 3};
d) All of the mentioned
6. An array of similar data types which themselves are a collection of dissimilar data
type are ___________
a) Linked Lists
b) Trees
c) Array of Structure
d) All of the mentioned
7. Comment on an array of the void data type.
a) It can store any data-type
b) It only stores element of similar data type to first element
c) It acquires the data type with the highest precision in it
d) You cannot have an array of void data type
8. An array in C cannot be initialized by which of the following statement?
a) char a[] = “Hello”;
b) char a[6] = {};
c) char a[6] = {0};
d) char a[6]; a = "Hello";
9. Choose correct statement about Functions in C Language.
a) A Function is a group of c statements which can be reused any number of time
b) Every Function has a return type
c) Every Function may no may not return a value
d) All the above
10. A function which calls itself is called a ___ function.
a) Self Function
b) Auto Function
c) Recursive Function
d) Static Function
a) Library Functions
b) User Defined Functions
c) Both Library and User Defined
d) None of the above
12. The keyword used to transfer control from a function back to the calling function is
int **a;
a) switch
b) goto
c) go back
d) return
a) Pass By Value copies the variable value in one more memory location
b) Pass By Value does not use Pointers
c) Pass By Value protects your source or original variables from changes in outside
functions or called functions
d) All the above
a) 16
b) 31
c) 32
d) No Limit