Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

برمجة موجهة

Total questions: 67

Worksheet time: 34mins

Name
Class
Date
1.

defines an in-built module platform that provides system information.

a)

Python

b)

Platform module

2.

is used to retrieve as much possible information about the platform on which the program is being currently executed.

a)

Python

b)

Platform module

3.

Purpose: Returns a string with a detailed description of the platform.

a)

platform.platform()

b)

platform.machine()

c)

platform.processor()

d)

platform.system()

4.

Description: This function gives you a complete summary of the platform you are running on, which includes information like OS name, release, version, and additional identifiers.

a)

platform.platform()

b)

platform.processor()

c)

platform.processor()

d)

platform.system()

5.

Purpose: Returns the machine type (architecture).

a)

platform.platform()

b)

platform.machine()

c)

platform.processor()

d)

platform.system()

6.

Description: This provides the hardware identifier of the machine, such as x86_64 for 64-bit Intel processors, arm for ARM-based systems, etc.

a)

platform.platform()

b)

platform.machine()

c)

platform.processor()

d)

platform.system()

7.

Purpose: Returns the name of the processor.

a)

platform.platform()

b)

platform.machine()

c)

platform.processor()

d)

platform.system()

8.

Description: This function returns the processor type of the machine you are working on. If the information is not available, it may return an empty string.

a)

platform.platform()

b)

platform.machine()

c)

platform.processor()

d)

platform.system()

9.

Purpose: Returns the name of the operating system.

a)

platform.platform()

b)

platform.machine()

c)

platform.processor()

d)

platform.system()

10.

Description: This function provides a simple way to check the underlying OS. The output might be Windows, Linux, Darwin (for macOS), etc.

a)

platform.machine()

b)

platform.machine()

c)

platform.processor()

d)

platform.system()

11.

Returns the version of the operating system.

a)

platform.version()

b)

platform.python_implementation()

c)

platform.python_version_tuple()

12.

Description: This function returns the version information of the current operating system.

a)

platform.version()

b)

platform.python_implementation()

c)

platform.python_version_tuple()

13.

Purpose: Returns the name of the Python implementation.

a)

platform.version()

b)

platform.python_implementation()

c)

platform.python_version_tuple()

14.

Description: This function tells you which Python interpreter is being used, such as CPython, PyPy, IronPython, etc

a)

platform.version()

b)

platform.python_implementation()

c)

platform.python_version_tuple()

15.

Purpose: Returns the Python version as a tuple.

a)

platform.version()

b)

platform.python_implementation()

c)

platform.python_version_tuple()

16.

Description: This function returns the current version of Python as a tuple, which is useful when you want to split the major, minor, and patch versions

a)

platform.version()

b)

platform.python_implementation()

c)

platform.python_version_tuple()

17.

This function returns a tuple that stores information regarding the system.

a)

platform.uname()

b)

platform.python_build()

c)

platform.architecture()

18.

this function can be used to replace the individual functions to retrieve information about the system, node, release, version, machine, version and processor. Thus, a single function serving many purposes

a)

platform.uname()

b)

platform.python_build()

c)

platform.architecture()

19.

This function returns a tuple that stores information about the python build date and build no. This information is stored in the tuple as a string datatype.

a)

platform.uname()

b)

platform.python_build()

c)

platform.architecture()

20.

This function returns a tuple that stores information about the bit architecture(number of bits in the platform processor) and linkage format( defines how names can or can not refer to the same entity throughout the whole program or one single translation unit).

a)

platform.uname()

b)

platform.python_build()

c)

platform.architecture()

21.

(like OS, hardware, and processor)

a)

system environment

b)

Python runtime itself

22.

(like version and implementation)

a)

system environment

b)

Python runtime itself

23.

are a fundamental aspect of Python programming that handle errors in code, preventing programs from crashing unexpectedly.

a)

Exceptions

b)

ValueError

c)

IndexError

d)

FileNotFoundError

24.

Raised when a file operation fails, such as trying to open a file that doesn’t exist.

a)

exception

b)

ValueError

c)

IndexError

d)

FileNotFoundError

25.

is an event that occurs during the execution of a program and disrupts the normal flow of instructions.

a)

exception

b)

ValueError

c)

IndexError

d)

FileNotFoundError

26.

Raised when trying to access an index that is not within the range of a list or other data structure.

a)

exceptions

b)

ValueError

c)

IndexError

d)

FileNotFoundError

27.

are a type of error that occurs when a syntactically correct program runs into an unexpected situation.

a)

exceptions

b)

ValueError

c)

IndexError

d)

FileNotFoundError

28.

Raised when a function receives an argument of the right type but an inappropriate value.

a)

exceptions

b)

ValueError

c)

IndexError

d)

FileNotFoundError

29.

In this case, when Python encounters the division by zero, it does not crash. Instead, it catches the error and executes the code in the except block, printing the error message.

a)

try-except Block

b)

Multiple Exceptions

c)

else Block

d)

finally block

30.

is used to specify code that should run no matter what happens, whether an exception is raised or not.

a)

try-except Block

b)

Multiple Exceptions

c)

else block

d)

finally block

31.

This is useful for cleanup operations, such as closing files or releasing resources.

a)

try-except Block

b)

Multiple Exceptions

c)

else Block

d)

finally Block

32.

This is useful in situations where you need to guarantee that certain cleanup code runs, such as closing a file or a database connection.

