Showing posts with label C language. Show all posts
Showing posts with label C language. Show all posts

C Language MCQ - Online Programming Quiz

1) A self contained block of statements that perform a coherent task of some kind is called a?
  1. Monitor
  2. Function
  3. Program
  4. Structure
Show/Hide Answer
Answer = B 
2) Recursion is sometimes called ?
  1. Circular definition
  2. Complex definition
  3. Procedure
  4. Union
Show/Hide Answer
Answer =A
3) The directive that can be used to test whether an expression evaluates to a nonzero value or not is  ?
  1. #if
  2. #elif
  3. #endif
  4. #exit
Show/Hide Answer
Answer = A
4) The number of arguments supplied from the command line, by conversion is known as ?
  1. arg c
  2. arg v
  3. #define
  4. #include
Show/Hide Answer
Answer = A
5) The expression X=4+2%-8 evaluates ?
  1. -6
  2. 6
  3. 4
  4. None
Show/Hide Answer
Answer =B
6) Determine which of the following is valid character constant ?
  1. '//'
  2. '\0'
  3. 'xyz'
  4. '\052'
Show/Hide Answer
Answer = A
7) Given the statement , maruti.engine.bolts=25 . Which of the following is true?
  1. Structure bolts is nested within structure  engine
  2. Structure engine is nested within structure maruti
  3. Structure maruti is nested within structure engine
  4. Structure maruti nested within structure bolts
Show/Hide Answer
Answer =B
8) To access a structure element using a pointer, ......... operator is used?
  1. dot ( . )
  2. pointer ( & )
  3. pointer ( * )
  4. arrow ( -> )
Show/Hide Answer
Answer =D
9) The ........ operator is a technique to forcefully convert one data type to the other ?
  1. Cast
  2. Conversion
  3. Type
  4. Uniary
Show/Hide Answer
Answer = A
10) Which of the following numerical value is invalid constant ?
  1. assignment operator
  2. relational operator
  3. logical operator
  4. bitwise shift operator
Show/Hide Answer
Answer = D
read more...

Online C Programming Language Quiz

1) << Operator is used for  ?
  1. Right Shifting
  2. Left Shifting
  3. Bitwise Shifting
  4. Bitwise Complement
Show/Hide Answer
Answer = B
2) The value that follows the keyword CASE may only be ?
  1. Constant
  2. Variable
  3. Semicolon
  4. number
Show/Hide Answer
Answer = A
3) The machine registers are sometimes called ?
  1. Local Variables
  2. Global Variables
  3. Accumulators
  4. Static variable
Show/Hide Answer
Answer = A
4) An array of pointer is same as ?
  1. pointer to array
  2. pointer to pointer
  3. pointer to function
  4. pointer to structure
Show/Hide Answer
Answer =B
5) scanf( ) function can be used for reading ?
  1. double character
  2. single character
  3. multiple character
  4. no character
Show/Hide Answer
Answer = C
6) C allows three way transfer of control with the help of ?
  1. unary operator
  2. relational operator
  3. ternary operator
  4. comparison operator
Show/Hide Answer
Answer =C
7) The statement that transfer control to the beinning of the loop is called ?
  1. break statement
  2. exit statement
  3. continue statement
  4. goto statement
Show/Hide Answer
Answer = C
8) The number of arguments supplied from the command line, by convention, is known as ?
  1. arg c
  2. arg v
  3. #define
  4. #include
Show/Hide Answer
Answer = A
9) If an array is used as function argument, the array is passed ?
  1. by value.
  2. by reference
  3. by name
  4. the array can not be used as function argument
Show/Hide Answer
Answer = B
10) The function fprintf is used in a program ?
  1. When too many printf calls have been already used in the program.
  2. In place of printf, since printf uses more memory
  3. When the output is to be printed on to a file.
  4. When the type of variables to be printed are not known before.
Show/Hide Answer
Answer = C
read more...

C Programming Language Objective Type Questions With Answers

Multiple choice and objective type questions base on the switch control structure of C language.  

1) When we use the case control structure ?
  1. To choose one from multiple alternatives
  2. To switch from one instruction to another
  3. To make the execution fast
  4. None of above
Show/Hide Answer
Answer = A
2) The case keyword is followed by ?
  1. Float values
  2. Character values
  3. integer values
  4. Both b and c
Show/Hide Answer
Answer = D
3) What will be the output of following code ?
   #include<stdio.h>
   void main( )
   {
        char suite =3;
        switch(suite)
        {
               case 1: 
                        printf("ALL QUIZ");
               case 2:
                        printf("All quiz is great");
               default:
                        printf("All quiz contains MCQs");
         }
         printf("Are you like All quiz ?");
   }
     
  1. ALL QUIZ
  2. All quiz is great
  3. All quiz contains MCQs
  4. All quiz is great Are you like Al quiz ?
