C Language | 10 Minute Test


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.

What is the output of this C code?

   #include <stdio.h>

    void main()

    {

        double k = 0;

        for (k = 0.0; k < 3.0; k++);

            printf("%lf", k);

    }

 

A.
2.000000
B.
3.000000
C.
4.000000
D.
Run time error

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

None.

2.

What is the output of this C code?

  #include <stdio.h>

    int main()

    {

        int *p = NULL;

        for (foo(); p; p = 0)

            printf("In for loop\n");

            printf("After loop\n");

    }

 

A.
In for loop after loop
B.
Infinite loop
C.
In for loop after loop
D.
Depends on the value of NULL

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

None.

3.

Where in C the order of precedence of operators do not exist?

A.
Within conditional statements, if, else
B.
Within while, do-while
C.
Within macro definition
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

None.

4.

Which of the following operators has the lowest precedence?

A.
!=
B.
&&
C.
?:
D.
,

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

None.

5.

What is the output of this C code?

  #include <stdio.h>

    int main()

    {

        int i = 5;

        i = i / 3;

        printf("%d\n", i);

        return 0;

    }

A.
Implementation defined
B.
1
C.
3
D.
Compile time error

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

None.

6.

What is the output of this C code?

  #include <stdio.h>

    int x = 5;

    void main()

    {

        int x = 3;

        m();

        printf("%d", x);

    }

    void m()

    {

        x = 8;

        n();

    }

    void n()

    {

        printf("%d", x);

    }

 

A.
8 3
B.
3 8
C.
8 5
D.
5 3

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

    {

        unsigned int x = -5;

        printf("%d", x);

    }

 

A.
Run time error
B.
Aries
C.
-5
D.
5

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

None.

8.

Which function definition will run correctly?

A.
int sum(int a, int b) return (a + b);
B.
int sum(int a, int b) {return (a + b);}
C.
int sum(a, b) return (a + b);
D.
Both (a) and (b)

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

None.

9.

What is the output of this C code?

  #include <stdio.h>

    #define MIN 0

    #ifdef(MIN)

    #define MAX 10

    #endif

    int main()

    {

        printf("%d %d\n", MAX, MIN);

        return 0;

    }

 

A.
10 0
B.
Compile time error
C.
Both b and c
D.
Preprocessor error

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

None.

10.

What is the output of this C code?

  #include <stdio.h>

    void m();

    void n()

    {

        m();

    }

    void main()

    {

        void m()

        {

            printf("hi");

        }

    }

 

A.
hi
B.
Compile time error
C.
Nothing
D.
Varies

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

None.


Feedback:

Submit your test now to view the Results and Statistics with answer explanation.