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 difference between calloc() and malloc() in C?

Q.22Medium

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

Q.23Medium

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

Q.24Medium

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

Q.25Medium

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

Q.26Medium

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

Q.27Medium

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

Q.28Medium

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

Q.29Medium

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

Q.30Medium

Which function is used to compare two strings in C?

Q.31Medium

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

Q.32Medium

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

Q.33Medium

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

Q.34Medium

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

Q.35Medium

Which function is used to allocate memory dynamically in C?

Q.36Medium

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

Q.37Medium

In C, what does the scanf() function do?

Q.38Medium

What will be the output of: for(int i = 0; i < 3; i++) { printf("%d ", i); }?

Q.39Medium

Which of the following is the correct way to define a function that takes no parameters and returns no value?

Q.40Medium

What is the output of the following program: int x = 5; if(x > 3) printf("Greater"); else printf("Smaller");?