wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

ict 2023 python

Total questions: 119

Worksheet time: 3585secs

Name
Class
Date
1.

What was Python named after?

a)

A type of snake

b)

A British comedy show

c)

A famous programming pioneer

d)

A famous scientist

2.

What is the significance of libraries like Pandas, TensorFlow, and Scikit-learn in Python?

a)

They are used for creating video games.

b)

They are used for web development.

c)

They are used for data analysis and machine learning.

d)

They are used for scientific computing.

3.

How is Python described in the introduction?

a)

A bridge connecting thought to action

b)

A highly complex programming language

c)

A language that prioritizes brevity over readability

d)

A language with limited capabilities

4.

Which of the following is NOT an advantage of Python?

a)

Readability

b)

Versatility

c)

Speed

d)

Community support

5.

Who implemented Python in December 1989?

a)

Bill Gates

b)

Linus Torvalds

c)

Guido van Rossum

d)

Tim Berners-Lee

6.

In Python, which data type is used to store a sequence of characters?

a)

Float

b)

String

c)

Integer

d)

Boolean

7.

What does the len() function in Python do?

a)

Converts a string to lowercase

b)

Returns the length of a list or string

c)

Converts a number to a string

d)

Rounds a floating-point number

8.

Which operator is used to check if two values are equal in Python?

a)

=

b)

==

c)

!=

d)

<>

9.

.In Python, which of the following is a valid way to comment multiple lines of code?

a)

/* This is a comment */

b)

// This is a comment //

c)

''' This is a comment '''

d)

# This is a comment

10.

What is the output of the following code? x = 5 y = 2 result = x // y print(result)

a)

2.5

b)

2

c)

2.0

d)

2.25

11.

What arithmetic operators cannot be used with strings ?

a)

+

b)


*

c)


d)

All of the mentioned

12.

What will be the output of the following Python code snippet ?

d = {"john":40, "peter":45}

"john" in d

a)

True

b)

False

c)

None

d)

Error

13.

What will be the output of the following Python code ?

random.choice([10.4, 56.99, 76])

a)

Error

b)

Either 10.4, 56.99 or 76

c)

Any number other than 10.4, 56.99 and 76

d)

56.99 only

14.

What does the function re.search do?

a)

matches a pattern at the start of the string

b)

matches a pattern at any position in the string

c)

such a function does not exist

d)

none of the mentioned

15.

What will be the output of the following Python code snippet ?

d = {"john":40, "peter":45}

print(list(d.keys()))

a)

["john", "peter"]

b)

["john": 40, "peter": 45]

c)

{"john", "peter"}

d)

("john": 40, "peter": 45)

16.

What does the ‘return’ keyword do in a function ?

a)

Terminates the function

b)

Returns a value from the function

c)

Skips the function

d)

Declares a variable

17.

What will be the output of the following code snippet ?

def multiply(a, b=2):

return a * b

result = multiply(5)

print(result)

a)

5

b)

10

c)

2

d)

7

18.

What is a lambda function in Python?

a)
  1. A function that returns multiple values

b)
  1. A function that can accept a variable number of arguments

c)
  1. An anonymous function defined using the keyword ‘lambda’

d)
  1. A function that can call itself

19.

What does the filter() function do with a lambda function as its first argument?

a)
  1. Filters out elements from an iterable based on the lambda function’s result

b)
  1. Adds elements to an iterable based on the lambda function's result

c)
  1. Sorts elements in an iterable based on the lambda function's result

d)
  1. Reverses elements in an iterable based on the lambda function’s result

20.

What is the output of the following code snippet ?

my_function = lambda x: "even" if x % 2 == 0 else "odd"

print(my_function(7))

a)
  1. «even»

b)
  1. «odd»

c)
  1. True

d)
  1. False

21.

What does the character '^' represent in a regex pattern in Python ?

a)
  1. Matches the end of a string

b)
  1. Matches the start of a string

c)
  1. Matches any character except newline

d)
  1. Matches zero or one occurrence of the preceding element