a)

try-except Block

b)

Multiple Exceptions

c)

else Block

d)

finally Block

33.

This is useful when different exceptions should be handled similarly.

a)

try-except Block

b)

Multiple Exceptions

c)

else Block

d)

finally Block

34.

is executed if the try block does not raise an exception.

a)

try-except Block

b)

Multiple Exceptions

c)

else Block

d)

finally Block

35.

used to handle the normal case where no exceptions occur.

a)

try-except Block

b)

else block

c)

Multiple Exceptions

d)

finally Block

36.

helps in separating the error handling code from the normal operation of the program.

a)

try-except Block

b)

Multiple Exceptions

c)

else Block

d)

finally Block

37.

This allows for more granular control over how exceptions are handled, particularly in cases where some errors should be handled differently depending on the context.

a)

Nested try-except Blocks

b)

Exception Propagation

c)

Reraising Exceptions

d)

Custom Exceptions

38.

allows you to define your own exceptions by creating a new class that inherits from the built-in Exception class.

a)

Nested try-except Blocks

b)

Exception Propagation

c)

Reraising Exceptions

d)

Custom Exceptions

39.

This can be useful in specific cases where you want to handle errors more granularly

a)

Nested try-except Blocks

b)

Exception Propagation

c)

Reraising Exceptions

d)

Custom Exceptions

40.

perform some actions, and then re-raise the exception so it can be handled elsewhere.

a)

Nested try-except Blocks

b)

Exception Propagation

c)

Reraising Exceptions

d)

Custom Exceptions

41.

is raised inside a function and is not caught, it propagates upwards to the calling function.

a)

Nested try-except Blocks

b)

Exception Propagation

c)

Reraising Exceptions

d)

Custom Exceptions

42.

This process continues until the exception is caught or until it reaches the top of the call stack, at which point the program crashes.

a)

Nested try-except Blocks

b)

Exception Propagation

c)

Reraising Exceptions

d)

Custom Exceptions

43.

if an exception occurs in divide, it will propagate up to get_input, and if get_input doesn’t handle it, it will propagate to the main code block.

a)

Nested try-except Blocks

b)

Exception Propagation

c)

Reraising Exceptions

d)

Custom Exceptions

44.

128 basic characters, including letters, numbers, and symbols.

a)

ASCII

b)

Unicode

c)

UTF-8

d)

Codepoints

45.

is historically crucial as it laid the foundation for later encoding standards.

a)

ASCII

b)

Unicode

c)

UTF-8

d)

Codepoints

46.

Represents thousands of characters across languages,each with a unique hexadecimal code point.

a)

ASCII

b)

Unicode

c)

UTF-8

d)

Codepoints

47.

allows representing thousands of characters from various languages and symbol.

a)

ASCII

b)

Unicode

c)

UTF-8

d)

Codepoints

48.

represent unique Unicode values.

a)

ASCII

b)

Unicode

c)

UTF-8

d)

Codepoints

49.

balancing storage efficiency with the ability to represent diverse characters.

a)

ASCII

b)

Unicode

c)

UTF-8

d)

Codepoints

50.

A popular Unicode encoding that uses 1-4 bytes per character, efficient for global text.

a)

ASCII

b)

Unicode

c)

UTF-8

d)

Codepoints

51.

allow using special characters in strings.

a)

Escape Sequences

b)

Ord()

c)

Chr()

52.

Include special characters in strings, like ‘\n’ for newline or ‘\t’ for tab.

a)

Escape Sequence

b)

Ord()

c)

Chr()

53.

converts a single character to its Unicode code as an integer

a)

Escape Sequence

b)

Ord()

c)

Chr()

54.

Gets Unicode codepoint of a character.

a)

Escape Sequence

b)

Ord()

c)

Chr()

55.

Gets character from a Unicode codepoint.

a)

Escape Sequence

b)

Ord()

c)

Chr()

56.

it is converts an integer codepoint to its corresponding character.

a)

Escape Sequences

b)

Ord()

c)

Chr()

57.

are defined with single (‘) or double (“) quotes. Multi-line strings use triple quotes (‘’’ ‘’’ ) and preserve formatting, ideal for documentation and formatted text.

a)

Literals

b)

Indexing

58.

string in Python are ordered

a)

Literals

b)

Indexing

59.

Strings are ordered, starting from index 0; negative indices access from the end.

a)

Literals

b)

Indexing

60.

allows extracting substrings using start and end indices, with the end index exclusive.

a)

Slicing

b)

Immutability

c)

Iteration

61.

Looping through strings can use enumerate for index and character, or list comprehensions for transformations.

a)

Slicing

b)

Immutability

c)

Iteration

62.

they cannot be altered after creation.

a)

Slicing

b)

Immutability

63.

Using enumerate with a for loop gives both index and character.

a)

Enumerate

b)


For Loop Iteration

c)

Comprehension

64.

Checks on each character, maintaining readability.

a)

Enumerate

b)


For Loop Iteration

c)

Comprehensions

65.

each character in a string can be accessed individually using a for loop.

a)

Enumerate

b)

For Loop Iteration

c)

Comprehensions

66.

to handling text data is foundational for programming

a)

Python’s approach

b)

strings

67.

are essential for almost every type of application, from data processing to user interactions

a)

Python’s approach

b)

strings