NEW
Font size
WorksheetsTECH WHIZ
Total questions: 15
Worksheet time: 9mins
1. Which of the following is NOT a feature of OOP?
a) Encapsulation
b) Polymorphism
c) Recursion
d) Inheritance
2. Which OOP principle allows different classes to have methods with the same name but different implementations?
a) Abstraction
b) Encapsulation
c) Inheritance
d) Polymorphism
3. What is the time complexity of searching an element in a balanced binary search tree (BST)?
a) O(n)
b) O(log n)
c) O(n log n)
d) O(1)
4. What is the primary advantage of using a linked list over an array?
a) Faster access to elements
b) Dynamic size allocation
c) Lower memory usage
d) Constant-time search operation
5. Which CSS property makes an element take up the entire width of its container?
a) display: block;
b) display: inline;
c) display: flex;
d) display: grid;
6. How much memory does the following structure take?
struct test {
char a;
int b;
char c;
};
a) 6 bytes
b) 8 bytes
c) 12 bytes
d) 10 bytes
7. Which of the following statements about pointers is correct?
a) void* pointer cannot be typecasted
b) A pointer can store the address of any variable, regardless of type
c) Dereferencing a NULL pointer is valid
d) Pointer arithmetic is not allowed in C
8. What will happen if you try to free a NULL pointer?
a) It causes a segmentation fault
b) It causes memory leak
c) It results in undefined behavior
d) It does nothing
9. What is the worst-case time complexity of QuickSort?
a) O(n)
b) O(n log n)
c) O(n²)
d) O(log n)
10. What is the default display value for a <div> element in HTML?
a) inline
b) block
c) inline-block
d) grid
11. What is the output of the following code?
#include <stdio.h>
int main() {
int a = 5;
int *p = &a;
*p += 2;
printf("%d\n", a);
return 0;
}
a) 5
b) 7
c) 2
d) Undefined behavior
12. Which sorting algorithm is the best for sorting nearly sorted data?
a) Quick Sort
b) Merge Sort
c) Insertion Sort
d) Heap Sort
13. Which CSS property is used to make text bold?
a) font-weight
b) text-style
c) boldness
d) text-decoration
14. What is the output of the following code?
x = [1, 2, 3]
y = x
y.append(4)
print(x)
a) [1, 2, 3]
b) [1, 2, 3, 4]
c) Error
d) None
15. What will be the output of the following code?
x = 5
y = x
y += 2
print(x, y)
a) 5 5
b) 7 7
c) 5 7
d) 7 5
