C Language | 10 Minute‐Test 15


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 is false ?

A.
A variable defined once can be defined again with different scope
B.
A single variable cannot be defined with two different types in the same scope
C.
A variable must be declared and defined at the same time
D.
A variable refers to a location in memory

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

It is not an error if the variable is declared and not defined. For example – extern declarations.

2.

What is the output of this C code?

    #include <stdio.h>

    int main()

    {

        int ary[2][3][4], j = 20;

        ary[0][0] = &j;

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

    }

 

A.
Compile time error
B.
20
C.
Address of j
D.
Undefined behaviour

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

None.

3.

Which of the following typecasting is accepted by C?

A.
Widening conversions
B.
Narrowing conversions
C.
Both
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

None.

4.

Register variables reside in

    #include <stdio.h>

    void main()

    {

        register int x = 0;

        if (x < 2)

        {

            x++;

            main();

        }

    }

 

A.
Segmentation fault
B.
main is called twice
C.
main is called once
D.
main is called thrice

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

None.

5.

Which of the following storage class supports char data type?

A.
register
B.
static
C.
auto
D.
All of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

None.

6.

Comment on the following pointer declaration? int *ptr, p;

A.
ptr is a pointer to integer, p is not
B.
ptr and p, both are pointers to integer
C.
ptr is a pointer to integer, p may or may not be
D.
ptr and p both are not pointers to integer

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

None.

7.

Which of following is not accepted in C?

A.
static a = 10; //static as
B.
static int func (int); //parameter as static
C.
static static int a; //a static variable prefixed with static
D.
All of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

None.

8.

What is the problem in following variable declaration? float 3Bedroom-Hall-Kitchen?;

A.
The variable name begins with an integer
B.
The special character ‘-‘
C.
The special character ‘?’
D.
All of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

A variable name cannot start with an integer, along with that the C compiler interprets the ‘-‘ and ‘?’ as a minus operator and a question mark operator respectively.

9.

What is the output of this C code?

    #include <stdio.h>

    void main()

    {

        int i = 2;

        do

        {

            printf("Hi");

        } while (i < 2)

    }

 

A.
Compile time error
B.
Hi Hi
C.
Hi
D.
Varies

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

None.

10.

What is the output of this C code?

    #include <stdio.h>

    void main()

    {

        double b = 3 % 0 * 1 - 4 / 2;

        printf("%lf", b);

    }

 

A.
-2
B.
Floating point Exception
C.
1
D.
None of the mentioned
Submit your test now to view the Results and Statistics with answer explanation.