Showing posts with label Basic Concepts. Show all posts
Showing posts with label Basic Concepts. Show all posts

C Language Multiple Choice Questions And Answers - Basic Concepts

Tuesday, 18 September 2012

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

Tuesday, 5 June 2012

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

Thursday, 3 May 2012

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>>