iGET

Computer Knowledge - MCQ Practice Questions

Computer Science questions in competitive exams stay close to fundamentals, which is good news if you revise the right five subjects. Coverage includes data structures, algorithms and complexity, operating systems, database management systems, computer networks, and computer organisation. Explanations show the trace or the state table where one helps, since seeing the intermediate steps is what makes the concept stick.

304 questions | 100% Free

Q.1Medium

What is the output of the following C code?
int x = 5;
int y = ++x + x++;
printf("%d", y);

Q.2Medium

What is the difference between scanf() and gets() functions?

Q.3Medium

What is the correct way to allocate memory for a single integer using malloc()?

Q.4Medium

What is the output of the following C code?
int x = 5;
int *ptr = &x;
printf("%d %d", *ptr, x);

Q.5Medium

What happens when you use the strcpy() function without bounds checking?

Q.6Medium

What is the output of the following C code?
int arr[] = {10, 20, 30};
int *ptr = arr;
printf("%d", *(ptr + 1));

Q.7Medium

Which of the following correctly describes the scope of a static variable declared inside a function?

Q.8Medium

What will be the output of the following C code?
int x = 10;
int y = 20;
int z = x < y ? x++ : y++;
printf("%d %d %d", x, y, z);

Q.9Medium

In C, a pointer variable stores which of the following?

Q.10Medium

What is the purpose of the malloc() function in C?

Q.11Medium

Which of the following correctly initializes an array of 5 integers?

Q.12Medium

What is the default return type of a function in C if not explicitly specified?

Q.13Medium

What does the break statement do in a loop?

Q.14Medium

Which of the following is used to access members of a structure using a pointer?

Q.15Medium

In C, what is the purpose of the #define directive?

Q.16Medium

What is the correct way to declare a function that takes no parameters and returns an integer?

Q.17Medium

What will be the memory size of the following struct?
struct Point { int x; char c; int y; }

Q.18Medium

What is the correct way to initialize an array of 5 integers with all elements as 0?

Q.19Medium

Which of the following correctly declares a pointer to a pointer?

Q.20Medium

What is the scope of a variable declared inside a function in C?