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 will be the memory size of the following struct?
struct Point { int x; char c; int y; }

Q.22Medium

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

Q.23Medium

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

Q.24Medium

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

Q.25Medium

What is the difference between calloc() and malloc() in C?

Q.26Medium

What is the correct syntax to open a file in C?

Q.27Medium

Consider the following code:
int arr[] = {1, 2, 3, 4, 5};
int *ptr = arr;
What is the value of *(ptr + 2)?

Q.28Medium

What is the output of the following code?
for(int i = 1; i <= 3; i++) { if(i == 2) continue; printf("%d ", i); }

Q.29Medium

What is the output of: int x = 10; printf("%d", x++); printf("%d", x);

Q.30Medium

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

Q.31Medium

What will be printed if char ch = 'A'; printf("%d", ch); is executed?

Q.32Medium

Which of the following is used to dynamically allocate memory in C?

Q.33Medium

What will be the output of: char str[] = "Hello"; printf("%c", str[1]);?

Q.34Medium

Which function is used to compare two strings in C?

Q.35Medium

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

Q.36Medium

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

Q.37Medium

Which loop in C does NOT check the condition before executing the loop body?

Q.38Medium

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

Q.39Medium

Which function is used to allocate memory dynamically in C?

Q.40Medium

What is the output of: int a = 10, b = 20; int temp = a; a = b; b = temp; printf("%d %d", a, b);?