Assignment 18 Twodarray Ans
Assignment 18 Twodarray Ans
a. Yes
b. Yes, in Turbo Compiler only.
c. Yes, in Modern Compiler only.
d. No, it will be an Error
a. Yes
b. No
c. In Matrix Form
d. In Linked List Form
Answer - a. Yes
7. Predict the output
int arr[3][4];
arr[0] = 25;
a. 3 4 5
b. 2 4 4
c. 2 3 4
d. 2 4 5
Answer - b. 2 4 4
10. What is the output of the following program?
#include <stdio.h>
main()
{
int a[] = {1, 2, 3};
printf("% %d", a[0], 1[a]);
}
a. 1 2
b. 1 1
c. Error
d. 2 1
Answer - a. 1 2
a. 21 2 13
b. 2 21 13
c. 13 2 21
d. 2 13 21
Answer - d. 2 13 21
12. Find the output of the following program
#include <stdio.h>
main()
{
int x, y = 0, a[] = {11, 34, 21, 2, 13};
for(x = 0; x < 5; x++)
if(y < a[x])
y = a[x];
printf("%d", y);
}
a. 34
b. 43
c. 2
d. 21
Answer - a. 34
13. What will happen if in a C program you assign a value to an array element
whose subscript exceeds the size of the array?
Answer - d. The program may crash if some important data gets overwritten.
14. Find the output of the following program
#include <stdio.h>
main()
{
int x[4];
printf("%d %", sizeof(x), sizeof(x[0]));
}
a. 8 2
b. 2 2
c. 8 8
d. Error
Answer - a. 8 2
a. 2002
b. 2004
c. 2020
d. Lvalue required
Answer - b. 1 0 0 0 0
19. Is the following declaration of two-dimension array is correct?
int b[][3] = {12, 65, 78, 45, 33, 21};
a. Yes
b. No, Syntax Error
c. NO, Runtime Error
d. Compile, but the unpredictable output
Answer - a. Yes
a. Yes
b. No, Error
c. NO, Runtime Error
d. Compile, but the unpredictable output