C Language | 10 Minute‐Test 11


Instruction

  • Total number of questions : 10.
  • Time alloted : 10 minutes.
  • Each question carry 1 mark.
  • No Negative marks
  • DO NOT refresh the page.
  • All the best :-).

1.

Which keyword is used to prevent any changes in the variable within a C program?

A.
immutable
B.
mutable
C.
const
D.
volatile

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

const is a keyword constant in C program.

2.

Applications of multidimensional array are?

A.
Matrix-Multiplication
B.
Minimum Spanning Tree
C.
Finding connectivity between nodes
D.
All of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

None.

3.

What is the output of the below code considering size of short int is 2, char is 1 and int is 4 bytes?

    #include <stdio.h>

    int main()

    {

        short int i = 20;

        char c = 97;

        printf("%d, %d, %d\n", sizeof(i), sizeof(c), sizeof(c + i));

        return 0;

    }

 

A.
2, 1, 2
B.
2, 1, 1
C.
2, 1, 4
D.
2, 2, 8

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

None.

4.

Which data type can be stored in register?

A.
int
B.
long
C.
float
D.
All of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

None.

5.

Automatic variables

A.
Exist only within that scope in which it is declared
B.
Cease to exist after the block is exited
C.
Both a & b
D.
Only 1

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

None.

6.

What is the output of this C code?

    #include <stdio.h>

    int main()

    {

        int i = 10;

        void *p = &i;

        printf("%d\n", (int)*p);

        return 0;

    }

 

A.
Compile time error
B.
Segmentation fault/runtime crash
C.
10
D.
Undefined behaviour

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

None.

7.

What is the output of this C code?

    #include <stdio.h>

    void main()

    {

        static int x;

        printf("x is %d", x);

    }

 

A.
1
B.
0
C.
Junk value
D.
Run time error

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

None.

8.

What is the output of this C code?

    #include <stdio.h>

    int main()

    {

        int y = 10000;

        int y = 34;

        printf("Hello World! %d\n", y);

        return 0;

    }

 

A.
Compile time error
B.
Hello World! 34
C.
Hello World! 1000
D.
Hello World! followed by a junk value

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

Since y is already defined, redefining it results in an error.

9.

What is the output of this C code?

    #include <stdio.h>

    int main()

    {

        do

            printf("In while loop ");

        while (0);

            printf("After loop\n");

    }

 

A.
In while loop
B.
In while loop after loop
C.
After loop
D.
Infinite loop

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

None.

10.

What is the output of this C code?

    #include <stdio.h>

    void main()

    {

        int a = 5 * 3 + 2 - 4;

        printf("%d", a);

    }

 

A.
13
B.
14
C.
12
D.
1 6
Submit your test now to view the Results and Statistics with answer explanation.