22.
  1. Which of the following regex patterns will match either "cat" or "dog" in Python ?

a)
  1. (cat|dog)

b)
  1. [catdog]

c)
  1. cat*dog

d)
  1. cat&dog

23.

In Python regex, what does the character '.' represent?

a)
  1. Matches any character except newline

b)
  1. Matches zero or one occurrence of the preceding element

c)
  1. Matches the start of a string

d)
  1. Matches a literal period character

24.

What does the regex pattern \w+ match in Python?

a)
  1. Matches a literal 'w' character followed by a plus sign

b)
  1. Matches one or more word characters

c)
  1. Matches whitespace characters

d)
  1. Matches any character except word characters

25.

In Python regex, what does the expression \s represent?

a)
  1. Match any character except whitespace

b)
  1. Match a literal 's' character

c)
  1. Match any whitespace character

d)
  1. Start of a string

26.

What does the character '|' represent in a regex pattern in Python?

a)

Logical OR, matches either the pattern on the left or the one on the right

b)

Matches the start of a string

c)

Matches any digit character

d)

Matches one or more occurrences of the preceding element

27.

What does the '?' symbol indicate in a regex pattern in Python?

a)
  1. Matches zero or more occurrences of the preceding element

b)
  1. Matches one or zero occurrences of the preceding element

c)
  1. Matches exactly one occurrence of the preceding element

d)
  1. Matches one or more occurrences of the preceding element

28.

Which of the following regex patterns will match a phone number with an optional country code in Python?

a)
  1. \d{10}

b)
  1. \d{1,3}-\d{3}-\d{4}

c)
  1. \+?\d{1,3}-\d{3}-\d{4}

d)
  1. (\d{3}-){2}\d{4}

29.

Which module in Pygame is used for handling keyboard input?

a)
  1. pygame.draw

b)
  1. pygame.event

c)
  1. pygame.image

d)
  1. pygame.sound

30.

In Pygame, what does pygame.display.set_mode() do?

a)
  1. Sets the screen resolution

b)
  1. Creates a game window

c)
  1. Initializes the game loop

d)
  1. Loads an image

31.

What is the purpose of the pygame.time.Clock object?

a)
  1. Handling user input

b)
  1. Managing game objects

c)
  1. Controlling the frame rate

d)
  1. Loading images

32.

What function is used to draw a rectangle in Pygame?

a)
  1. pygame.rect()

b)
  1. pygame.draw.rectangle()

c)
  1. pygame.draw.rect()

d)
  1. pygame.draw_square()

33.

Which event is triggered when the close button of the window is clicked?

a)
  1. pygame.QUIT

b)
  1. pygame.CLOSE

c)
  1. pygame.EXIT

d)
  1. pygame.CLOSE_WINDOW

34.

How do you play a sound file in Pygame?

a)
  1. pygame.play_sound()

b)
  1. pygame.sound.play()

c)
  1. pygame.mixer.play()

d)
  1. pygame.audio.play()

35.

How do you rotate an image in Pygame?

a)
  1. pygame.rotate()

b)
  1. pygame.image.rotate()

c)
  1. pygame.transform.rotate()

d)
  1. pygame.rotate_image()

36.

What will be the output of the following Python code?

d = {0: 'a', 1: 'b', 2: 'c'}

for x in d.values():

print(x)

a)

0 1 2

b)

a b c

c)

0 a 1 b 2 c

d)

none of the mentioned

37.

What will be the output of the following Python code?a="hello"

b=list(x.upper() for x in a)

print(b)

a)

['H', 'E', 'L', 'L', 'O' ]

b)

[('HELLO', 5)]

c)

[('H', 5), ('E', 5), ('L', 5), ('L', 5), ('O', 5)]

d)

Syntax error

38.

What will be the output of the following Python code snippet?total = {}

def insert(item):

if item in total:

total[item] += 1

else:total[item] = 1

insert('Apple')

insert('Ball')

insert('Apple')

print(len(total))

a)

0

b)

1

c)

