C Language | 10 Minute‐Test 17


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.

goto can be used to jump from main to within a function

A.
True
B.
False
C.
Depends
D.
Varies

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

None.

2.

The following code 'for(;;)' represents an infinite loop. It can be terminated by.

A.
break
B.
exit(0)
C.
abort()
D.
All of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

None.

3.

Which keyword is used to come out of a loop only for that iteration?

A.
break
B.
continue
C.
return
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

None.

4.

What is the output of this C code?

    #include <stdio.h>

    register int x;

    void main()

    {

        printf("%d", x);

    }

 

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

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

None.

5.

Which data type is most suitable for storing a number 65000 in a 32-bit system?

A.
signed short
B.
unsigned short
C.
long
D.
int

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

65000 comes in the range of short (16-bit) which occupies the least memory. Signed short ranges from -32768 to 32767 and hence we should use unsigned short.

6.

Comment on the following? const int *ptr;

A.
You cannot change the value pointed by ptr
B.
You cannot change the pointer ptr itself
C.
Both (a) and (b)
D.
You can change the pointer as well as the value pointed by it

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

None.

7.

What is the output of this C code?

    #include  <stdio.h>

    int main()

    {

       signed char chr;

       chr = 128;

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

       return 0;

    }

 

A.
128
B.
-128
C.
Depends on the compiler
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

signed char will be a negative number.

8.

Which of the following cannot be a variable name in C?

A.
volatile
B.
true
C.
friend
D.
export

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

volatile is C keyword.

9.

What is the output of this C code?

    #include <stdio.h>

    void main()

    {

        int i = 0;

        do

        {

            printf("Hello");

        } while (i != 0);

    }

 

A.
Nothing
B.
H is printed infinite times
C.
Hello
D.
Run time error

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

    {

        double b = 3 && 5 & 4 % 3;

        printf("%lf", b);

    }

 

A.
3.000000
B.
4.000000
C.
5.000000
D.
1.000000
Submit your test now to view the Results and Statistics with answer explanation.