PRACTICE • LEARN • GROW
Beginners problem MCQs
Solve topic-wise placement questions and improve your skills.
Beginners problem Progress
0 of 33 completed
0%
Topic Track
You are viewing MCQs in preview mode. Log in to select options, submit answers, and track your progress.
Log In to Answer
1
Which of the following data types in C/C++ typically occupies 4 bytes on a standard 64-bit architecture?
A.
char
B.
short
C.
int
D.
long long
Explanation & Key
Correct Answer:
2
What is the time complexity of accessing an element in an array by its index?
A.
O(1)
B.
O(log n)
C.
O(n)
D.
O(n log n)
Explanation & Key
Correct Answer:
3
What is the value of expression `5 + 2 * 3` according to standard operator precedence in most languages?
A.
21
B.
11
C.
16
D.
17
Explanation & Key
Correct Answer:
4
What happens when a 32-bit signed integer storing INT_MAX (2,147,483,647) is incremented by 1 in two's complement representation without overflow protection?
A.
It becomes 0
B.
It overflows to INT_MIN (-2,147,483,648)
C.
It throws a compile-time error
D.
It stays at INT_MAX
Explanation & Key
Correct Answer:
5
Which of the following loops guarantees that its body will execute at least once?
A.
for loop
B.
while loop
C.
do-while loop
D.
nested loop
Explanation & Key
Correct Answer:
6
What is the primary difference between Pass by Value and Pass by Reference in function arguments?
A.
Pass by value copies the variable, while pass by reference passes the memory address allowing modification of original value
B.
Pass by value is faster than pass by reference always
C.
Pass by reference only works for primitive data types
D.
Pass by value allows modifying the original caller variable
Explanation & Key
Correct Answer:
7
What will be the result of integer division `7 / 2` in languages like C, C++, and Java?
A.
3.5
B.
3
C.
4
D.
3.0
Explanation & Key
Correct Answer:
8
What is the time complexity of finding the maximum element in an unsorted array of size N?
A.
O(1)
B.
O(log N)
C.
O(N)
D.
O(N^2)
Explanation & Key
Correct Answer:
9
Which bitwise operation can be used to check whether an integer N is odd?
A.
N & 1
B.
N | 1
C.
N ^ 1
D.
N << 1
Explanation & Key
Correct Answer:
10
What does the `%` (modulo) operator calculate?
A.
Quotient
B.
Remainder
C.
Square root
D.
Percentage
Explanation & Key
Correct Answer:
11
What is the asymptotic growth rate of `f(n) = 3n^2 + 5n + 100` in Big-O notation?
A.
O(n)
B.
O(n^2)
C.
O(n^3)
D.
O(1)
Explanation & Key
Correct Answer:
12
Where are local variables declared inside a function typically allocated in memory?
A.
Heap segment
B.
Call Stack segment
C.
Data segment
D.
Text segment
Explanation & Key
Correct Answer:
13
What is the space complexity of an iterative algorithm that uses only three integer counter variables regardless of input size N?
A.
O(N)
B.
O(1)
C.
O(log N)
D.
O(N^2)
Explanation & Key
Correct Answer:
14
What is the output of the logical expression `(5 > 3) && (2 > 4)`?
A.
true (1)
B.
false (0)
C.
undefined
D.
Syntax error
Explanation & Key
Correct Answer:
15
What does "short-circuit evaluation" mean in boolean operations like `A || B`?
A.
If A is true, B is not evaluated because the outcome is already guaranteed to be true
B.
Both A and B are evaluated concurrently
C.
The program halts with an exception
D.
B is evaluated before A always
Explanation & Key
Correct Answer:
16
What is the size of a pointer variable on a modern 64-bit operating system?
A.
2 bytes
B.
4 bytes
C.
8 bytes
D.
16 bytes
Explanation & Key
Correct Answer:
17
Which algorithm design technique does Kadane's algorithm belong to?
A.
Divide and conquer
B.
Dynamic programming / Greedy linear scan
C.
Backtracking
D.
Brute force
Explanation & Key
Correct Answer:
18
What is the sum of integers from 1 to N given by the closed-form arithmetic formula?
A.
N * (N - 1) / 2
B.
N * (N + 1) / 2
C.
N^2
D.
(N + 1)^2 / 2
Explanation & Key
Correct Answer:
19
In C and C++, what character denotes the termination of a standard C-string in memory?
A.
'\n'
B.
'\0'
C.
' '
D.
EOF
Explanation & Key
Correct Answer:
20
What is a "segmentation fault" typically caused by in a program?
A.
Infinite loop running forever
B.
Attempting to access a memory address that the program does not have permission to read/write
C.
Compiling code with missing headers
D.
Printing too many lines to stdout
Explanation & Key
Correct Answer:
21
What is the formal mathematical definition of Big-O notation $f(n) = O(g(n))$?
A.
There exist positive constants c and n_0 such that 0 <= f(n) <= c * g(n) for all n >= n_0 (Asymptotic Upper Bound)
B.
f(n) >= c * g(n) for all n
C.
f(n) == g(n) for all n
D.
f(n) / g(n) = 1 as n approaches 0
Explanation & Key
Correct Answer:
22
What does Big-Omega ($Omega$) notation represent compared to Big-O?
A.
Asymptotic Lower Bound (best case or theoretical minimum operations)
B.
Asymptotic Upper Bound
C.
Tight bound (both upper and lower)
D.
Average runtime over random inputs
Explanation & Key
Correct Answer:
23
What does Big-Theta ($Theta$) notation denote?
A.
Asymptotically Tight Bound: the function is bounded both from above (Big-O) and from below (Big-Omega) by the same growth rate
B.
Exponential growth exclusively
C.
Unbounded growth
D.
Constant time execution
Explanation & Key
Correct Answer:
24
According to the Master Theorem, what is the solution to the recurrence $T(n) = 4T(n/2) + O(n)$?
A.
Theta(n^2)
B.
Theta(n log n)
C.
Theta(n)
D.
Theta(n^3)
Explanation & Key
Correct Answer:
25
What is the sum of the harmonic series $1 + 1/2 + 1/3 + dots + 1/n$ in asymptotic notation?
A.
Theta(log n)
B.
Theta(n)
C.
Theta(1)
D.
Theta(n^2)
Explanation & Key
Correct Answer:
26
What is the time complexity of the following code snippet?
```cpp
for (int i = 1; i <= n; i *= 2) {
for (int j = 0; j < i; j++) {
count++;
}
}
```
A.
O(n)
B.
O(n log n)
C.
O(n^2)
D.
O(log n)
Explanation & Key
Correct Answer:
27
What is amortized analysis in algorithm complexity?
A.
Average time over a sequence of operations, guaranteeing that the average cost per operation is low even if an occasional single operation is expensive
B.
Testing runtime on a supercomputer
C.
The best-case execution time
D.
Dividing memory by the number of CPU cores
Explanation & Key
Correct Answer:
28
In asymptotic analysis, which growth rate grows faster: $n^{log_2(n)}$ or $2^n$?
A.
$2^n$ grows strictly faster than $n^{log_2(n)}$
B.
$n^{log_2(n)}$ grows faster
C.
They grow at identical rates
D.
Cannot be determined mathematically
Explanation & Key
Correct Answer:
29
What does Space-Time Tradeoff mean in algorithm engineering?
A.
Increasing memory consumption to achieve faster execution speed (or vice versa)
B.
Trading CPU clock speed for RAM bandwidth
C.
Measuring execution time in gigabytes
D.
Compressing files to run faster
Explanation & Key
Correct Answer:
30
What is the complexity of accessing an element in an array versus looking up an element in a balanced Binary Search Tree?
A.
Array: O(1) direct memory jump; BST: O(log n) pointer traversals
B.
Array: O(n); BST: O(1)
C.
Array: O(log n); BST: O(log n)
D.
Array: O(1); BST: O(n^2)
Explanation & Key
Correct Answer:
31
What is Little-o notation $f(n) = o(g(n))$?
A.
f(n) becomes strictly negligible compared to g(n) as n -> infinity (lim n->inf f(n)/g(n) = 0)
B.
f(n) is identical to g(n)
C.
f(n) is greater than g(n)
D.
f(n) is a constant function
Explanation & Key
Correct Answer:
32
Why is an algorithm with $O(1000 n)$ often preferred over an algorithm with $O(0.001 n^2)$ for large datasets?
A.
Because as n grows toward infinity, the quadratic term $n^2$ eventually dwarfs any constant factor
B.
Because 1000 is a smaller number than 0.001
C.
Because linear algorithms don't use memory
D.
Because quadratic algorithms cannot be compiled in C++
Explanation & Key
Correct Answer:
33
What is the sum of $1 + 2 + 3 + dots + n$ in closed mathematical form?
A.
n(n + 1) / 2
B.
n^2
C.
n(n - 1)
D.
2^n
Explanation & Key
Correct Answer:
Question Palette
Answered
Current
Not Attempted
Wrong