Mostly Asked 25 C Programming Apti MCQ Questions

In this article, I will share some frequently asked C programming aptitude questions.
 

1. Which header file  do you need  to include to use  typecasting?

  • <stdin.h>
  • <ctype.h>
  • <math.h>
  • none of these


2. # include is called____________

  • Preprocessor Directive
  • Inclusion Directive
  • File inclusion directive
  • none of these


3A local  variable  is store in_______

  • code segment
  • stack  segment
  • heap segment
  • none of these


4. An exception is ________

  • Runtime Error
  • Compile Error
  • Logical Error
  • None of the above




5Which of the  following is valid expression for assigning the value to the variable?

  • a==b
  • a:=b
  • a=b
  • none of the above


6Which of the following is not a reserve keyword for c?

  • auto
  • case
  • main
  • Register


7Which of the following is not correct variable type

  • float
  • real
  • double
  • int


8. Every function  in c is followed by

  • parenthesis
  • square brackets
  • curly braces
  • All of the above


9. In command  line argument the parameter argc passed to main is of______ datatype

  • float
  • int
  • string
  • double


10. What will be the following code's output if choice = 'R'?

switch(choice)
{
   case 'R' : printf("RED");
   case 'W' : printf("WHITE");
   case 'B' : printf("BLUE");
   default  : printf("ERROR");break;
}


  • RED
  • RED WHITE BLUE ERROR
  • RED ERROR  
  • ERROR


11What is the correct value to return to the operating system on the successful  completion of key program?
  • -1
  • 1
  • 0
  • It does not return any value




12. An array of similar data types which themselves are a collection of dissimilar data types are___

  • Linked lists
  • Trees
  • Array of structure
  • All of the above


13. What will happen after compiling and running following code?

main()
{
     printf("%p", main);
}

  • Error
  • Will make an infinite loop
  • Some address will be printed.
  • None of these.


14. What will be the output if you will compile and execute the following C code?

#include<stdio.h>
int main()
{
int a=5;
float b;
printf(“%d”,sizeof(++a+b));
printf(“%d”,a);
return 0;
}

  • 26
  • 46
  • 25
  • 45


15How many times do while loop guaranteed to loop?

  • 0
  • infinity
  • 1
  • variable


16int a[5] = {1,2,3}
What is the value of a[4]?

  • 3
  • 1
  • 2
  • 0


17. Which of the following operator can be used to access value at address store in a pointer variable...

  • *
  • #
  • &&
  • @


18Which  conversion  is  not possible...

  • int to float
  • float to int
  • char to float
  • All of the above is possible


19What will be the output of the program ?

#include<stdio.h>
void main()
{
    printf(5+"Good Morning");
}


  • Good Morning
  • M  
  • Good
  • Morning


20. Program are converted into machine language with the help of ____

  • an Editor
  • a compiler
  • an operating system
  • none of these


21The  correct  order of  evaluation for the expression “z=x+y*z/4%2-1”


  • */%=+-
  • /*%-+=
  • -+=*%/
  • */%+-=


22. Which of the following function disconnected the stream  from the file pointer?

  • fclose()
  • remove()
  • fremove()
  • file pointer to be set to null


23To flush the memory used by memory n allocation functions, we  use______ function.

  • dealloc()
  • erase()
  • clear()
  • free()


24Which of the following adds one string to end of the  another

  • append()
  • stringadd()
  • strcat()
  • stradd()


25. What will be the output of the given program?

#include<stdio.h>
void main()
{
    int a=11,b=5;
    if(a=5) b++;
    printf("%d %d", ++a, b++);
}

  • 12 7
  • 5 6
  • 6 6
  • 6 7




Answer's:

1-d                                                            
2-a                                                            
3-b                                                            
4-a                                                            
5-c                                                            
6-d                                                            
7-b                                                            
8-a                                                            
9-b                                                            
10-b                                                          
11-c                                                          
12-c                                                          
13-c                                                          
14-d                                                          
15-c                                                          
16-d                                                          
17-a                                                          
18-d                                                          
19-d                                                          
20-b                                                          
21-d                                                          
22-a                                                          
23-d                                                          
24-c                                                          
25-c                                                          




No comments:

Post a Comment

If you have any doubts, please discuss here...👇