Type Here to Get Search Results !

C Programming MCQ with Answers [ SET - 2 ] | TOP C Language Multiple Choice Questions and Answers

 

TOP C Language Multiple Choice Questions and Answers

1. In C++, a function contained within a class is called

    a method
    a class function
    member function
ANSWER= (C) member function

 

2. What is result of 16 >> 2? - 





ANSWER= (A) 4

 

3. Every string must be terminated by

     Linefeed character
    Null character
    Newline character
ANSWER= (B) Null character

 

4. What will be the value of c after execution of this program? 

void main()

   {int a 9, b = 10, c;

    c= (b <a || b > a); 

     printf("c-%d", c);

       }

     c = 1 
     c = 0
    c = 1
ANSWER= (A)  c = 1 

 

5. Recursive functions are executed in a?

    first in first out order
    load balancing
    parallel fashion
ANSWER= (D) last in first out order

 

6. What will be the output of the following arithmetic expression ?

5+3*2%10-8*6

    -37
    -42
    -32
ANSWER= (A) -37

 

7. getch(); works like 

    printf
    scanf
    variable
ANSWER= (A) none of these


 

8.  Which one of the following is not a linear data structure?

    array
    binary tree
    queue
ANSWER= (B) binary tree

 

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

int a=10; printf(“%d &i”,a,10);

    error
    10
    10 10
ANSWER= (D) none of these

 

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

printf(“%X%x%ci%x”,11,10,’s’,12);

    error
    basc
    Bas94c
ANSWER= (B) basc

 

11. The _________ is a computer program that translates the source code into corresponding object code

    Compiler
    Assembler
     COBOL
ANSWER= (A) Compiler

 

12. Which is the reserved keyword in C? -

    null,
    union, 
    printf,
ANSWER= (B) union, 

 

13. A. Halt execution of program

     b. restart execution
    f program
    exit from loop or switch statement
ANSWER= (C) exit from loop or switch statement

 

14. Which one is a special function in C system to tell the computer where the program start

     go()
    sub()
    main()
ANSWER= (c) main()

 

15. If a 15 and b = 4, what is the value of a%b? 

    -3, 
    3, 4

ANSWER= (B) 3, 4

 

16. Which of the following function is used for sets the position to the beginning of the file

    putw()
    getw()
    setw()
ANSWER= (d) rewind()

 

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

int a = 4, b = 7,c; c = a = = b; printf(“%i”,c);


    error

ANSWER= (A) 0

 

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

int a = 5, b = 2, c = 10, i = a>b

void main()

{ printf(“hello”); main(); }



    infinite number of times
ANSWER= (C) infinite number of times

 

19. Which of the following shows the correct hierarchy of arithmetic operations in C ?

     (), *, * or /, + or - 
     (), **, *, /, +, - 
    (), *, /, *, +, -
ANSWER= (C) (), *, /, *, +, -

 

20. Which is the correct way to declare a pointer?

    int_ptr;
    int *ptr;
    *int ptr;
ANSWER= (B) int *ptr;

 

21. The string is actually stored as an array of ……. the null character …… is automatically placed at the end of a string to act as a string ……..

    Constants, \n, terminator
    Characters, \0, terminator
    Character, \t, initialize
ANSWER= (B) Characters, \0, terminator

 

22. Which function converts a string of digits into its numeric equivalent

    atan()
     atoi()
     calloc()
ANSWER= (b) atoi()

 

23. The expression x = 4+2% -8 evaluates to -

    -6,
    6,
    4,
ANSWER= (B) 6

 

24. ______ is an example of compile time polymorphism

    Virtual function
    Member function
    Function overloading
ANSWER= (c) Function overloading

 

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

int x[4] = {1,2,3}; printf(“%d %d %D”,x[3],x[2],x[1]);

    03%D



ANSWER= (C) 032

 

26. The library function exit() causes an exit from 

     the loop in which it appears,
    the block in which it appears,
    the function in which it appears,
ANSWER= (D) none of these.

 

27.  In C++ array subscript always starts with




ANSWER= (A) 0

 

28. What is the output of the following code?

#include

void main()

{

int s=0;

while(s++<10)>

# define a 10

main()

{

printf(“%d..”,a);

foo();

printf(“%d”,a);

}

void foo()

{

#undef a

#define a 50

}

    10..10
    10..50
     Error

ANSWER= (C)  Error

 

29. char a = 321; printf("%c", a), then the output will be





ANSWER= (D) A

 

30. What will be output if you will compile and execute the following c code?

void main(){

int i=0;

if(i==0){

i=((5,(i=3)),i=1);

printf(“%d”,i);

}

else

printf(“equal”);

}




ANSWER= (C) 1

 



  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.

Top Post Ad

Below Post Ad