1.
Type question here. Example: Practice makes you ________
2.
In Python, what is one function to output content to the console?
Correct Answer
C. Print
Explanation
The correct answer is "print". In Python, the "print" function is used to output content to the console. It allows you to display text or variables on the screen during the execution of a program.
3.
What is the correct way to declare a variable name with value "Chris"
Correct Answer
A. Name="chris"
Explanation
The correct way to declare a variable name with the value "Chris" is by using the syntax "name = 'chris'". This assigns the value "chris" to the variable name.
4.
To make this statement evaluate to true, how will you modify the condition.if ("Oberoi International School".length <=10): print("A Big name to handle!);
Correct Answer
D. All of the above
Explanation
The correct answer is "All of the above". In order to make the statement evaluate to true, any of the mentioned modifications can be made. Changing the condition to >= will make it true if the length of the string is greater than or equal to 10. Decreasing the length of the string will also make the condition evaluate to true if the length becomes less than or equal to 10. Lastly, changing the print statement will not affect the evaluation of the condition, but it is still a valid modification.
5.
Screen = pygame.display.set_mode(size)What is the purpose of this statement in the program?
Correct Answer
B. To specify the display size
Explanation
This statement is used to set the display size of the window in a pygame program. It creates a window with the specified size, which determines the dimensions of the game or application being developed.
6.
If event.type == pygame.QUIT:What does this statement check for?
Correct Answer
B. Checks for the quit event
Explanation
The given statement "if event.type == pygame.QUIT" checks for the quit event in the pygame module. It is used to determine if the user has requested to quit the program by closing the window or pressing the close button. If this condition is true, it means that the user wants to exit the program, and appropriate actions can be taken accordingly.
7.
Clock.tick(100)The statement
Correct Answer
B. Sets the frames per second in a tick of clock
Explanation
The statement "clock.tick(100)" sets the frames per second in a tick of the clock. This means that the program will update and render its graphics at a rate of 100 frames per second. The tick function is commonly used in game development to control the speed at which the game runs and ensures smooth animation and gameplay.
8.
Which of the following is not a valid assignment operator?
Correct Answer
D. X=
Explanation
The given answer, X=, is not a valid assignment operator. In programming, an assignment operator is used to assign a value to a variable. The operators +=, -=, and *= are valid assignment operators that perform addition, subtraction, and multiplication respectively. However, X= does not follow the syntax of an assignment operator. It should be a valid variable name followed by the = sign and a value to be assigned. Therefore, X= is not a valid assignment operator.
9.
Which one of the following is a valid Python if statement
Correct Answer
A. If a >= 22:
Explanation
The correct answer is "if a >= 22:" because it follows the correct syntax for an if statement in Python. The condition is placed within parentheses and followed by a colon. This format is used to specify the condition that needs to be evaluated, and if it is true, the code block following the colon will be executed.
10.
Which of the following is a valid way to start a function in Python?
Correct Answer
A. Def someFunction():
Explanation
The correct answer is "def someFunction()". In Python, the keyword "def" is used to define a function, followed by the name of the function and parentheses. This is the standard syntax for defining a function in Python.
11.
Which of the following is a valid way to start a while loop in Python?
Correct Answer
B. While a < 10:
Explanation
The correct way to start a while loop in Python is by using the syntax "while a < 10:". The keyword "while" is used to indicate that a loop is being created, followed by the condition that needs to be evaluated. In this case, the condition is "a < 10", which means that the loop will continue executing as long as the value of "a" is less than 10. The ":" at the end of the line indicates the start of the loop block.