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.21Medium

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

Q.22Medium

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

Q.23Medium

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.24Hard

What is the output of the following C code?
#include <stdio.h>
int main() {
int a = 5;
printf("%d %d %d", a++, ++a, a);
return 0;
}

Q.25Hard

What is the correct way to declare a constant pointer to a constant integer?

Q.26Hard

Consider the following C code. What will be printed?
int arr[3][3] = {{1,2,3}, {4,5,6}, {7,8,9}};
int *ptr = (int *)arr;
printf("%d", *(ptr + 5));

Q.27Hard

What is the output of the following C code?
#define MAX 5
int main() {
int arr[MAX];
printf("%d", sizeof(arr)/sizeof(arr[0]));
return 0;
}

Q.28Hard

What is the difference between struct and union in C?

Q.29Easy

Which header file is required to use the printf() function in C?

Q.30Easy

Which of the following is a valid variable name in C?

Q.31Easy

What is the return type of the strlen() function?

Q.32Easy

Which operator has the highest precedence in C?

Q.33Medium

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

Q.34Medium

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

Q.35Medium

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

Q.36Medium

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

Q.37Medium

What does the break statement do in a loop?

Q.38Medium

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

Q.39Medium

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

Q.40Medium

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