C Language | 10 Minute‐Test 10


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 of the following declaration is illegal?

A.
char *str = "Best C programming classes by pooripadhai";
B.
char str[] = "Best C programming classes by pooripadhai";
C.
char str[20] = "Best C programming classes by pooripadhai";
D.
char[] str = "Best C programming classes by pooripadhai";

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

char[] str is a declaration in Java, not in C.

2.

What is the correct syntax to send a 3-dimensional array as a parameter?
(Assuming declaration int a[5][4][3];)

A.
func(a);
B.
func(&a);
C.
func(*a);
D.
func(**a);

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

None.

3.

function tolower(c) defined in library works for

A.
Ascii character set
B.
Unicode character set
C.
Ascii and utf-8 but not EBSIDIC character set
D.
Any character set

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

None.

4.

When compiler accepts the request to use the variable as a register?

A.
It is stored in CPU
B.
It is stored in cache memory
C.
It is stored in main memory
D.
It is stored in secondary memory

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

None.

5.

Automatic variables are variables that are

A.
Declared within the scope of a block, usually a function
B.
Declared outside all functions
C.
Declared with auto keyword
D.
Declared within the keyword extern

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

    {

        char *p = NULL;

        char *q = 0;

        if (p)

            printf(" p ");

        else

            printf("nullp");

        if (q)

            printf("q\n");

        else

            printf(" nullq\n");

    }

 

A.
Depends on the compiler
B.
nullp nullq
C.
x nullq where x can be p or nullp depending on the value of NULL
D.
p q

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

None.

7.

What is the output of this C code?

    #include <stdio.h>

    void main()

    {

        m();

        m();

    }

    void m()

    {

        static int x = 5;

        x++;

        printf("%d", x);

    }

 

A.
6 7
B.
6 6
C.
5 5
D.
5 6

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

None.

8.

What is the output of this C code?

    #include <stdio.h>

    int main()

    {

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

        return 0;

    }

 

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

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

It results in an error since x is used without declaring the variable x.

9.

What is the output of this C code?

    #include <stdio.h>

    int main()

    {

        while ()

            printf("In while loop ");

        printf("After loop\n");

    }

 

A.
In while loop after loop
B.
After loop
C.
Compile time error
D.
Infinite loop

Your Answer: Option (Not Answered)

Correct Answer: Option C

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.
16
Submit your test now to view the Results and Statistics with answer explanation.