Show/Hide Answer
Answer = D 
Explanation: Because the condition within the switch does not match any case so the default block will be executed. After then the control will be transferred to out of the switch and print statement will be executed.
4) What will be the output of following code ?
       void main( )
       {
            int c=3;
            switch(c)
            {
                case '3':
                      printf("Hi");
                      break;
                case 3:
                      printf("Hello");
                      break;
                 default:
                      printf("How r u ?");
            }
       }
                
 
  1. Hi
  2. Hello
  3. How r u ?
  4. None of above
Show/Hide Answer
Answer =  B
5) What will be the output of following program ?
       void main( )
       {
          int 1=3;
          switch(i)
          {
               case 0:
                    printf("I am here");
               case 1+0:
                    printf("I m in second case");
               case 4/2:
                    printf("I m in third case");
               case 8%5:
                    printf("Good bye");
           }
        } 
  1. All case statements will be executed
  2. I am here
  3. Good bye
  4. I am in third case
Show/Hide Answer
Answer = C 
6) What will be the output of following ?
            void main( )
            {
                  int suite =1;
                  switch(suite);
                 {
                       case 0:
                             printf("Its morning time");
                       case 1: 
                             printf("Its evening time");
                 }
            } 
  1. Error
  2. Its morning time
  3. Its evening time
  4. None of above
Show/Hide Answer
Answer = A 
Explanation: The code will generate an error that the case is outside switch. It is because of the semicolon after the switch statement.
read more...

C Language Multiple Choice Questions - Control Structure

 Following are the multiple choice questions and answers on C language Control structure that includes decision, Looping and jumping control structure.

1) What will be the output of following program ?
        #include<stdio.h>
        int main( )
        {
             int a=300,b,c;
             if(a>=400)
                 b=300;
                 c=200;
                    printf("%d,%d\n",b,c);
             return 0;
        } 
  1. Garbage value, Garbage Value
  2. 300,200
  3. 200,300
  4. Garbage value,200
Show/Hide Answer
Answer = D 
Explanation: As the condition within the if statement is false so the value of b will not be initialized so it will print the garbage value and c is initialized to 200 so the output will be Garbage,200
2) What will be the output of following code ?
      #include<stdio.h>
      int main( )
      {
          int x=10,y=20;
          if(x = = y)
               printf("%d%d",x,y);
         return 0;
      } 
  1. Garbage values
  2. Raise an error
  3. Prints Nothing
  4. None of above
Show/Hide Answer
Answer = C 
Explanation:As the condition of if statement is not true, so the statement immediately after if that is print statement will not be executed and the code prints nothing.
3)  Give the output of following code ?
      #include<stdio.h>
      int main( )
     {
          int x=3;
          float y=3.0;
          if(x = = y)
                printf(" x and y are equal");
         else
                printf(" x and y are not equal");
     } 
  1. x and y are equal
  2. x and y are not equal
  3. x and y are same
  4. None of above
Show/Hide Answer
Answer = A
4) What will be the output of code ?
      #include<stdio.h>
      int main( )
      {
             int x=3,y,z;
             y=x=10;
             z=x<10;
             printf("x=%dy=%dz=%d\n",x,y,z);
             return 0;
       } 
  1. 10,10,10
  2. 10,10,0
  3. 0,0,0
  4. 0,10,10
Show/Hide Answer
Answer = B
5) What will be the output ?
         #include<stdio.h>
         int main( )
         {
              int k=35;
              printf("%d%d%d",k==35,k=50,k>40);
         } 
  1. 35,50,40
  2. 0,50,0
  3. 0,0,0
  4. 1,1,1
Show/Hide Answer
Answer =B
6) Which of the following statement is used to take the control to the beginning of the loop ?
  1. exit
  2. break
  3. continue
  4. None of these
Show/Hide Answer
Answer = C
7) A do - while loop is useful when we want that the statement within the loop must be executed ?
  1. only once
  2. at least once
  3. more than once
  4. None of above
Show/Hide Answer
Answer = B
8) What will the output of following program ?
    #include<stdio.h>
    void main( )
    {
         int i=0;
         for(;i;)
            printf("Allquiz");
    } 
  1. Prints Nothing
  2. Raise an error
  3. Garbage value
  4. Allquiz
