Type Here to Get Search Results !

C Programming MCQ with Answers [ SET - 5 ] | Multiple Choice Questions on C Programming with Answers

 

Multiple Choice Questions on C Programming with Answers




1. Which of the following function gives the current position in the file

     putw()
    ftell()
    fseek()
ANSWER= (B) ftell()

 

2. A pointer to a pointer is a form of

     Multiple indirections
    A chain of pointers
    Both a and b
ANSWER= (C) Both a and b

 

3. The 'continue' statement is used to continue - 

    to the next statement of the current function 
     to the next statement of the calling function 
    to the begin of the current statement 
ANSWER= (D)  none of these.

 

4. Continue statement is used

    to go to the next iteration in a loop
     come out of a loop
    exit and return to the main function
ANSWER= (A) to go to the next iteration in a loop

 

5. The following program segment in C++

const int m =10;

int &n = m;

n=11;

count << m << n; will give result

    Compile time error
    run time error
    prints 1111
ANSWER= (A) Compile time error

 

6. What will be the output of the following program?

void main() 

{ char x = 'd' ; 

switch (x) 

{ case 'b' : puts ("01 001");

break; 

default: puts ("1 2 3"); 

break

case 'R' puts ("I II III" );

}

}

     123
    01 001
    I II III
ANSWER= (A) 123

 

7. The following statement in‘C’ language : int **a ;

    is illegal
    is legal but meaningless
    syntactically and semantically is correct
ANSWER= (C) syntactically and semantically is correct

 

8. What will be the output of the following statement ?

printf( 3 + “goodbye”);

    goodbye
    odbye
    bye
ANSWER= (D) dbye

 

9.What will be the output of the following statements ?

long int a = scanf(“%ld%ld”,&a,&a); printf(“%ld”,a);

    error
    garbage value


ANSWER= (B) garbage value

 

10. The escape sequence '\n' means

    new line, 
     variable tab,
    vertical tab,
ANSWER= (A) new line, 

 

11. Which header file is used for dynamic memory allocation in C

    math.h
    stdio.h
    conio.h
ANSWER= (D) stdlib.h

 

12.What is the output?: 

void main() {

int a 1, b=0; 

if (a, b) { 

printf("EXAM"); 

}

}

    exam is printed,
    EXAM is printed,
     compiler error, 
ANSWER= (D) nothing is printed.

 

13. The keyword used to transfer control from a function back to the calling function is -

     switch 
    goto
     go back
ANSWER= (D) return 

 

14. Write the output of the following program segment:

void main()

(int i=1, j=1; 

for (;;) {

if (i>5) break; else j+-i; printf("%d",j); i+=j;

    2 5
    32
    33
ANSWER= (A)  Output will be '2 5'

 

15. What is the valid range of numbers for int type of data?

    0 to 256
     -32768 to +32767
     -65536 to +65536
ANSWER= (B)  -32768 to +32767

 

16. Write down the output of the following program segment(s): 

void main() 

{

 int i; 

for (i=0;i<=10; i++); printf("%d", i); 

}

     display 1 to 10 


ANSWER= (C) 11

 

17. A C program is a combination of.?

    Statements
     Functions
    Variables

ANSWER= (D)  All of the above

 

18. If an integer needs two bytes of storage then maximum value of a signed interger is

    216 – 1
     215 – 1


ANSWER= (B) 215 – 1

 

19. An array cannot be initialized provided it is - 

    automatic 
    external 
    static
ANSWER= (D) both b & c

 

20. C language is used in the development of .?

    Databases
    Graphic applications
    Word Processors

ANSWER= (D) All of the above

 

21. printf (‘’% d’’, p r I n t f (‘’ tim’’) ) ;

     results in a syntax error
    outputs t i m3
    outputs garbage
ANSWER= (B) outputs t i m3

 

22. C language was invented to develop which Operating System.?

    Android
    Linux
    Ubuntu
ANSWER= (D) Unix

 

23. The number of possible value of m, such that m & 0x3f equals 0x23 is





ANSWER= (D) 4

 

24. The string terminator in C-language is - 

     '\b'
    '\&'
     '\c'
ANSWER= (D)  '\0'

 

25.  The statement p r I n t f ( ‘’% d’’, sizeof (‘’ ‘’)); prints

    an error message

    garbage

ANSWER= (A) 1

 

26. A pointer is

    address of a variable
     a variable for sorting address
    data type of an address variable
ANSWER= (B)  a variable for sorting address

 

27. Which of the following is allowed in a C Arithmetic instruction

    []
    {}
    ()
ANSWER= (C)  ()

 

28. The library function strcmp("abc","ABC"); returns -

    32 
    32 


ANSWER= (A) 32

 

29. A. int constant var =10;

     b. int
    onst var = 10;
     const int var = 10;
ANSWER= (D) b & c both

 

30. Which of the following is not a data type in c

    Primary data type
     Secondary data type
    Derived data type
ANSWER= (B) Secondary data type

 


  Friends if you like this post,kindly comment bellow and do share your responce.Thank You for Visiting.

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.

Below Post Ad