Central Exam — Computer Knowledge
UPSC · SSC · Bank · Railway · NDA — Central Government Exam MCQ Practice
94 Questions 5 Topics Take Test
Advertisement
Showing 51–60 of 94 questions
Q.51 Easy C Programming
What will be the value of x after executing: int x = 5; x += 3; x *= 2;
A 10
B 16
C 11
D 13
Correct Answer:  B. 16
Explanation:
Step 1: x = 5. Step 2: x += 3 means x = x + 3 = 5 + 3 = 8. Step 3: x *= 2 means x = x * 2 = 8 * 2 = 16. Therefore, x = 16.
Take Test
Q.52 Easy C Programming
Which preprocessor directive is used to include a custom header file?
A #include
B #include "filename"
C #include [filename]
D #include {filename}
Correct Answer:  B. #include "filename"
Explanation:

Custom/local header files are included using double quotes: #include "filename". Standard library headers use angle brackets: #include <filename>. The compiler searches for quoted files in the current directory first.

Take Test
Q.53 Easy C Programming
Which of the following is NOT a valid variable name in C?
A _myVar
B myVar123
C 123myVar
D my_var
Correct Answer:  C. 123myVar
Explanation:

Variable names in C cannot start with a digit. They must begin with a letter (a-z, A-Z) or underscore (_). '123myVar' is invalid.

Take Test
Q.54 Easy C Programming
What will be the output of: printf("%d", 5 + 3 * 2);?
A 16
B 11
C 13
D 18
Correct Answer:  B. 11
Explanation:

Operator precedence: multiplication (*) is performed before addition (+). So: 3 * 2 = 6, then 5 + 6 = 11.

Take Test
Q.55 Easy C Programming
What keyword is used to create a pointer variable in C?
A ref
B *
C &
D ptr
Correct Answer:  B. *
Explanation:

The asterisk (*) symbol is used to declare pointer variables. For example: int *ptr; declares a pointer to an integer.

Take Test
Advertisement
Q.56 Easy C Programming
What is the correct way to declare a pointer to an integer?
A int p*;
B int *p;
C *int p;
D pointer int p;
Correct Answer:  B. int *p;
Explanation:

The correct syntax is 'int *p;' where int is the data type, * indicates pointer, and p is the pointer variable name.

Take Test
Q.57 Easy C Programming
Which function is used to read a single character from standard input?
A scanf()
B getchar()
C gets()
D fgetc()
Correct Answer:  B. getchar()
Explanation:

getchar() reads a single character from standard input (stdin). While fgetc() can also read a character, getchar() is the standard dedicated function for this purpose.

Take Test
Q.58 Easy C Programming
In the expression: int arr[3][3]; arr[1][2] = 5; What is being accessed?
A Element in row 1, column 2
B Element in row 2, column 3
C Element in row 2, column 1
D Invalid access - syntax error
Correct Answer:  A. Element in row 1, column 2
Explanation:

In C, array indices are 0-based. arr[1][2] refers to the element in the second row (index 1) and third column (index 2) of the 2D array.

Take Test
Q.59 Easy C Programming
What is the output of the following C code?
int main() {
int a = 10;
printf("%d", a += 5);
return 0;
}
A 10
B 15
C 5
D Compilation Error
Correct Answer:  B. 15
Explanation:

The += operator adds 5 to a (a = a + 5 = 10 + 5 = 15), and printf prints the updated value 15.

Take Test
Q.60 Easy C Programming
What is the purpose of the strlen() function in C?
A To compare two strings
B To find the length of a string
C To copy one string to another
D To concatenate two strings
Correct Answer:  B. To find the length of a string
Explanation:

The strlen() function returns the number of characters in a string, excluding the null terminator ('\0').

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