Best C Interview Questions and Answers 2025 2025 | Top C Interview Questions and Answers MCQ Type
Quiz Name | C Interview Questions and Answers Set 2 |
Category | Reasoning |
Number of Questions | 30 |
Time | 30 Minutes |
Exam Type | MCQ (Multiple Choice Questions) |
1. How many main() functions may we have in our project?
a. 1
b. 2
c. There are no restrictions.
d. It is dependent on the compiler.
2. What happens if you compile and run the following c code?
struct marks
int p:3;
int c:3;
int m:2;
};
void main()
struct markings s=2,-6,5;
printf(“percent d percent d percent d”,s.p,s.c,s.m);
}
a. 2 -6 5
b. 2 -6 1
c. 2 2 1
d. Error in compilation
4. The preprocessor allows for—-
a. The inclusion of header files
b. The addition of macro expansions
c. Conditional compilation and line control
d. All of the aforementioned
5. Determine Output: #includestdio.h>
#define a 10 void main ()
#define a 50 printf(“percent d”, a);
a. 50
b. 10
c. Compiler Error
d. None of these
6. What will be the program’s output?
#include #define MIN(x, y) (x 0) printf(“percent dn”, z); return 0;
a. 3
b. 4
c. 0
d. no output
7. What happens if you compile and run the following c code?
void main ()
static main; int x; x=call(main); clrscr(); printf(” percent d “,x); getch(); int call(int address) address+; return address;
a. 0
b. 1
c. Garbage value
d. Compiler error
8. What is the main purpose of the #pragma exit?
a. Examining memory leaks after exiting the application
b. Informing the operating system that the programme has been ended
c. Executing a function when the programme exits
d. No such preprocessor exists.
9. Can you combine the following two statements into one?
a. char *p; p = (char*) malloc(100); A. char p = *malloc(100);
b. B. char *p = (char) malloc(100);
c. char *p = (char*)malloc(100);
d. char *p = (char *)(malloc*)(100);
10. The term refers to a pointer that points to NOTHING.
a. The VOID Pointer is a type of pointer that is used to indicate the presence
b. DANGLING POINTER
c. NULL Pointer is a type of pointer that is not used in programming.
d. WILD Pointer is an abbreviation for Wild Pointer
11.What does the break keyword accomplish?
a. Put a programme on hold.
b. Relaunch a program’s execution.
c. Break out of the loop or switch statement
d. None of the aforementioned.
12. What will be the program’s output?
#include
int main() static char *s[] = “black”, “white”, “pink”, “violet”; char **ptr[] = s+3, s+2, s+1, s, ***p; p = ptr; ++p; printf(” percent s”, **p+1); return 0;
a. ink
b. ite
c. allow
d. ack
13.Relational operators cannot be applied on —–
a. structure
b. lengthy
c. strings
d. float
14. C was designed primarily as a——
a. A programming language for the operating system
b. Language for all purposes
c. Language of data processing
d. None of the aforementioned options.
15. A “C” variable cannot begin with
a. a number
b. A special sign other than underscore
c. Both of the above
d. An alphabet
16. What is the correct value to return to the operating system after successfully completing a programme?
a. 0
b. 1
c. -12
d. 2
17. If the ASCII value of ‘x’ is 120, what is the value of H if H = (‘x’ – ‘w’) / 3?
a. 0
b. 1
c. 2
d. 3
18. “My salary has been boosted by 15%.” Choose the sentence that EXACTLY replicates the line of text above
a. printf(“My salary was increased by 15%!”);
b. printf(“My pay was increased by 15%!”);
c. printf(“My salary was increased by 15%!”);
d. printf(“My salary was increased by 15%!”);
19. What will the output of the following C code be?#include stdio.h> void main() int x = 1, z = 3; int y = x 3; printf(” percent dn”, y);
a. -2147483648
b. -1
c. Run-time error
d. 8
20. What will the output of the following C code be?
#include stdio.h> int main() int a = 10, b = 5, c = 5; int d; d = a == (b + c); printf(“percent d”, d);
a. Incorrect syntax
b. 1
c. 10
d. 5
21. What will the output of the following C code be?
#include stdio.h> void main() int y = 3; int x = 5 percent 2 * 3 / 2; printf(“Value of x is percent d,” x);
a. The value of x is 1.
b. The value of x is two.
c. The value of x is 3.
d. Compile time error
22. The name of a variable used in one function cannot be used in another.
a. This is correct.
b. False
c. It is possible
d. none of the preceding
23. What will the output of the following C code be?
#include stdio.h> int main() j = 10; printf(” percent dn”, j++); return 0;
a. 10
b. 11
c. Compile time error
d. 0
24. What will the output of the following C code be?
#include stdio.h> int main() float f1 = 0.1; if (f1 == 0.1f) printf(“equaln”); otherwise printf(“not equal”);
a. equivalent
b. not the same
c. the output is determined by the compiler
d. none of the above
25. What is the output of the following C code on a 32-bit machine?
#include stdio.h>
int main ()
int x = 10000; double y = 56; int *p = &x; double *q = &y; printf(“p and q are percent d and percent d”, sizeof(p), sizeof(q)); return 0;
a. p and q are 4 and 4 respectively.
b. p and q are 4 and 8 respectively.
c. compiler error
d. p and q are 2 and 8 respectively.
26. What is the size of an int data type?
a. 4 Bytes
b. 8 Bytes
c. This is determined by the system/compiler.
d. Unknown
27. What will the output of the following C code be?#include stdio.h>
int main ()
int I = 3; int l = I / -2; int k = I percent -2; printf(“percent d’percent dn”, l, k); return 0;
a. Compile time error
b. -1 1
c. 1 -1
d. Specification of Implementation
28. What will the output of the following C code be?
#include void main() int k = 4; float k = 4; printf(“percent d”, k)
a. Compile time error
b. 4
c. 4.0000000
d. 4.4
29. What will the output of the following C code be?
#include stdio.h>
const int I = 10; int *ptr = I *ptr = 20; printf(” percent dn”, I return 0;
a. Compile time error
b. Compile time warning and printf show 20
c. Undefined behaviour
d. 10
30. What will the output of the following C code be?#include stdio.h>
void main() int const k = 5; k++; printf(“k is percent d”, k);
a. k is six.
b. Error due to const successful int
c. Error, since a constant variable can only be modified twice.
d. Error, since a constant variable cannot be altered.
Multiple-choice questions and answers for C functions
This portion of “C Functions” programming questions and answers from various entrance exams, interview questions, and competitive examinations is provided. It would be simple to grasp solved instances with thorough answer descriptions and explanations.
What is the C language?
A procedural programming language is one that was invented, the C programming language. It was developed by Dennis Ritchie as a system programming language for building operating systems. It is an excellent place to start for anyone interested in learning how to code and is one of the most widely used programming languages due to its structure, high-level abstraction, machine-independent functionality, etc. Low-level system programming, embedded systems, and hardware all make extensive use of C. It continues to be used to create complex software, including the XNU kernel and the FreeBSD operating system. It has also undergone extensive optimization over time. The C language is a great choice for system programming, including the creation of operating systems and compilers, due to its low-level memory access, minimal set of keywords, and clean style. C is a low-level language that can communicate directly with the processor. It provides the least amount of abstraction and the most amount of control, making it a desirable choice for developers who wish to produce effective code.