Show/Hide Answer
Answer = A
9) What will be the output of following program ?
      #include<stdio.h>
      void main( )
      { 
           int i;
           for(i=1;i<=5;printf("%d",i));
               i++
       }
          
  1. Error
  2. Garbage values
  3. 1 to 5
  4. Infinite loop
Show/Hide Answer
Answer =D
10) What will be the output of following program ?
           #include<stdio.h>
           int main( )
           {
               int x=4;
               while(x==1)
               {
                    x=x-1;
                    printf("%d",x);
                    x--;
               }
            } 
  1. 4
  2. 1,2,3,4
  3. Prints Nothing
  4. None of above
Show/Hide Answer
Answer =C
read more...

C Language Multiple Choice Questions And Answers - Basic Concepts

Multiple choice questions and answers with explanation on C language. The questions are based on the basic concepts of C language like keywords, Expressions etc.

1) What will be the output of following program ?
      #include<stdio.h>
       int main( )
       {
             int i=2,j=3,k,l;
             float a,b;
             k = i/j * j;
             l =  j/i * j;
             a = i/j * j;
             b = j/i * i;
             printf("%d %d%f%f\n",k,l,a,b);
             return 0;
       } 
  1. 3, 0, 0, 0
  2. 0, 3, 0.000000, 2.000000
  3. 0,0,0,0
  4. Error
Show/Hide Answer
Answer = B
Explanation: As K and L are integer variables so it prints the integer value as result and a and b are float variable, so float value will be print as result.
2) What will be the output of following program ?
          #incllude<stdio.h>
          int main( )
          {
              int a,b;
              a = -3 - - 25;
              b = -3 - - (-3);
              printf("a=%d b=%d\n",a,b);
              return 0;
          }
  
  1. a = 22  b = -6
  2. a = -6  b = 22
  3. a =  3   b = 3
  4. No Output
Show/Hide Answer
Answer = A 
Explanation:No Explanation
3) What will be the output of following program ?
           #include<stdio.h>
           int main( )
           { 
                 float a=5,b=2;
                 int c,d;
                 c =a%d;
                 d =a/2;
                 printf("%d\n",d);
                 return 0;
           } 
  1. 3
  2. 2
  3. Error
  4. None of above
Show/Hide Answer
Answer = C 
Explanation: Program will give the error : Illegal use of floating point. The statement c = a%b will give the error.
4)  What will be the output of program ?
       #include<stdio.h>
       int main( )
       {
           printf("nn /n/n nn/n");
           return 0;
       } 
  1. Nothing
  2. nn /n/n nn
  3. nn /n/n
  4. Error
Show/Hide Answer
Answer = B 
Explanation: No Explanation
5)  What will be the output of program ?
         #include<stdio.h>
         int main( )
         {
                int a,b;
               printf("Enter two values of a and b");
               scanf("%d%d",&a,&b);
               printf("a=%d b=%d"a,b);
               return 0;
         }
  1. a = 0  b = 0
  2. a = 1  b = 1
  3. Values you entered
  4. None of above
Show/Hide Answer
Answer = C 
Explanation: No Explanation
6) A character variable can at a time store  ?
  1. 1 character
  2. 8 character
  3. 254 character
  4. None of above
Show/Hide Answer
Answer = A 
Explanation: No Explanation
7) The maximum value that an integer constant can have is ?
  1. -32767
  2. 32767
  3. 1.7014e + 38
  4. -1.7014e + 38
Show/Hide Answer
Answer = B 
Explanation: The range of an integer number is -32767 - 32767
8)  Which of the following is false in C ?
  1. Keywords cannot be used as variable names
  2. Variable names can contain a digit
  3. Variable names do not contain a blank space
  4. Capital letters can be used in variable names
Show/Hide Answer
Answer = A 
Explanation: Keywords can be used as variable names but by doing this it creates confusion
9) On which if the following operator can % operator NOT be used ?
  1. int variable
  2. float variable
  3. int constant
  4. All of above
Show/Hide Answer
Answer = B 
Explanation: No Explanation
10) A C variable cannot start with ?
  1. An alphabet
  2. A number
  3. A special symbol other that underscore
  4. Both B and C
Show/Hide Answer
Answer = D 
Explanation: No Explanation
read more...

Multiple Choice Questions On C Language - Set 2

Following are the multiple choice questions on C Language with answers. Following are the important questions for competitive exams point of view. Appropriate explanations are also given with the answers.

1) Which of the following is not true in context of C language ?
  1. It is array of characters
  2. Last character of character array is always \0
  3. C inserts the null character automatically
  4. Any string in C can be read by the function getchar()
