wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

TA 1st Round Technical Coding

Total questions: 50

Worksheet time: 22mins

Name
Class
Date
1.

What is the correct file extension for Python files?

a)

.pyt

b)

.py

c)

.python

d)

.pt

2.

Which keyword is used for defining a function in Python?

a)

func

b)

define

c)

def

d)

lambda

3.

What is the output of the expression 5 // 2 in Python?

a)

2.5

b)

2

c)

3

d)

2.0

4.

Which of the following data types is immutable?

a)

List

b)

Dictionary

c)

Set

d)

Tuple

5.

What does the len() function do?

a)

Finds the largest number

b)

Returns the length of an object

c)

Converts data types

d)

Removes an element from a list

6.

Which of these is the correct way to import a module?

a)

import math

b)

include math

c)

using math

d)

module math

7.

What is the output of print(type(3.0))?

a)

int

b)

float

c)

str

d)

None

8.

What does the is operator compare?

a)

Value

b)

Identity

c)

Type

d)

Length

9.

Which of the following functions can be used to iterate over a sequence by index?

a)

range()

b)

enumerate()

c)

zip()

d)

map()

10.

What is the default mode in which the open() function opens a file?

a)

Write

b)

Read

c)

Append

d)

Binary

11.

What will be the output of the following code? python x = [1, 2, 3, 4] print(x[1:3])

a)

[1, 2]

b)

[2, 3]

c)

[2, 3, 4]

d)

[3, 4]

12.

What is the output of the following code? python print(2**3**2)

a)

512

b)

64

c)

16

d)

9

13.

Which function will convert a string into a list of words?

a)

split()

b)

list()

c)

words()

d)

slice()

14.

What will be the output of this code? python def add(a, b=10): return a + b print(add(5))

a)

15

b)

10

c)

5

d)

Error

15.

Which function can be used to find the maximum value in a list?

a)

min()

b)

sum()

c)

max()

d)

range()

16.

What is the output of the following code? python x = [1, 2, 3] x.append(4) print(x)

a)

[1, 2, 3, 4]

b)

[1, 2, 3]

c)

[1, 4]

d)

Error

17.

What is the output of the following code? python print(bool(0), bool(3.14))

a)

True True

b)

True False

c)

False True

d)

False False

18.

What is the result of the following expression? python 3 * "Python"

a)

"PythonPythonPython"

b)

["Python", "Python", "Python"]

c)

Error

d)

None

19.

What is the output of the following code? python x = {"a": 1, "b": 2} print(x.get("c", 3))

a)

None

b)

3

c)

Error

d)

0

20.

What will list(range(1, 10, 2)) return?

a)

[1, 2, 3, 4, 5, 6, 7, 8, 9]

b)

[1, 3, 5, 7, 9]

c)

[1, 3, 5, 7]

d)

Error

21.

What will be the output of this code? python a, b = b, a = 1, 2 print(a, b)

a)

1 2

b)

2 1

c)

Error

d)

1 1

22.

What is the output of the following code? python print(0.1 + 0.2 == 0.3)

a)

True

b)

False

c)

Error

d)

None

23.

What will be the output? python x = [1, 2, 3] print(x * 2)

a)

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

b)

[2, 4, 6]

c)

[1, 2, 3]

d)

Error

24.

What will this code output? python print("abc" * 0)

a)

abc

b)

None

c)

""

d)

Error

25.

What is the result of this code? python x = 10 print(x == 10 and x > 5)

a)

True

b)

False

c)

Error

d)

None

26.

What is the output of the following? python x = [1, 2, 3] y = x y.append(4) print(x)

a)

[1, 2, 3]

b)

[1, 2, 3, 4]

c)

[4]

d)

Error

27.

What will this print? python print(sorted([3, 2, 1], reverse=True))

a)

[1, 2, 3]

b)

[3, 2, 1]

c)

Error

d)

None

28.

What is the output? python print(bool([]))

a)

True

b)

False

c)

Error

d)

None

29.

What will this code produce? python print("Python"[::-1])

a)

"nohtyP"

b)

"Python"

c)

""

d)

Error

30.

What is the output of the following code? python print({1, 2, 3} & {2, 3, 4})

a)

{2, 3}

b)

{1, 4}

c)

{1, 2, 3, 4}

d)

None

31.

What will this code output? python print("abc" * 0)

a)

abc

b)

None

c)

""

d)

Error

32.

What is the result of this code? python x = 10 print(x == 10 and x > 5)

a)

True

b)

False

c)

Error

d)

None

33.

What is the output of the following? python x = [1, 2, 3] y = x print(x)

a)

[1, 2, 3]

b)

[1, 2, 3, 4]

c)

[4]

d)

Error

34.

What will this print? python print(sorted([3, 2, 1], reverse=True))

a)

[1, 2, 3]

b)

[3, 2, 1]

c)

Error

d)

None

35.

What is the output? python print(bool([]))

a)

True

b)

False

c)

Error

d)

None

36.

What will this code produce? python print("Python"[::-1])

a)

"nohtyP"

b)

"Python"

c)

""

d)

Error

37.

What is the output of this code? c int a = 10; printf("%d", a);

a)

10

b)

%d

c)

Error

d)

None of the above

38.

Which library function is used to find the length of a string?

a)

strlen()

b)

size()

c)

length()

d)

strlength()

39.

What is the value of x after executing the following code? c int x = 5; x++;

a)

5

b)

6

c)

7

d)

Undefined

40.

Which of the following is not a valid storage class in C?

a)

auto

b)

register

c)

static

d)

mutable

41.

What is the size of the int data type in most systems?

a)

a) 2 bytes

b)

b) 4 bytes

c)

c) 8 bytes

d)

d) System-dependent

42.

Which of the following is the correct syntax for a comment in C?

a)

a) // This is a comment

b)

b) <!-- This is a comment -->

c)

c) /* This is a comment */

d)

d) ''' This is a comment'''

43.

What does the sizeof operator do?

a)

a) Allocates memory

b)

b) Returns the size of a data type or variable in bytes

c)

c) Compares two variables

d)

d) None of the above

44.

Which of the following is used to end a switch statement in C?



(a)  

45.

What is the output of the following code?*

c

int arr[] = {1, 2, 3};

printf("%d", arr[2]);

(a)  

46.

Which of the following functions is used to copy strings in C?

(a)  

47.

What is the time complexity of accessing an element in an array?*

(a)  

48.

25. What is the output of the following code?*

c

#define SQUARE(x) x*x

printf("%d", SQUARE(5+1));

(a)  

49.

27. What is the output of the following code?

c

char *str = "Hello";

printf("%c", *(str+1));



(a)  

50.

29. What is the output of the following code?

c

int x = 1;

if (x = 0)

printf("True");

else

printf("False");

(a)