2

d)

3

39.

What will be the output of the following code snippet ?

numbers = [1, 2, 3, 4, 5]

squared_numbers = list(map(lambda x: x**2, numbers))

print(squared_numbers)

a)
  1. [1, 2, 3, 4, 5]

b)
  1. [1, 4, 9, 16, 25]

c)
  1. [2, 4, 6, 8, 10]

d)
  1. [0, 1, 4, 9, 16]

40.

What is the following statements about lambda functions is correct ?

a)
  1. Lambda functions can contain multiple expressions separated by commas

b)
  1. Lambda functions can have named parameters

c)
  1.  Lambda functions can contain loops and conditional statements

d)
  1. Lambda functions are limited to a single expression

41.

What does the following Python code accomplish ?class Car:

def init(self, brand, model):

self.brand = brand

self.model = model

car1 = Car("Toyota", "Camry")

car2 = Car("Ford", "Mustang")

a)

Declares a function

b)

Defines a class named Car with attributes brand and model

c)
  1. Creates a list of cars

d)
  1. Calls a method

42.

What is the purpose of the init method in a Python class ?

a)
  1. To create a new object

b)
  1. To initialize the class attributes

c)
  1. To delete an object

d)
  1. To define a class method

43.

What is the purpose of the self parameter in Python class methods ?

a)
  1. It refers to the class itself

b)
  1. It refers to the object instance of the class

c)
  1. It is a reserved keyword and has no specific purpose

d)
  1. It refers to the parent class

44.

What does the regex pattern \d{2,4} match in Python?

a)
  1. Matches exactly 2 digits

b)
  1. Matches 2 to 4 digits

c)
  1. Matches at least 4 digits

d)
  1. Matches any digit

45.

Which regex pattern will match the end of a string in Python?

a)
  1. $

b)
  1. \$

c)
  1. \d$

d)
  1. \E

46.

In Python regex, what does the expression \B represent?

a)
  1. Backspace character

b)
  1. Non-word boundary

c)

Match a backslash character

d)

Match any whitespace character

47.

What does the '*' symbol indicate in a regex pattern in Python?

a)
  1. Matches zero or one occurrence of the preceding element

b)
  1. Matches zero or more occurrences of the preceding element

c)
  1. Matches one or more occurrences of the preceding element

d)
  1. Matches exactly one occurrence of the preceding element

48.

Which of the following regex patterns will match a valid email address in Python?

a)
  1. \b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b

b)
  1. email@domain

c)
  1. [a-z]+@[0-9]+\.[a-z]{3}

d)
  1. email@.com

49.
  1. Which regex pattern will match a string that starts with "abc" and ends with "xyz" in Python?

a)
  1. ^abc$xyz

b)
  1. abc.*xyz

c)
  1. abc|xyz

d)
  1. abc+xyz

50.

In Python regex, what does the expression \d represent?

a)
  1. Match any digit character

b)
  1. Match any non-digit character

c)
  1. Match a literal 'd' character

d)
  1. Match any whitespace character

51.

Which of the following regex patterns will match a string that contains only letters in Python?

a)
  1. \w+

b)
  1. [a-zA-Z]+

c)
  1. \D

d)
  1. \S

52.

What does Pygame primarily focus on?

a)
  1. Web development

b)
  1. Machine learning

c)
  1. Game development

d)
  1. Data analysis

53.

What function is used to initialize Pygame?

a)
  1. pygame.init()

b)
  1. pygame.start()

c)
  1. pygame.setup()

d)
  1. pygame.begin()

54.

How do you fill the entire screen with a color in Pygame?

a)
  1. screen.fill(color)

b)
  1. pygame.fill(color)

c)
  1. pygame.draw.fill(color)

d)
  1. pygame.display.fill(color)

55.

Which method is used to load an image in Pygame?

a)
  1. pygame.load_image()

b)
  1. pygame.image.load()

c)
  1.  pygame.load()

d)
  1. pygame.image.load_image()

56.
  1. How do you handle collisions between two rectangles in Pygame?