Show/Hide Answer
Answer =  B and C
Explanation: No Explanation 
2)  Which of the following operations can not be perform on pointers in C ?
  1. Addition of two pointers
  2. Subtraction of a number from a pointer
  3. Subtraction of one pointer from another
  4. Addition of a number to a pointer
Show/Hide Answer
Answer = A
Explanation: No Explanation
3) What will be the output of following program ?
             main( )
            {
                   static char a[]="BOMBAY"
                   char *b="BOMBAY";
                   printf("\n%d%d",size of(a),size of (b));
            } 
  1. a=7, b=7
  2. a=7, b=2
  3. a=2, b=7
  4. a=7, b=0
Show/Hide Answer
Answer = C
Explanation: No Explanation
4) What is the output of  C statement 7.5 % 3 ?
  1. 1.5
  2. 1
  3. No output
  4. Error
Show/Hide Answer
Answer = D
Explanation: No Explanation 
5) Any program in C has access to three standard files?
  1. standard input file, standard output file, standard error file
  2. stdin, stdout, stderr
  3. keywords, screen, stderr
  4. All of above
  5. None of above
Show/Hide Answer
Answer = B
Explanation: No Explanation 
6) An identifier in C  ?
  1. is a name of thing such as variable and function
  2. is made up of letters, numerals and the underscore
  3. can contain both uppercase and lowercase letters
  4. All of above
  5. None of above
Show/Hide Answer
Answer = D
Explanation:No  Explanation 
7) The single character input/output functions are  ?
  1. scanf( ) and printf( )
  2. getchar( ) and printf( )
  3. scanf( ) and putchar( )
  4. getchar( ) and putchar( )
  5. None of above
Show/Hide Answer
Answer = D
Explanation: No Explanation 
8) Precedence determines which operator ?

  1. is evaluated first
  2. is most important
  3. is fastest 
  4. Operates on the largest number
  5. None of above
Show/Hide Answer
Answer = A
Explanation: No Explanation 
9) In C, the NULL statement which does nothing is just ?
  1. a.,
  2. ;
  3. :
  4. .
Show/Hide Answer
Answer = B
Explanation:No Explanation 
10) The two operators && and || are ?
  1. arithmetic operators
  2. equality operators
  3. logical operators
  4. relational operators
  5. None of above
Show/Hide Answer
Answer = D 
Explanation: No Explanation 

Tags : C Language multiple choice questions with answers, C Language MCQs, Objective type questions on C Language with answers, Objective type questions on C Language, Quiz questions on C Language, Operating system MCQ, Multiple choice questions On C Language, UGC-NET test preperation, Computer subjects quiz
read more...

Multiple Choice Questions In C With Answers

1) The Conditional Compilation  ?
  1. It is taken care of by the compiler
  2. It is setting the compiler options conditionally
  3. It is compiling a program based on condition
  4. None of Above
Show/Hide Answer
Answer = C 

2) Originally C was developed as ?
  1. System Programming Language
  2. General Purpose Language
  3. Data Processing Language
  4. None of Above
Show/Hide Answer
Answer = A
3) Minimum number of temporary variable needed to swap the contents of 2 variable is ?
  1. 1
  2. 2
  3. 3
  4. 0
Show/Hide Answer
Answer =D

4)*ptr++ is equivalent to ?
  1. ptr++
  2. *ptr
  3. ++*ptr
  4. None of Above
Show/Hide Answer
Answer =  D
5) Expression C=i++ Causes ?

  1. Value of i is assigned to C and then I is incremented by 1
  2. i to be incremented by 1, and then value of i assigned to C
  3. Value of i assigned to C
  4. i to be incremented by 1
Show/Hide Answer
Answer = A

6) Declaration int *(*p) int(*a)(i) is ?
  1. A pointer to function that accepts an integer argument and returns an integer
  2. A pointer to a, which returns an integer
  3. A pointer to subroutine, which returns result of evaluation
  4. None of Above
Show/Hide Answer
Answer = A
7) Null pointer and UN-initialized pointers are same ?
  1. True
  2. False
  3. Varies from program to program
  4. None of Above
Show/Hide Answer
Answer = B
8) In which header file Null macro is defined ?
  1. stdio.h and stddeth
  2. Iostream.h
  3. string.h
  4. preprocessor
Show/Hide Answer
Answer = A 
9) Null pointer is ?
  1. A pointer which does not point anywhere
  2. Pointer defined with name Null
  3. A pointer that returns 0 values
  4. None of Above
Show/Hide Answer
Answer = A
10) Null macro is ?
  1. A macro with name Null
  2. A macro which represents Null pointer
  3. A macro defined with no name
  4. None of Above
Show/Hide Answer
Answer = B
read more...