wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

IT 403 - MIDTERM REVIEW (1)

Total questions: 50

Worksheet time: 32mins

Name
Class
Date
1.

Which statement best describes Python's execution model?

a)

Python compiles all code before execution begins

b)

Python translates and executes code line by line in real-time

c)

Python only executes compiled bytecode files

d)

Python requires manual compilation by the programmer

2.

Python prioritizes code readability and simplicity over raw performance in its design philosophy.

a)

True

b)

False

3.

What happens when Python encounters a lexical error during interpretation?

a)

Python automatically corrects the error

b)

Python skips the problematic code and continues

c)

Python stops execution and reports the error location

d)

Python converts the error to a warning

4.

High-level programming languages like Python provide abstractions that more closely match human thinking patterns.

a)

True

b)

False

5.

Python's interpreted nature makes it particularly suitable for:

a)

System-level programming only

b)

High-performance computing only

c)

Rapid prototyping and interactive development

d)

Embedded systems only

6.

Which variable name follows Python naming conventions?

a)

user-name

b)

user_name

c)

1st_user

d)

class

7.

The expression int(3.99) returns 4.

a)

True

b)

False

8.



(a)  

9.

What is the result of 15 // 4 * 2?

a)

7.5

b)

6

c)

7

d)

8

10.

What data type is returned by this expression?

(a)  

11.

What does this code output if user enters 25?

a)

<class 'int'>

b)

<class 'float'>

c)

<class 'str'>

d)

<class 'number'>

12.

String concatenation using + creates a new string object since strings are immutable.

a)

True

b)

False

13.



(a)  

14.

Which escape sequence represents a tab character?

a)

\n

b)

\t

c)

\r

d)

\b

15.

What happens with float("3.14.15")?

a)

Returns 3.14

b)

Returns 3.1415

c)

Raises ValueError

d)

Returns 0

16.

Which value is considered truthy in Python?

a)

0

b)

[]

c)

""

d)

"0"

17.



(a)  

18.

The expression [] == False evaluates to True.

a)

True

b)

False

19.

What is the output?

a)

123

b)

13

c)

12

d)

23

20.



(a)  

21.

Given mylst = [10, 20, 30, 40, 50], what does mylst[1::2] return?

a)

[10, 30, 50]

b)

[20, 40]

c)

[20, 30, 40]

d)

[10, 20]

22.

The expression True or (x/0) will always raise a ZeroDivisionError.

a)

True

b)

False

23.

What is the result of 7 ^ 3 (bitwise XOR)?

(a)  

24.

What happens with this list operation?

a)

[1, 2, 3]

b)

[1, 2, 3, 4]

c)

Error

d)

[4]

25.

What is the output?

a)

2468

b)

246

c)

24

d)

2480

26.



(a)  

27.

List slicing can never raise an IndexError, even with invalid indices.

a)

True

b)

False

28.

What is the result of not False and True or False?

a)

True

b)

False

c)

Error

d)

None

29.



(a)  

30.

Which of the following does not create a shallow copy of a list?

a)

new_list = old_list

b)

new_list = old_list[:]

c)

new_list = old_list.copy()

d)

Both new_list = old_list[:] and new_list = old_list.copy()

31.

What is the output?

a)

Hello, World!

Hello, Python!

b)

Error

c)

Hello, !
Hello, Python!

d)

Hello, World!

Hello, World!

32.

Tuples can contain mutable objects like lists as their elements.

a)

True

b)

False

33.

The value of result is:

(a)  

34.

What happens when accessing a non-existent dictionary key?

a)

Returns None

b)

Returns empty string

c)

Raises KeyError

d)

Returns 0

35.



(a)  

36.

Lambda functions can be assigned to variables and used like regular functions.

a)

True

b)

False

37.

What is the output?

a)

Success

b)

Success

No error

Done

c)

Success

Done

d)

Error

Done

38.



(a)  

39.

Which function parameter allows accepting any number of keyword arguments?

a)

*args

b)

**kwargs

c)

*params

d)

**options

40.

The finally block executes even if there's a return statement in the try block.

a)

True

b)

False

41.



(a)  

42.

What does dict.get('key', 'default') do when 'key' doesn't exist?

a)

Raises KeyError

b)

Returns None

c)

Returns 'default'

d)

Returns empty string

43.

What is the output?

a)

(1, [2, 3], 4)

b)

(1, [2, 3, 5], 4)

c)

Error

d)

(1, 5, 4)

44.



(a)  

45.

Dictionary keys must be unique, but values can be duplicated.

a)

True

b)

False

46.

What is the difference between import math and from math import sqrt?

a)

No difference

b)

First imports entire module, second imports specific function

c)

Second is faster

d)

First is deprecated

47.

The __init.py__ file can be empty but must exist for a directory to be treated as a package.

a)

True

b)

False

48.

When this file is imported as a module, the output is:

(a)  

49.

Which PIP command creates a requirements.txt file with all installed packages?

a)

pip list > requirements.txt

b)

pip freeze > requirements.txt

c)

pip export > requirements.txt

d)

pip save > requirements.txt

50.

What does from package import * do?

a)

Imports everything from the package

b)

Imports only functions defined in all

c)

Imports the package itself

d)

Causes an error