C Arrays Questions 3

Hello PrepSter,

If you find any errors in the quiz below kindly comment in the comment section and we will make it our priority to fix it.

Also if you have a better of the solution to the questions, please do comment them below and if we find it better than ours, we will post it in our website.

Question 1

Time: 00:00:00
For the following declaration

int *p[10], arr[10][10];

Which of these statements will not give run time error?

I A[2] II A[2][3] III B[1] IV B[2][3]

Only II and IV

Only II and IV

Only II III and IV

Only II III and IV

Only IV

Only IV

Only I II and IV

Only I II and IV

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 2

Time: 00:00:00
What will be printed by the following C code?

#include<stdio.h> int main() { int i; int a[5] = {0}; for (i = 0; i <= 5; i++) printf("%d ", a[i]); return 0; }

(null)

(null)

Program crashes and shows compilation error.

Program crashes and shows compilation error.

0 0 0 0 0 and some garbage value.

0 0 0 0 0 and some garbage value.

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 3

Time: 00:00:00
Which is the following printf command if addted to the code following will print 17 ?

#include<stdio.h> int main() { int arr[20][25][30] = {0}; arr[4][8][7] = 17; return 0; }

printf("%d",***( ( (arr+4)+8)+7) );

printf("%d",***( ( (arr+4)+8)+7) );

printf("%d",*( ( (arr+4)+8)+7) );

printf("%d",*( ( (arr+4)+8)+7) );

printf("%d",*( *( *(arr+4)+8)+7) );

printf("%d",*( *( *(arr+4)+8)+7) );

printf("%d",( ( (arr+4)+8)+7) );

printf("%d",( ( (arr+4)+8)+7) );

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 4

Time: 00:00:00
What will be the output of the following C code ?
#include <stdio.h>
int main()
{
char p;
char arr[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
p = (arr + 1)[7];
printf("%d", p);
return 0;
}

Compilation error.

Compilation error.

8

8

9

9

7

7

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 5

Time: 00:00:00
What is meaning of the following declaration ?

int (*p)[10];

p is a pointer to 10 integers.

p is a pointer to 10 integers.

p is a pointer to an array with 10 integer.

p is a pointer to an array with 10 integer.

Compile error. int *p[10] is valid.

Compile error. int *p[10] is valid.

p is an array of 10 pointers to integers.

p is an array of 10 pointers to integers.

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

["0","40","60","80","100"]
["Need more practice!","Keep trying!","Not bad!","Good work!","Perfect!"]