WorksheetsByte Battle S3 - ROUND 1
Total questions: 45
Worksheet time: 17mins
print(3 * "Hi")
Hihihi
Hi hi hi
3*Hi
HiHiHi
printf("%d", 7/2);
3.5
3
3.55
3.0
a = [1,2,3]
print(a[1])
(a)
console.log(typeof "123");
Int
Float
String
Boolean
if True
print("OK")
Missing colon :
Missing semicolon ;
Print OK
True
Which data structure follows FIFO?
Stack
Queue
Tree
Graph
Which is immutable in Python?
List
Set
Tuple
Dictionary
(a) symbol is used for comments in Python
print("True" == True)
False
True
Error
No Output
HTML stands for
High Text Markup
Hyperlinks Text Multi
Hyper Text Markup Language
Hyper Text Makeup Language
print(2 ** 3)
8
2 ** 3
8.0
0
Index of first element in Python list
-1
0
1
None
System.out.println(10 == 10);
(a)
int a = "hello";
Wrong type; string to int
The variable name a is invalid
Semicolon is missing
Strings must be enclosed in single quotes in C
1 byte = (a) bits
print(len("abcd"))
4
3
abcd
ABCD
Operator with highest precedence
+
*
()
=
x = [1,2,3]
print(x * 2)
[2, 4, 6]
[1, 2, 3, 1, 2, 3]
[1, 2, 3, 3, 2, 1]
TypeError: can't multiply list by int
for i in range(5)
print(i)
range(5) should be range[5]
Missing colon (:)
Indentation error
print() cannot be used inside a loop in Python
JS function to print in console?
print()
echo()
printf()
console.log()
Local variable exists only inside a (a)
print(bool(""))
True
False
None
Error
console.log(1 + "2");
3
"12"
12
Error
What is the time complexity of binary search?
O(n)
O(log n)
O(n²)
O(1)
Python function is defined using the keyword (a) .
x = [10, 20, 30]
y = x
y.append(40)
print(x)
[10, 20, 30]
y gets updated but x remains unchanged
[10, 20, 30, 40]
A new list is created for y,
so the output is [10, 20, 30]
int a = 2, b = 3;
printf("%d", a++ * ++b);
8
6
7
Undefined because of multiple increments
Compiler error
console.log(null == undefined);
true
undefined
false
TypeError
int a = 5;
System.out.println(a++ + ++a);
10
Undefined behavior because of multiple increments
11
12
def add(a, b=5, c):
return a + b + c
Default values cannot be integers
Parameters cannot be more than two
Non-default argument follows default argument
There is no error; this is valid Python
stable sorting algorithm?
Quick Sort
Merge Sort
Selection Sort
Heap Sort
print("abc" < "abd")
True
False
"abc" is shorter, so True
Error: Strings cannot be compared using <
print(2 * * 3 * * 2)
64
512
2 ** 3 which is an error
Error: exponent must be evaluated left to right
Java source files compile into?
.jar
.exe
.class
.java
x = (1,2,3)
x = x + (4,)
print(x)
(a)
let a = 10;
const a = 20;
Specify the error
(a)
Which is NOT a primitive datatype in Java?
int
boolean
float
String
x = [1, 2, 3, 4]
print(x[::-1])
[4, 3, 2, 1]
[1, 2, 3, 4]
[-1, -2, -3, -4]
Error: negative index not allowed
C operator for address of variable
@
&
*
%
a = "hello"
b = a
a = "world"
print(b)
world
hello
['hello']
Both a and b become "world"
Java OOP principle
Recursion
Inheritance
Compilation
Translation
The Data Structure that works on LIFO is (a) .
list = (1,2,3)
list.append(4)
It becomes (1, 2, 3, 4)
It becomes [1, 2, 3, 4]
AttributeError: because tuple has no append()
TypeError: append() only works on strings
Time complexity of linear search
O(1)
O(n)
O(log n)
O(n log n)
print(type({}))
<class 'set'>
<class 'dict'>
<class 'tuple'>
{}
