WorksheetsC, C++, and Python Quiz
Total questions: 25
Worksheet time: 13mins
What is the default value of a local variable in C?
0
1
Garbage Value
Null
Which operator is used to find the address of a variable?
*
&
%
@
What will `printf("%d", sizeof(char));` output on most systems?
1
2
4
8
Which function is used to deallocate memory in C?
remove()
delete()
free()
malloc()
What is the result of `5 / 2` in C (using integer types)?
2.5
2
3
Error
Which keyword is used to prevent a variable from being modified?
static
volatile
immutable
const
A pointer that is not initialized to any specific memory address is called:
Null Pointer
Void Pointer
Wild Pointer
Dangling Pointer
Which of the following is used for input in C++?
cin
cout
scanf
What is the process of defining two or more functions with the same name but different parameters?
Function Overriding
Function Overloading
Encapsulation
Abstraction
Which pillar of OOPS is used to hide the internal implementation details?
Inheritance
Polymorphism
Abstraction
Reusability
What is a "Constructor" in C++?
A function to delete an object
A function called when an object is created
A keyword to define a class
A type of loop
Which access specifier makes class members accessible only within the same class?
public
protected
private
internal
In C++, `std::` is a:
Variable
Function
Class
Namespace
What does the `new` operator do in C++?
Creates a new variable
Allocates memory on the Heap
Allocates memory on the Stack
Declares a constant
Which of the following is the correct extension for Python files?
.pt
.py
.python
.pc
How do you define a block of code in Python?
Brackets { }
Parentheses ( )
Indentation
Quotation marks
What is the output of `print(type([]))`?
Which keyword is used to create a function in Python?
function
define
def
func
What will `print("abc" * 3)` output?
abc3
abcabcabc
Error
aabbcc
Which data structure in Python is immutable?
List
Dictionary
Tuple
Set
What is the correct way to handle exceptions in Python?
try...catch
try...except
throw...catch
if...error
Which of these is a valid variable name in most languages?
2nd_value
total-amount
_count
class
A loop that never ends is called an:
Infinite loop
Recursive loop
While loop
Fruitless loop
In the ASCII table, which value usually represents the character 'A'?
97
65
48
1
What is the time complexity of searching an element in a balanced Binary Search Tree?
O(n)
O(1)
O(log n)
O(n²)
