QUIZ ON : C LANGUAGE - ARRAYS

ARRAYS

00:00:00

The value of S[5] in the segment char s[15] = “ MICROPROCESSOR” is

Option A. P
Option B. O
Option C. R
Option D. None of the above
True Answer A

Explanation :

The value of S[5] in the segment char s[15] = “ MICROPROCESSOR” is

Question No# : 01 out of 20

Consider the statement given below:

int a[5] = {1, 2, 3, 4, 5}, *p = a;
Which printf statement will print the value of fourth element of the array?

Option A. printf("%d ", *(p + 3));
Option B. printf("%d", p[4]);
Option C. printf("%d ", a + 3);
Option D. printf("%d ", *a + 3);
True Answer A

Explanation :

Consider the statement given below:

int a[5] = {1, 2, 3, 4, 5}, *p = a;
Which printf statement will print the value of fourth element of the array?

Question No# : 02 out of 20



The best average SORTING behavior is shown by merge sort.

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer A

Explanation :

The best average SORTING behavior is shown by merge sort.

Question No# : 03 out of 20

What is the effect of the following code?

main() { int a[4] = {25, 16};
printf(“%d %d”, a[0] & a[1], a[1]|a[2]) ; }

Option A. 16 16
Option B. Syntax error because of invalid operator symbol
Option C. 25 16
Option D. Syntax error because of invalid array initialization
True Answer A

Explanation :

What is the effect of the following code?

main() { int a[4] = {25, 16};
printf(“%d %d”, a[0] & a[1], a[1]|a[2]) ; }

Question No# : 04 out of 20



An array is also known as

Option A. Subscripted variable
Option B. Collective array
Option C. Ordinary variable
Option D. Similar Quantities variable
True Answer A

Explanation :

An array is also known as

Question No# : 05 out of 20



If array is initialized where it is declared, then mentioning __________ of array is optional.

Option A. Data type
Option B. Dimension
Option C. name
Option D. Data type and Dimension
True Answer B

Explanation :

If array is initialized where it is declared, then mentioning __________ of array is optional.

Question No# : 06 out of 20



What will happen if an element is assigned a value to an element of an array whose subscript exceeds the size of the array

Option A. It will not be allowed, but no error message will be generated
Option B. Compiler will generate an error message suggesting the same
Option C. The element will be assigned NULL VALUE.
Option D. Some other data may be overwritten
True Answer A

Explanation :

What will happen if an element is assigned a value to an element of an array whose subscript exceeds the size of the array

Question No# : 07 out of 20

The function strlen() computes the length of an argument string excluding the null character.

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer A

Explanation :

The function strlen() computes the length of an argument string excluding the null character.

Question No# : 08 out of 20

When we declare an array

Option A. Compiler declare array name itself as a constant pointer to base address
Option B. A continuous file is allocated to store the elements value
Option C. Index of elements is declared automatically
Option D. All elements are initialized to zero
True Answer A

Explanation :

When we declare an array

Question No# : 09 out of 20

At the time of initialization of an array, dimension of the array need not to be specified.

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer B

Explanation :

At the time of initialization of an array, dimension of the array need not to be specified.

Question No# : 10 out of 20

Which of the following function is more appropriate for reading in a multi-word string?

Option A. printf();
Option B. scanf();
Option C. gets();
Option D. puts();
True Answer C

Explanation :
Which of the following function is more appropriate for reading in a multi-word string? A. printf(); B. scanf(); C. gets(); D. puts(); Answer: Option C Explanation: gets(); collects a string of characters terminated by a new line from the standard input stream stdin

Which of the following function is more appropriate for reading in a multi-word string?

Question No# : 11 out of 20



If the first string and the second string both are identical, then strcmp function returns

Option A. a value of 0
Option B. either 1 or 0
Option C. a value of 1
Option D. any positive integer
True Answer A

Explanation :

If the first string and the second string both are identical, then strcmp function returns

Question No# : 12 out of 20

The best case and worst case time for searching an element using linear search is 1, n.

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer A

Explanation :

The best case and worst case time for searching an element using linear search is 1, n.

Question No# : 13 out of 20

Set of values of the same type, which have a single name followed by an index is called

Option A. function
Option B. structure
Option C. array
Option D. union
True Answer C

Explanation :

Set of values of the same type, which have a single name followed by an index is called

Question No# : 14 out of 20

Bounds of the array index are checked during execution.

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer A

Explanation :

Bounds of the array index are checked during execution.

Question No# : 15 out of 20

What will be the output of the following code segment if Hello there is given as input?

char a[20];
scanf("%s", a);
printf("%s", a);

Option A. Hello there
Option B. Hello
Option C. "Hello there"
Option D. "Hello"
True Answer B

Explanation :

What will be the output of the following code segment if Hello there is given as input?

char a[20];
scanf("%s", a);
printf("%s", a);

Question No# : 16 out of 20



Which of the following function can be used to find the first occurrence of a given string in another string?

Option A. strchr( )
Option B. strrchr( )
Option C. strstr( )
Option D. strnset( )
True Answer C

Explanation :
strstr is a C standard library string function as defined in string.h. strstr() has the function signature char * strstr(const char *haystack, const char *needle); which returns a pointer to a character at the first index where needle is in haystack, or NULL if not present.

Which of the following function can be used to find the first occurrence of a given string in another string?

Question No# : 17 out of 20

The index of an array starts from 1.

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer B

Explanation :
False: Array index always start with 0

The index of an array starts from 1.

Question No# : 18 out of 20

If the two strings are found to be unequal then strcmp returns difference between the first non-matching pair of characters.

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer A

Explanation :

If the two strings are found to be unequal then strcmp returns difference between the first non-matching pair of characters.

Question No# : 19 out of 20

Till the array elements are not given any specific value, they are supposed to contain all

Option A. Zero
Option B. Garbage value
Option C. One
Option D. Combination of zero and one
True Answer B

Explanation :

Till the array elements are not given any specific value, they are supposed to contain all

Question No# : 20 out of 20




CCC Online Test 2021 CCC Practice Test Hindi Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Website development Company in Allahabad