C Programming MCQ Questions and Answers

0
32

C Programming MCQ Questions and Answers downlaod c mcq gk question for all exams

  1. Which one of the following is not a valid variable name declaration?
    1. int _a3;
    2. int a_3;
    3. int 3_a;
    4. int _3a;

go here Ans. C (int 3_a;)   

 

  1. If integer needs 2 bytes of storage, then maximum value of an unsigned integer is?
    1. 211
    2. 216 – 1
    3. 215 – 1
    4. 216

   source Ans.  D (216-1)

 

  1. Which is the only function in all C programs must contain?
    1. Printf( )
    2. start ( )
    3. main ( )
    4. System ( )

get link Ans. C (main( ))

 

  1. enter site An array elements are always stored in———–memory locations.
    1. Random
    2. Sequential
    3. Sequential and Random
    4. None of these

Ans. B (Sequential)

 

  1. source link If the two strings are identical, then  get link strcmp ()function returns
    1. 0
    2. True
    3. 1
    4. None of these

Ans. A (0)

 

  1. Which one of the following function is more appropriate for reading in a multi-word string?
    1. scanf( )
    2. Printf( )
    3. puts( )
    4. gets( )

           Ans. D (gets( ))

 

  1. What keyword is used to transfer control from a function back to the calling function is
    1. switch
    2. return
    3. goto
    4. goback

Ans. B (return)

 

  1. What are the types of linkages?
    1. Internal
    2. External and Internal
    3. External, Internal and None
    4. External and None

Ans. C (External, Internal and None)

 

  1. How can you round off a value from 1.66 to 2.0?
    1. Ceil (1.66)
    2. Roundup (1.66)
    3. Roundto (1.66)
    4. Floor (1.66)

               Ans. A (ceil (1.66)

 

  1. A real number is treated by default as a ________?
    1. Double
    2. Float
    3. Long double
    4. Far double

                 Ans. A (double)

 

  1. The following statement is a declaration or definition?
    extern int i;

    1. Definition
    2. Function
    3. Declaration
    4. Error

       Ans. C (Declaration)

 

  1. In which header file is the NULL macro defined?
    1. stddef.h
    2. math.h
    3. stdio.h
    4. stdio.h and stddef.h

Ans. D (Stdio.h and stddef.h)

 

  1. Which operator is used to get value at address stored in a pointer variable is?
    1. &&
    2. ||
    3. *
    4. &

Ans. C ( * )

 

  1. How can you print \n on the screen?
    1. Echo”\\n”;
    2. Printf(“\\n”);
    3. Printf(‘\n’);
    4. Printf(‘\n’);

Ans. B (printf(“\n”)

 

  1. Which header file will be included to use functions like malloc()and calloc()?
    1. dos.h
    2. string.h
    3. stdlibh
    4. memory.h

                Ans. C (stdlib.h)

 

  1. What function will be used to free the memory allocated by calloc()?
    1. free( );
    2. dealloc( );
    3. malloc( )
    4. memalloc(variable_name, 0)

                                   Ans. A (free( ); )

 

  1. Which keyword will be used for coming out of recursion?
    1. Break;
    2. Exit;
    3. Return;
    4. None of these

Ans. C (return;)

 

  1. What is the invalid identifier from the below?
    1. __0__
    2. volatile
    3. DOUBLE
    4. Int

     Ans. B (volatile)

 

  1. What is the built in function to compare 2 strings?
    1. strcmp( )
    2. string_cmp( )
    3. equals( )
    4. str_compare( )

Ans. A (strcmp( ))

 

  1. Which one of the following is an invalid assignment operator?
    1. a /= 10;
    2. a %= 10;
    3. a |= 10;
    4. None of these

                                 Ans. D (None of these)

Previous Post
Next Post

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.