Programming for Problem Solving (3110003) MCQs

MCQs of Array & String

Showing 1 to 10 out of 35 Questions
1.
Array index start at
(a) 1
(b) User Defined
(c) 0
(d) None of above
Answer:

Option (c)

2.
Every string is terminated by NULL character. How it is represented?
(a) ‘\0’
(b) NULL
(c) Both a & b
(d) none of above
Answer:

Option (a)

3.
Which of the following is used as a string termination character?
(a) 0
(b) \0
(c) /0
(d) None of these
Answer:

Option (b)

4.
The format specifier to accept a string is
(a) %c
(b) %d
(c) %f
(d) %s
Answer:

Option (d)

5.
Which header file is necessary for strlen() function?
(a) conio.h
(b) strings.h
(c) string.h
(d) stdio.h
Answer:

Option (c)

6.
What is an array in C language?
(a) A group of elements of same data type
(b) An array contains more than one element
(c) Array elements are stored in memory in continuous or contiguous locations
(d) All of these
Answer:

Option (d)

7.
How do you initialize an array in C?
(a) int arr[3] = (1,2,3);
(b) int arr(3) = {1,2,3};
(c) int arr[3] = {1,2,3};
(d) int arr(3) = (1,2,3);
Answer:

Option (c)

8.
Assuming int is of 4bytes, what is the size of int arr[15];?
(a) 30
(b) 15
(c) 4
(d) 60
Answer:

Option (d)

9.
The index of the first element in an array is __________
(a) 0
(b) -1
(c) 1
(d) 2
Answer:

Option (a)

10.
What is the output?

void main()
{
    int a[4]={5,6,7,8};
    printf("%d",a[1]);
}

(a) 5
(b) 6
(c) 8
(d) None of these
Answer:

Option (b)

Showing 1 to 10 out of 35 Questions