NEW
Font size
WorksheetsC-Py QUIZ | ROUND 1
Total questions: 20
Worksheet time: 5mins
Which of the following is not a characteristic of an algorithm?
Effectiveness
Accuracy
Finiteness
Ambiguity
What will be the output of the following Python code?
a = 10
b = 20
print(a + b)
20
30
10 + 20
a + b
What will be printed by the following Python code?
for i in range(5):
print(i, end=' ')
1 2 3 4 5
0 1 2 3 4
0 1 2 3
1 2 3 4
Which collection type is ordered, changeable, and allows duplicate members in Python?
Set
Dictionary
List
Tuple
What will be the output of the following code?
fruits = ["apple", "banana", "cherry"]
fruits.append("orange")
print(fruits)
["apple", "banana", "cherry", "orange"]
["orange", "apple", "banana", "cherry"]
["apple", "banana", "cherry"]
["apple", "banana"]
Which function can be used to read keyboard input in Python?
input()
print()
int()
eval()
What will be the output of the following Python code?
try:
print(10/0)
except ZeroDivisionError:
print("Cannot divide by zero")
Cannot divide by zero
10/0
ZeroDivisionError
None of the above
Which of the following is not a core data type in Python?
Lists
Dictionary
Class
Tuple
Which keyword is used to create a function in Python?
function
def
fun
define
What will be the output of the following Python code?
def add(a, b):
return a + b
print(add(3, 5))
3 + 5
8
add(3,5)
None
Which of the following is not a valid variable name in C?
_sum
FLOAT
$var
average1
What will be the output of the following C code?
int main() {
int x = 5;
int y = 10;
if(x == y) {
printf("Equal");
}
else {
printf("Not Equal");
}
return 0;
}
Equal
Not Equal
5
10
Which of the following is the correct syntax for a for loop in C?
for i = 0; i < 10; i++
for (i = 0; i < 10; i++)
for i in range(10):
for(int i = 0; i < 10; i--)
What is the output of the following code?
int main() {
int arr[] = {1, 2, 3, 4};
int i;
for(i=0; i<4; i++) {
printf("%d ", arr[i]);
}
return 0;
}
1234
1 2 3 4
0 1 2 3
Garbage Values
Which function can be used to dynamically allocate memory in C?
malloc()
memalloc()
alloc()
calloc()
What is the index of the first element of an array in C?
0
1
2
Depends on the size of the array
Which keyword is used to declare a function in C?
function
def
func
void
What is the size of int data type in C?
8 bits
16 bits
32 bits
Depends on the system architecture
What is the output of the following code snippet?
int x = 10;
int y = 20;
printf("%d %d", x, y);
10 20
20 10
x y
30
Which of the following is a valid declaration of two dimensional array in C?
int arr[3][5];
int arr(3,5);
int arr[3,5];
int arr[[3],[5]];