a)
  1. Using pygame.check_collision()

b)
  1. Using pygame.rect_collision()

c)
  1. Using pygame.rect.colliderect()

d)
  1. Using pygame.collision.detect()

57.

What is the purpose of the pygame.sprite.Sprite class?

a)
  1. Handling audio

b)
  1. Managing game states

c)
  1. Creating game objects

d)
  1. Drawing graphics

58.

Which method is used to get the current mouse position in Pygame?

a)
  1. pygame.mouse.current_position()

b)
  1. pygame.mouse.get_position()

c)
  1. pygame.get_mouse_position()

d)
  1. pygame.current_mouse_position()

59.
  1. Where is the variable created correctly?
    * We are asking about an answer option that will not give an error when starting the project *

a)
  1. int num = 2

b)
  1. No suitable option

c)
  1. num = float(2)

d)
  1. var num = 2

e)
  1. $num = 2

60.

What will be the result of this code? x = 23

  1. num = 0 if x > 10 else 11 print(num) *

a)

0

b)

23

c)

10

d)

11

e)

error

61.

What will this code show?
for j in 'Hi! I\'m mister Robert':

if j == '\'': print("Found") break

else: \
print ("Done")

a)

An error in the code

b)

"Found" and "Done"

c)

Found

d)

Done

62.

How many libraries can be imported into one project?

a)

No more than 3

b)

Unlimited amount

c)

No more than 10

d)

No more than 5

63.

Which library is responsible for the time?

a)
  1. localtime

b)
  1. time

c)
  1. clock

d)
  1. Time

64.
  1. Which function prints something to the console?

a)
  1. write()

b)
  1. log()

c)
  1. out()

d)
  1. print()

65.
  1. What will be shown as a result? name = "John"
    print('Hi, %s' % name)

a)
  1. "Hi, name"

b)
  1. "Hi, "

c)
  1. "Hi, John"

d)
  1. Error

66.

How to get data from user?

a)

Use the input() method

b)

Use the get() method

c)

Use the cin() method

d)

Use the read() method

67.

What are the errors in the code below? def factorial(n):

if n == 0: return 1

else: return n * factorial(n - 1) print(factorial(5))

a)

A function cannot call itself

b)

Return type must be specified

c)

The function will always return 1

d)

There are no errors in the code

68.
  1. What will this code show? for i in range(5):

    if i % 2 == 0: continue

    print(i)

a)
  1. Error because i is not assigned

b)
  1. Error due to invalid output

c)
  1. Numbers: 1 and 3

d)
  1. Numbers: 1, 3 and 5

e)
  1. Numbers: 0, 2 and 4

69.
  1. a = 3
    for i in range(4):

    a += a
    Will there be an answer?

a)

48

b)

52

c)

12

d)

96

70.

The while loop is called:

a)

There is no correct answer

b)

Loop with postcondition

c)

Loop with precondition

d)

Loop with parameter

71.

How many times will the loop run
for k in range(7,12):

a)

4

b)

3

c)

0

d)

5

e)

6

72.

What will be the value of the integer variable "a" after the execution of this program fragment?
a =4
for i in range(5):

a += i

a)

14

b)

9

c)

20

d)

10

73.
How many times will the loop be executed: i=4
while i<10:
i=i+3
a)

4

b)

10

c)

3

d)

2

74.
  1. What is the name of the algorithms containing the repetition construction?

a)
  1. branching

b)
  1. Cyclic

c)
Linear
d)
Recursive
75.
  1. There is a tuple of the form T = (4, 2, 3).
    Which operation will cause the name T to refer to a tuple (1, 2, 3)?

a)
  1. T[0] = 1

b)
  1. T = (1) + T[1:]

c)
  1. T = (1,) + T[1:]

d)
  1. T.startswith(1)

76.
  1. What is the built-in function enumerate() used in Python for?

a)
  1. For simultaneous iteration over the elements themselves and their indices.

b)
  1. To determine the number of elements in a sequence.

