Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Byte Battle S3 - ROUND 1

Total questions: 45

Worksheet time: 17mins

Name
Class
Date
1.

print(3 * "Hi")

a)

Hihihi

b)

Hi hi hi

c)

3*Hi

d)

HiHiHi

2.

printf("%d", 7/2);

a)

3.5

b)

3

c)

3.55

d)

3.0

3.

a = [1,2,3]

print(a[1])

(a)  

4.

console.log(typeof "123");

a)

Int

b)

Float

c)

String

d)

Boolean

5.

if True

print("OK")

a)

Missing colon :

b)

Missing semicolon ;

c)

Print OK

d)

True

6.

Which data structure follows FIFO?

a)

Stack

b)

Queue

c)

Tree

d)

Graph

7.

Which is immutable in Python?

a)

List

b)

Set

c)

Tuple

d)

Dictionary

8.

(a)   symbol is used for comments in Python

9.

print("True" == True)

a)

False

b)

True

c)

Error

d)

No Output

10.

HTML stands for

a)

High Text Markup

b)

Hyperlinks Text Multi

c)

Hyper Text Markup Language

d)

Hyper Text Makeup Language

11.

print(2 ** 3)

a)

8

b)

2 ** 3

c)

8.0

d)

0

12.

Index of first element in Python list

a)

-1

b)

0

c)

1

d)

None

13.

System.out.println(10 == 10);

(a)  

14.

int a = "hello";

a)
  • Wrong type; string to int

b)

The variable name a is invalid

c)

Semicolon is missing

d)

Strings must be enclosed in single quotes in C

15.

1 byte = (a)   bits

16.

print(len("abcd"))

a)

4

b)

3

c)

abcd

d)

ABCD

17.

Operator with highest precedence

a)

+

b)

*

c)

()

d)

=

18.

x = [1,2,3]

print(x * 2)

a)

[2, 4, 6]

b)

[1, 2, 3, 1, 2, 3]

c)

[1, 2, 3, 3, 2, 1]

d)

TypeError: can't multiply list by int

19.

for i in range(5)

print(i)

a)

range(5) should be range[5]

b)

Missing colon (:)

c)

Indentation error

d)

print() cannot be used inside a loop in Python

20.

JS function to print in console?

a)

print()

b)

echo()

c)

printf()

d)

console.log()

21.

Local variable exists only inside a (a)  

22.

print(bool(""))

a)

True

b)

False

c)

None

d)

Error

23.

console.log(1 + "2");

a)

3

b)

"12"

c)

12

d)

Error

24.

What is the time complexity of binary search?

a)

O(n)

b)

O(log n)

c)

O(n²)

d)

O(1)

25.

Python function is defined using the keyword (a)   .

26.

x = [10, 20, 30]

y = x

y.append(40)

print(x)

a)

[10, 20, 30]

b)

y gets updated but x remains unchanged

c)

[10, 20, 30, 40]

d)

A new list is created for y,
so the output is [10, 20, 30]

27.

int a = 2, b = 3;

printf("%d", a++ * ++b);

a)

8

b)

6

c)

7

d)

Undefined because of multiple increments

e)

Compiler error

28.

console.log(null == undefined);

a)

true

b)

undefined

c)

false

d)

TypeError

29.

int a = 5;

System.out.println(a++ + ++a);

a)

10

b)

Undefined behavior because of multiple increments

c)

11

d)

12

30.

def add(a, b=5, c):

return a + b + c

a)

Default values cannot be integers

b)

Parameters cannot be more than two

c)

Non-default argument follows default argument

d)

There is no error; this is valid Python

31.

stable sorting algorithm?

a)

Quick Sort

b)

Merge Sort

c)

Selection Sort

d)

Heap Sort

32.

print("abc" < "abd")

a)

True

b)

False

c)

"abc" is shorter, so True

d)

Error: Strings cannot be compared using <

33.

print(2 * * 3 * * 2)

a)

64

b)

512

c)

2 ** 3 which is an error

d)

Error: exponent must be evaluated left to right

34.

Java source files compile into?

a)

.jar

b)

.exe

c)

.class

d)

.java

35.

x = (1,2,3)

x = x + (4,)

print(x)

(a)  

36.

let a = 10;

const a = 20;

Specify the error

(a)  

37.

Which is NOT a primitive datatype in Java?

a)

int

b)

boolean

c)

float

d)

String

38.

x = [1, 2, 3, 4]

print(x[::-1])

a)

[4, 3, 2, 1]

b)

[1, 2, 3, 4]

c)

[-1, -2, -3, -4]

d)

Error: negative index not allowed

39.

C operator for address of variable

a)

@

b)

&

c)

*

d)

%

40.

a = "hello"

b = a

a = "world"

print(b)

a)

world

b)

hello

c)

['hello']

d)

Both a and b become "world"

41.

Java OOP principle

a)

Recursion

b)

Inheritance

c)

Compilation

d)

Translation

42.

The Data Structure that works on LIFO is (a)   .

43.

list = (1,2,3)

list.append(4)

a)

It becomes (1, 2, 3, 4)

b)

It becomes [1, 2, 3, 4]

c)

AttributeError: because tuple has no append()

d)

TypeError: append() only works on strings

44.

Time complexity of linear search

a)

O(1)

b)

O(n)

c)

O(log n)

d)

O(n log n)

45.

print(type({}))

a)

<class 'set'>

b)

<class 'dict'>

c)

<class 'tuple'>

d)

{}