Computer Knowledge
Aptitude · Reasoning · English · CS — Corporate & Campus Interview Prep
94 Questions 5 Topics Take Test
Advertisement
Showing 21–30 of 94 questions
Q.21 Easy C Programming
Which header file is required to use the printf() function?
A #include
B #include
C #include
D #include
Correct Answer:  B. #include
Explanation:

The stdio.h (Standard Input Output) header file contains declarations for printf(), scanf(), and other input/output functions. It is essential for console I/O operations.

Take Test
Q.22 Easy C Programming
In C, which operator has the highest precedence?
A Arithmetic operator
B Logical operator
C Parentheses ()
D Assignment operator
Correct Answer:  C. Parentheses ()
Explanation:

Parentheses have the highest precedence in C. Expressions within parentheses are evaluated first, followed by arithmetic operators, then logical operators, and finally assignment operators.

Take Test
Q.23 Easy C Programming
What is the purpose of the break statement in a loop?
A Pause the loop temporarily
B Exit the loop immediately
C Restart the loop
D Skip the current iteration
Correct Answer:  B. Exit the loop immediately
Explanation:

The break statement exits or terminates the current loop immediately. Option D describes continue (which skips to next iteration), while break actually exits the loop.

Take Test
Q.24 Easy C Programming
In C programming, which of the following is NOT a valid data type?
A int
B float
C string
D double
Correct Answer:  C. string
Explanation:

In C, 'string' is not a primitive data type. C uses 'char' arrays to represent strings. The valid primitive data types are int, float, double, char, void, and their variants.

Take Test
Q.25 Easy C Programming
What will be the output of: int a = 10; int b = 20; int c = a + b; printf("%d", c);?
A 10
B 30
C 20
D Error
Correct Answer:  B. 30
Explanation:

Variable 'a' is initialized to 10, 'b' is initialized to 20. When c = a + b, c becomes 10 + 20 = 30. Therefore, printf outputs 30.

Take Test
Advertisement
Q.26 Easy C Programming
Which of the following is used to declare a constant in C?
A constant int x = 5;
B const int x = 5;
C final int x = 5;
D immutable int x = 5;
Correct Answer:  B. const int x = 5;
Explanation:

In C, the 'const' keyword is used to declare constants. Once a const variable is initialized, its value cannot be changed. Options A, C, and D are not valid C syntax.

Take Test
Q.27 Easy C Programming
What is the purpose of the return statement in a C function?
A To exit the program
B To return a value to the caller and exit the function
C To declare variables
D To create a loop
Correct Answer:  B. To return a value to the caller and exit the function
Explanation:

The return statement is used to exit a function and return a value (if any) to the calling function. If the function has return type void, no value is returned.

Take Test
Q.28 Easy C Programming
Which header file is required for using the printf() function?
A cstdlib.h
B stdio.h
C string.h
D math.h
Correct Answer:  B. stdio.h
Explanation:

stdio.h (Standard Input/Output header) contains declarations for printf(), scanf(), and other I/O functions.

Take Test
Q.29 Easy C Programming
What is the correct syntax to declare a constant in C?
A const int x = 10;
B int const x = 10;
C constant int x = 10;
D Both A and B
Correct Answer:  D. Both A and B
Explanation:

Both 'const int x = 10;' and 'int const x = 10;' are valid ways to declare constants in C. The const keyword can appear before or after the type.

Take Test
Q.30 Easy C Programming
Which operator is used to access the value at an address in C?
A &
B *
C ->
D .
Correct Answer:  B. *
Explanation:

The * operator is the dereference operator that accesses the value at a memory address. The & operator gets the address of a variable.

Take Test
IGET
iget AI
Online · Ask anything about exams
Hi! 👋 I'm your iget AI assistant.

Ask me anything about exam prep, MCQ solutions, study tips, or strategies! 🎯
UPSC strategy SSC CGL syllabus Improve aptitude NEET Biology tips