c)
  1. To sort elements by id values.

77.
  1. What will the interpreter output for the following program (Python version 3.6+)?

    def get_name_and_decades(name, age):
    print(f"My name is {name} and I'm {age / 10:.5f} decades old.")

    get_name_and_decades("Leo", 31)

a)
  1. My name is Leo and I'm 31.00000 decades old.

b)
  1. My name is Leo and I'm 3.1 decades old.

c)
  1. My name is {name} and I'm {age / 10:.5f} decades old.

d)
  1. My name is Leo and I'm 3.10000 decades old.

78.
  1. It is necessary to collect and display all unique words from a line of advertising text. Which of the following Python data types is the best fit?

a)
  1. set

b)
  1. list

c)
  1. tuple

d)
  1. array

e)
  1. dict

79.
  1. Recording of animals in the zoo is carried out using the list of dictionaries below. Which line of code will output a structure sorted in ascending order of animal ages?

    animals = [ {'type': 'penguin', 'name': 'Stephanie', 'age': 8}, {'type': 'elephant', 'name': 'Devon', 'age': 3},

    {'type': 'puma', 'name': 'Moe', 'age': 5}, ]

a)
  1. sorted(animals, key='age')

b)
  1. sorted(animals, key=lambda animal: animal['age'])

c)
  1. sorted(animals)

d)
  1. Neither option is correct, two dictionaries cannot be compared with each other.

80.
  1. What will be the output of the following code? def f(a, pargs, *kargs): print(a, pargs, kargs) f(1, 2, 3, x=4, y=5)

a)
  1. 1, 2, 3, {'x': 4, 'y': 5}

b)
  1. 1 (2, 3) {'x': 4, 'y': 5}

c)
  1. An exception will be thrown, after the colon it is necessary to go to a new line.

d)
  1. 1, 2, 3, 'x=4', 'y=5'

e)
  1. 1, 2, 3, 4, 5

81.
  1. How to list methods and attributes of x object?

a)
  1. dir(x)

b)
  1. help(x)

c)
  1. info(x)

d)
  1. ?x

82.
  1. What will the following code display? a, b, c = [1, 2]
    print(a, b, c)

a)
  1. [1] [] [2]

b)
  1. An exception will be thrown: there are fewer elements in the list than variables.

c)
  1. 1 0 2

d)
  1. 1 [] 2

83.
  1. When declaring a class using the class statement, what is written in parentheses after the class name?

a)
  1. The names of the arguments accepted by the init method.

b)
  1. The names of the arguments accepted by the class.

c)
  1. The names of the arguments accepted by the class.

d)
  1. Names of classes generated by this class.

84.

Which of the following is NOT a python data type?

a)

int

b)

float

c)

char

d)

bool

e)

str

85.

What is the correct way to declare a variable in Python?

a)
  1. var x = 10

b)
  1. x = 10

c)
  1. x := 10

d)
  1. set x = 10

e)
  1. declare x = 10

86.

Which one is not true about Python?

a)
  1. Variable names are not case-sensitive

b)
  1. String variables can be declared either by using single or double quotes

c)
  1. Boolean represent one of two values: True or False

d)
  1. Variables are containers for storing data values

e)
  1. Comments can be used to prevent execution when testing code

87.

What is the output of the following code? x=5

y=2

result = x // y print(result)

a)

2.5

b)

2

c)

3

d)

7

e)

10

88.

What is the output of this set union operation?set_a = {1, 2, 3}

set_b = {3, 4, 5}

set_c = set_a.union(set_b) print(set_c)

a)
  1. {1, 2, 3, 3, 4, 5}

b)
  1. {1, 2}

c)
  1. {1, 2, 3, 4, 5}

d)
  1. {3}

e)
  1. None of the above

89.

What is the purpose of the return statement in a function?

a)
  1. To return a value from the function to the caller

b)
  1. To terminate the function

c)
  1. To specify the data type of the function output

d)
  1. To print the output of the function

e)
  1. To specify the input of the function

90.

