Basic

Switch Case

Goto

Operators

if Statement

Nested if

While Loop

For Loop

Array

Patterns

Excersises


C Programming MCQ (Mulitple Choice Questions and Answers)


  1. Who is invented c language?

    1. Charles babbage

    2. Dennis Ritchie

    3. James gosling

    4. Guido van

  2. Which language is being replaced by C Language?

    1. Fortran

    2. D language

    3. Python

    4. B language

  3. C is Which type of programming language.?

    1. Structure

    2. Functional

    3. Positional

    4. Procedural

  4. In which laboratories was C language invented?

    1. AT&T Bell Labs

    2. Uniliver Labs

    3. IBM Labs

    4. Verizon Labs

  5. What is the name of the BCPL language?

    1. C Language

    2. D Language

    3. B Language

    4. None

  6. What Operating System was developed using the C language?

    1. Android

    2. Unix

    3. Operating

    4. Microsoft

  7. In which year C programming is developed?

    1. 1968

    2. 1970

    3. 1972

    4. 1984

  8. Which one is used to tell  the preprocessor to insert the contents of another file into the Source Code?

    1. #include

    2. stdio

    3. void main()

    4. clrscr()

  9. In C, the program execution starts from?

    1. printf()

    2. scanf()

    3. main()

    4. getch()

  10. Which  function is used to print the formatted string in output Screen.

    1. printf()

    2. scanf()

    3. main()

    4. getch()

  11. Which  function is accepting input from the user?

    1. printf()

    2. scanf()

    3. main()

    4. getch()

  12. Which level is C language belonging to?

    1. Middle level

    2. Low level

    3. High level

    4. Machine level

  13. Which of the following symbol is used to denote a preprocessor statement

    1. #

    2. ;

    3. ()

    4. {}

  14. What symbol is used to End of the statement?

    1. #

    2. ;

    3. ()

    4. {}

  15. Which character is used to the new line in c?

    1. \a

    2. \b

    3. \n

    4. \L

  16. What constants need to be enclosed between single quotes?

    1. string

    2. float

    3. Integer

    4. character

  17. What constants need to be enclosed between Double quotes?

    1. string

    2. float

    3. Integer

    4. character

  18. What is the limit of short int in C?

    1. -32762 to 32761

    2. -32743 to 32742

    3. -32796 to  32795

    4.  -32768 to 32767

  19.  Which of the following is not a valid C variable name?

    1. int a;

    2. float b;

    3. int -c;

    4. float _d;

  20. Identify a character constant.

    1.  'A'

    2. "B"

    3. "\n"

    4. None of the Above

  21. Which of the following is an arithmetic operator?

    1. +

    2. <=

    3. >=

    4. !=

  22. Relational operator have highest precedence than bitwise operator

    1. TRUE

    2. FALSE

  23. Which of these operators has the lowest precedence?

    1.  ++

    2.  --

    3. <-

    4. !=

  24. sizeof() is a _______ type of operator

    1. secondary

    2. binary

    3. unary

    4. ternary

  25. Relational operator will always return value in form of ________

    1. 1 or 2

    2. 0 or 1

    3. True 

    4. FALSE

  26. Which operator is not right to left associative ?

    1. &

    2.  ++

    3. >

    4. <

  27. The post increment operator will change the value after variable has been used

    1. TRUE

    2. FALSE

  28. Which operator is used for modulus division in c ?

    1. /

    2. *

    3. %

    4. +

  29. Which operator is used for equality comparision of c ?

    1. =

    2. ==

    3. !=

    4. None

  30. Which among the following highest precedence ?

    1. sizeof()

    2. &

    3. <<

    4. !

  31. Which data type can accept switch statement

    1. int

    2. char

    3. shot

    4. All of the above

  32. Can we use logical operators in switch statement?

    1. Yes

    2. No

  33. How many arguments are passed to the switch statement ?

    1. 1

    2. 2

    3. Infinity

    4. All of the above

  34. The character value is used in the switch in C?

    1. True

    2. False

  35. A switch block can be labeled with one or more cases.

    1. False

    2. True

  36. Which identifier is used to define a label in goto statement 

    1. ;

    2. :

    3. ,

    4. =

  37. Can we use goto in while loop in C?

    1. Yes

    2. No

  38. Can we use goto statement to create loops?

    1. No

    2. Yes

  39. Which of the following statement about for GOTO is true?

    1. goto statement is a jump statement.

    2. goto statement is used for altering the normal sequence.

    3. The goto statement transfers control to a label.

    4. All of the above

  40. what will be the output of the following code?

    #include <stdio.h>
    void main()
    {
      printf("W");
      goto A;
      printf("o");
      goto B;
      printf("r");
      A:
      printf("l");
      B:
      printf("d");
    }

     

    1. wold

    2. wrld

    3. wld

    4. wrd

  41. Choose a C Conditional Operator 

    1. ?:

    2. :?

    3. :<

    4. <:

  42. Which of the following control structure is implemented using if statement ?

    1. Sequential

    2. Function Call

    3. Repetition

    4. Selection

  43. All keywords in C are in ____________

    1. Upper Case

    2. Camel Case

    3. Lower Case

    4. All of these

  44. In C, all keywords are case sensitive

    1. True

    2. False

  45. A condition in an IF statement is always written in  ____.

    1. []

    2. {} 

    3. <>

    4. ()

  46. We can write an if statement without brackets?

    1. FALSE

    2. TRUE

  47. The conditional operator are also known as

    1. Ternary operator

    2. Relational operator

    3. Increment operator

    4. Logical operator

  48. Which operator is used to check multiple conditions are true in C?

    1. NOT

    2. OR

    3. AND

    4. NONE

  49. what will be the output of the following code?

    void main()
    {
      if(printf("Hello")){
        printf(" World");
      }else{
        printf(" Welcome");
      }
    }

    1. Hello
    2. Hello World
    3. Hello Welcome
    4. Welcome
  50. what will be the output of the following code?
    #include<stdio.h>
    void main()
    {
      char ch='A';
      if(ch == 65){
        printf(" Hi");
      }else{
        printf(" Hello");
      }
    }

    1. Hi Hello
    2. Hello
    3. Error
    4. Hi
  51. How many times does the loop run in the following code? 

    for(i=0;i<5;i+=2)

    1. 4

    2. 3

    3. 2

    4. 5

  52. The continue statement cannot be used in ________ ?

    1. do-while

    2. for

    3. while

    4. switch

  53. What is the way to quit loop in c language ?

    1. if

    2. break

    3. switch

    4. do

  54. Which loop is most suitable to first perform the operation and then test the condition?

    1. for loop

    2. do-while loop

    3. while loop

    4. None of these

  55. Which loop are executed at least once, even if the test condition is false

    1. do-while

    2. while

    3. for

    4. if

  56. What are the Loops  are used in C language ?

    1. for

    2. while

    3. do-while

    4. All the above

  57. Infinite loop can be created using ?

    1. do{}while

    2. while()

    3. for(;;)

    4. All the these

  58. Goto statement is also known as unconditional ?

    1. TRUE

    2. FALSE

  59. Which keyword  can be used for coming out of recursion?

    1. Break

    2. Check

    3. Return

    4. Both A and B

  60. what will be the output of following C code ?

    #include <stdio.h>
    void main()
    {
        int i = 15;
        do
        {
            printf("Hello world");
        } while (i != 15);
    }

    1. Nothing

    2. Infinite times

    3. Hello World

    4. Run time error

  61. What is the highest index for an  array with 10 elements ?

    1. 6

    2. 7

    3. 8

    4. 9

  62. An array is defined as finite ordered collection of ______ data.

    1. Stored

    2. Inbuild

    3. Homogenous

    4. Collection

  63. What is the term for accessing elements of an array using an index ?

    1. Indexing

    2. Pointer

    3. Enemeration

    4. Collection

  64. How many types of array in c program ?

    1. Five

    2. Two

    3. Four

    4. Three

  65. Which  dimensional array is  represents a linear collection of data ?

    1. Single

    2. Multi

    3. Two

    4. Nothing

  66. Two dimensional array represent a ________.

    1. Square

    2. Column

    3. Row

    4. Matrix

  67. An array can be declared of any _________ data type.

    1. Standard

    2. Custom 

    3. Both A and B

    4. None

  68. The declaration int arr[4][5]; will allocate _____ bytes.

    1. 40

    2. 50

    3. 80

    4. 20

  69. Index of an array starts from

    1. 1

    2. 0

    3. -1

    4. 2

  70. What are the elements present in the array of the following code?

    int arr[3] = {3};

    1. 0,0,0

    2. 3,0,0

    3. 3,3,3

    4. 0,0,3

  71. Which of the following function is more appropriate for reading in a multi-word string?

    1. gets()

    2. scanf()

    3. printf()

    4. main()

  72. Length of the string "Hello World" is

    1. 12

    2. 11

    3. 15

    4. 8

  73. Strcat function adds null character

    1. Only if there is space

    2. Depends on the standard

    3. Depends on the compiler

    4. Always

  74. Which keyword is used to declare a character array in c ?

    1. str

    2. string

    3. char

    4. int

  75. which function is used to compare two strings ?

    1. strcat

    2. strfind

    3. strcmp

    4. strchk

  76. which function is used to find length of a string ?

    1. strlen

    2. strsize

    3. strlength

    4. lenstr

  77. A character constant is enclosed by ?

    1. Double quotes

    2. Single quotes

    3. Square brackets

    4. None of the above

  78. What will be the value of var for the following code?

    int c = strcmp("Hello", "hello");

    1. -1

    2. 1

    3. 0

    4. 2

  79. Terminate a string with 

    1. Space

    2. Null

    3. Semicolon

    4. Colon

  80. Which funtion used to compare strings without case-insensitive?

    1. strcasecmp()

    2. strcmp()

    3. strtof()

    4. strtod()

  81. Which keyword is used to return value from function?

    1. return

    2. int

    3. float

    4. All of these

  82. Which data structure is used to handle recursion in C?

    1. Tree

    2. Queue

    3. Stack

    4. None of the above

  83. A function that calls itself is called a

    1. Member Function

    2. Recursive Function

    3. Static Function

    4. Primary Function

  84. what is the purpose of the 'return' statement in a function?

    1. Terminate a Program

    2. Define a Function

    3. Declare a Function

    4. Return a value from Function

  85. Which of the following string functions has return integer value?

    1. strlen()

    2. strlwr()

    3. strcat()

    4. strrev()

  86. How many values can be returned by a C function?

    1. 2

    2. 1

    3. Infinity

    4. All of these

  87. Find out the Non library function below in C ?

    1. sqrt()

    2. random()

    3. printf()

    4. gets()

  88. How do you declare a pointer variable that can store the address of an int?

    1. int &p;

    2. int *p;

    3. int p;

    4. int p*;

  89. Pointers can be used to

    1. call by name

    2. call by function

    3. call by reference

    4. call by itself

  90. What will be the output of the following C code?

    int a = 20;
    int *p = &a;
    *p = 10; printf("%d",a);

    1. 20

    2. 10

    3. Throw an error

    4. Address of 'a'

  91. How do you declare an array of pointers to int?

    1. int *p;

    2. int* p[];

    3. int &p[];

    4. int p*[];

  92. A structure is 

    1. Derived data type

    2. User defined datatype

    3. Secondary data type

    4. All of the above

  93. Which keyword is used to define a structure?

    1. structure

    2. struct

    3. stru

    4. All of the above

  94. Which operator is used to access members of a structure.

    1. And Operator (&)

    2. Dot Operator (.)

    3. Asterisk Operator (*)

    4. Left Shift Operator (<)

  95. Which of the following function is used to open a file in C?

    1. fclose()

    2. fseek()

    3. fprint()

    4. fopen()

  96. Which function is used to close an opened file in C?

    1. close_file()

    2. file_close()

    3. fclose()

    4. fileclose()

  97. What is the value of EOF in C?

    1. Null

    2. 0

    3. -1

    4. 1

  98. Which function is used to delete a file in C?

    1. unlink()

    2. destroy()

    3. delete()

    4. remove()

  99. The members of the union can be accessed using the arrow operator (->)

    1. True

    2. False

  100. Size of union is size of the longest element in the union

    1. True

    2. False