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

Consider a structure with bit fields. What will be the size of the following structure in bytes?

struct demo {
unsigned int a : 5;
unsigned int b : 3;
unsigned int c : 4;
unsigned int d : 7;
};

Q.2Hard

What is the purpose of the volatile keyword in C?

Q.3Hard

In a B-tree of order m, what is the maximum number of children a non-leaf node can have?

Q.4Hard

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

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

Q.6Hard

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

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

What is the difference between struct and union in C?

Q.9Hard

What will be the output of: int x = 5; printf("%d", ++x);?

Q.10Hard

Consider a pointer ptr pointing to an integer array. What does ptr[2] represent?

Q.11Hard

What is the time complexity of searching for an element in an unsorted array using linear search?

Q.12Hard

What will be the result of executing: int a = 5, b = 10; int *ptr = &a; ptr = &b; printf("%d", *ptr);?

Q.13Hard

Which of the following statements about static variables is TRUE?

Q.14Hard

What happens when you try to access an array element beyond its size in C?

Q.15Hard

Which of the following is the correct way to pass a string to a function in C?

Q.16Hard

Which of the following is an invalid identifier in C?

Q.17Hard

What will be the output of: int x = 5; printf("%d %d", x++, ++x);?

Q.18Hard

What is the difference between structure and union in C?

Q.19Hard

Which of the following function declarations is correct for a function that takes no parameters and returns no value?

Q.20Hard

In C, what is the purpose of the typedef keyword?