When the else block in the while-else construct is executed

a)
  1. Program ends.

b)
  1. When break is executed

c)
  1. When error is occurred

d)
  1. When while statement becomes false

e)
  1. Each time continue is executed.

91.

Which of the following is an example of a python list?

a)
  1. (1, 2, 3)

b)
  1. {1, 2, 3}

c)
  1. [1, 2, 3]

d)
  1. {1: 'one', 2: 'two', 3: 'three'}

e)
  1. '1, 2, 3'

92.

Which Python feature allows you to create small, anonymous functions?

a)
  1. Python Lambda

b)
  1. Python Classes

c)
  1. Python Inheritance

d)
  1. Python Functions

e)
  1. Python Decorators

93.

What is the primary purpose of the init method in a class?

a)
  1. To initialize class attributes

b)
  1. To define class methods

c)
  1. To create class objects

d)
  1. To perform calculations

e)
  1. To define class properties

94.

What is the purpose of using a lambda function with map in Python?

a)
  1. To convert a list of elements into a dictionary

b)
  1. To filter elements in a list based on a condition.

c)
  1. To apply a function to each element in a list and return a new list.

d)
  1. To reduce a list of elements to a single value

e)
  1. To perform mathematical operations on a list of elements and return a

single value

95.

The possible return types of a function in Python can include:


a)
  1. None

b)
  1. list

c)
  1. function

d)
  1. float

e)
  1. all the above

96.
  1. Which of the following statements is true regarding generators?

a)
  1. Generators can only be used with the for loop.

b)
  1. Generators can be created using the yield keyword.

c)
  1. Generators can only be used to generate numbers.

d)
  1. Generators are used to create infinite loops.

e)
  1. Generators cannot be used to iterate over a collection.

97.
  1. What is the purpose of Python iterators?

a)
  1. To define reusable code with attributes and methods

b)
  1. To generate small, anonymous functions

c)
  1. To provide a way to loop over a collection of items

d)
  1. To handle date and time information

e)
  1. To perform mathematical calculations

98.
  1. What can JSON do in Python?

a)
  1. Exchange and store data

b)
  1. Clear a dataset.

c)
  1. Access and change types

d)
  1. Manage data types.

e)
  1. Visualize an upcoming request.

99.
  1. What is the primary purpose of the "global" keyword?

a)
  1. To define a local variable

b)
  1. To define a global variable

c)
  1. To access a global variable from within a function

d)
  1. To define a new function

e)
  1. To define a new function

100.

Which method is used to find all occurrences of a pattern in a string using regular expressions in Python?

a)
  1. match()

b)
  1. search()

c)
  1. find()

d)
  1. findall()

e)
  1. All the above

101.

Which of the following regex symbols check finite number of characters

a)

?

b)

{5:}

c)

+

d)

*

e)

{0:}

102.

Which method in python's regex module is used to match a pattern at the start of a string?

a)

match()

b)

search()

c)

findall()

d)

sub()

e)

split()

103.

Python regular expressions, what do metacharacters represent?

a)

Special characters that match literal characters

b)

Characters that are used for string formatting

c)

Characters that match any digit

d)

Characters that match any whitespace character

e)

Characters that have special meaning and are used to define the pattern

104.

Which parameter of open() is defined incorrectly?

a)
  1. "a" - will append to the end of the file

b)
  1. "w" - will overwrite any existing content

c)
  1. "x" - will create a file, returns an error if the file exist

d)
  1. "a" - will return an error if the file does not exist

e)
  1. "w" - will create a file if the specified file does not exist

105.

Which of the following is NOT a Python built-in function?

a)

max()

b)

pow()

c)

random()

d)

len()

e)

all()

106.

What is the correct way to create a file named "example.txt" using open function?

a)
  1. file = open("example.txt", "r")

b)
  1. file = open("example.txt", "b")

c)
  1. file = open("example.txt", "a")

d)
  1. file = open("example.txt", "rb")

e)
  1. file = open("example.txt", "x")

107.

