iGET

Computer Knowledge - MCQ Practice Questions

Practice free Computer Knowledge multiple-choice questions with detailed answers and explanations. Perfect for competitive exam preparation.

309 questions | 100% Free

Q.1Easy

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

Q.2Easy

Which of the following is the correct syntax to declare a pointer in C?

Q.3Easy

What will be the size of the following array in bytes? char arr[10];

Q.4Easy

What is the purpose of the 'void' keyword in C?

Q.5Easy

What is the output of the following C code? int a = 10, b = 20; int c = (a > b) ? a : b; printf("%d", c);

Q.6Easy

What does the strlen() function return?

Q.7Medium

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

Q.8Medium

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

Q.9Medium

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

Q.10Medium

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

Q.11Medium

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

Q.12Medium

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

Q.13Medium

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

Q.14Medium

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

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

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

Q.17Hard

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

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

What is the difference between struct and union in C?

Q.20Easy

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