Header Ads Widget

Ticker

6/recent/ticker-posts

MCQ BASED ON C PROGRAMING LANGAUGE

 COMPUTER GAYN

PROGRAMMING FOR PROBLEM SOLVING

  Q1.  Execution of C program always starts with …


a.

include


b.

printf function


c.

main function


d.

scanf function


ANS:- C



Q2.Which of following is not a keyword in C?


a.

break


b.

static


c.

continue


d.

function


ANS:- d


Q3.Which of the following are derived data types in C?

1. int

2. array

3. pointer

4. float


a.

1,3,4


b.

2, 3


c.

1, 4


d.

2,4


Q4.What is the output of the below program?

#include <stdio.h>

int main()

{

    int i = 0;

    switch (i)

    {

        case '0': printf("Geeks");

                break;

        case '1': printf("Quiz");

                break;

        default: printf("GeeksQuiz");

    }

    return 0;

}


a.

GeeksQuiz


b.

Quiz


c.

Compile-time error


d.

Geeks


ANS:-a


Q5.Which of the following are not loop statements in C?  Select one:

a.

Switch


b.

While


c.

for

d.

do.. while


ANS:-a


Q6.Which of the following statement is correct for switch controlling expression?


a.

“switch” control expression can be empty as well


b.

Both int and char can be used in “switch” control expression


c.

Only int can be used in “switch” control expression


d.

All types i.e. int, char and float can be used in “switch” control expression


ANS:-b

Q7.Which of the following are unary operators in C?

1.

++

2.

<<

3.

- -

4.

&&


a.

1, 2


b.

1, 3


c.

1,2,3


d.

2,4


ANS:-b

Q8.What will this program print?

  1. main()  
  2. {  
  3.   int i = 2;  
  4.   {  
  5.     int i = 4, j = 5;  
  6.      printf("%d %d", i, j);  
  7.   }    
  8.   printf("%d %d", i, j);  
  9. }  

a.

2525

b.

4525

c.

4545

d.

None of the these


ANS:-b


Q9.What is the output of this statement "printf("%d", (a++))"?

a.

Error message

b.

The current value of a

c.

Garbage

d.

The value of (a + 1)


ANS:-b








































































































Post a Comment

0 Comments