What you could use to get a list of all lines in a files

a)

readlines()

b)

read()

c)

readline()

d)

read_files()

e)

readlist()

108.

Which pygame function is used to set the size of the window?

a)

pygame.display.set_mode()

b)

pygame.display.set_screen()

c)

pygame.transform.scale()

d)

pygame.display.set_size()

e)

none

109.
  1. What is the value returned by pygame.mouse.get_pos()

a)
  1. The current position of the mouse cursor

b)
  1. The position of the mouse cursor relative to the center of the screen

c)
  1. The change in position of the mouse cursor since the last frame

d)
  1. The position of the last mouse button click

e)
  1. The position of the mouse cursor relative to a specific sprite

110.
  1. Which Pygame module is used for collision detection?

a)
  1. pygame.event

b)
  1. pygame.mixer

c)
  1. pygame.sprite

d)
  1. pygame.font

e)
  1. pygame.image

111.
  1. Chose correct order of methods for Centralized Scene Logic

a)
  1. Render, Process, Input

b)
  1. Process, Update, Render

c)
  1. Input, Process, Render

d)
  1. Render, Update, Input

e)
  1. Init, Input, Process

112.
  1. Which of the following is a correct way to handle input in pygame?

a)
  1. Use the built-in "input" function in python to read keyboard input.

b)
  1. Use a while loop to continuously check for keyboard input.

c)
  1. Define an event handler function that checks for keyboard events and add it to the

    event queue

d)
  1. Use the "keyboard" module from the pygame library to read keyboard input.

e)
  1. Use the "input" method of the pygame "Keyboard" class to read keyboard input

113.
  1. Which Pygame module is used to draw shapes and lines on the screen?

a)
  1. pygame.surface

b)
  1. pygame.paint

c)
  1. pygame.drawing

d)
  1. pygame.draw

e)
  1. pygame.graphic

114.
  1. Draw a green rectangle in Pygame.

a)
  1. pygame.draw.rect(screen, (0,255,0), pygame.Rect(10, 10, 100, 100), 10)

b)
  1. pygame.draw.rect(screen, (0,255,0), Rect(10, 10, 100, 100), 10)

c)
  1. pygame.draw.rect(screen, (0,255,0), pygame.rect(10, 10, 100), 10)

d)
  1. pygame.draw.rect(screen, (0,255,0), pygame.rect(10, 10, 100, 100))

e)
  1. pygame.draw.rect(screen, (0,255,0), pygame.Rect(10, 10, 10, 100, 100))

115.
  1. In a typical platformer game using Pygame, what is the most common method

for handling gravity?

a)
  1. Applying a constant force to the player character

b)
  1. Modifying the player character's position

c)
  1. Detecting collisions with the ground

d)
  1. Using the physics module

e)
  1. All the above

116.

How we can check collision between two objects in pygame? (For example to determine if Snake object has collided with the Food object in Snake game)

a)
  1. By comparing the x and y coordinates of the Snake object's head to the Food object's location

b)
  1. By comparing the x and y coordinates of the Snake object's head to the x and y coordinates of each block of the Snake's body

c)
  1. By using pygame functions to determine collisions

d)
  1. A and C

e)
  1. All the above

117.

Which of the following query depicts the correct Select statement?

a)
  1. SELECT * from data

b)
  1. SELECTallfromdata

c)
  1. SELECT # from data

d)
  1. Select column from

e)
  1. Select ** from data

118.

Which query add information to table

a)

Create

b)

Insert

c)

Update

d)

Alter

e)

Drop

119.

f What is the purpose of the following SQL command in PostgreSQL?CREATE TABLE mytable ( id SERIAL PRIMARY KEY

    , name VARCHAR(50)

, age INT );

a)
  1. To create a new schema called "mytable"

b)
  1. To create a new PostgreSQL database called "mytable"

c)
  1. To create a new table called "mytable" with columns "id", "name", and "age"

d)
  1. To add a new row to the "mytable" table

e)
  1. To modify the structure of an existing table called "mytable"