C Language | 10 Minute‐Test 16


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.

The name of the variable used in one function cannot be used in another function

A.
True
B.
False
C.
May be
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

Since the scope of the variable declared within a function is restricted only within that function, the same name can be used to declare another variable in another function.

2.

What is the output of this C code?

    #include <stdio.h>

    int main()

    {

        int ary[2][3];

        ary[][] = {{1, 2, 3}, {4, 5, 6}};

        printf("%d\n", ary[1][0]);

    }

 

A.
Compile time error
B.
4
C.
1
D.
2

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

None.

3.

When do you need to use type-conversions?

A.
The value to be stored is beyond the max limit
B.
The value to be stored is in a form not supported by that data type
C.
To reduce the memory in use, relevant to the value
D.
All of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

None.

4.

What is the output of this C code?

    #include <stdio.h>

    void main()

    {

        register int x;

        printf("%d", x);

    }

 

A.
0
B.
Junk value
C.
Compile time error
D.
Noting

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

None.

5.

The variable declaration with no storage class specified is by default:

A.
auto
B.
extern
C.
static
D.
register

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

None.

6.

What is the output of this C code?

    #include <stdio.h>

    int main()

    {

        int *ptr, a = 10;

        ptr = &a;

        *ptr += 1;

        printf("%d,%d/n", *ptr, a);

    }

 

A.
10,10
B.
10,11
C.
11,10
D.
11,11

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

None.

7.

Which of the following cannot be static in C?

A.
Variables
B.
Functions
C.
Structures
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

None.

8.

Comment on the output of this C code?

    #include <stdio.h>

    int main()

    {

        int ThisIsVariableName = 12;

        int ThisIsVariablename = 14;

        printf("%d", ThisIsVariablename);

        return 0;

    }

 

A.
The program will print 12
B.
The program will print 14
C.
The program will have a runtime error
D.
The program will cause a compile-time error due to redeclaration

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

Variable names ThisIsVariablename and ThisIsVariableName are both distinct as C is case sensitive.

9.

What is the output of this C code?

    #include <stdio.h>

    void main()

    {

        int i = 0;

        while (++i)

        {

            printf("H");

        }

    }

 

A.
H
B.
H is printed infinite times
C.
Compile time error
D.
Varies

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()

    {

        double b = 5 % 3 & 4 + 5 * 6;

        printf("%lf", b);

    }

 

A.
2
B.
30
C.
2.000000
D.
Run time error
Submit your test now to view the Results and Statistics with answer explanation.