
Q4 Finals ICT10 General Quiz
Authored by JOHN MARK DIPON
Computers
10th Grade
Used 3+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 5 pts
What is the correct way to create a string variable in Python?
var = "Hello"
var = Hello
var = (Hello)
var = [Hello]
Answer explanation
The correct way to create a string variable in Python is by using var = "Hello". This assigns the value Hello to the variable var enclosed in double quotes.
2.
MULTIPLE CHOICE QUESTION
30 sec • 5 pts
How do you add two numbers and assign the result to a variable in Python?
result = num1 * num2
result = num1 / num2
result = num1 + num2
result = num1 - num2
Answer explanation
To add two numbers and assign the result to a variable in Python, you use the expression result = num1 + num2.
3.
MULTIPLE CHOICE QUESTION
30 sec • 5 pts
What is an example of a string literal in Python?
42
"Hello, world!"
3.14
[1, 2, 3]
Answer explanation
An example of a string literal in Python is "Hello, world!". It is enclosed in double quotes and represents a sequence of characters.
4.
MULTIPLE CHOICE QUESTION
30 sec • 5 pts
How do you comment a single line in Python?
Using /* comment */
Using <!-- comment -->
Using # comment
Using // comment
Answer explanation
In Python, a single line comment is denoted by using the hash symbol (#) before the comment text. This symbol tells Python to ignore everything that comes after it on the same line.
5.
MULTIPLE CHOICE QUESTION
30 sec • 5 pts
Which function converts a string to an integer in Python?
str()
int()
float()
bool()
Answer explanation
The function that converts a string to an integer in Python is int().
6.
MULTIPLE CHOICE QUESTION
30 sec • 5 pts
How do you concatenate two strings in Python?
str1 - str2
str1 + str2
str1 * str2
str1 / str2
Answer explanation
To concatenate two strings in Python, you use the '+' operator. Therefore, the correct choice is str1 + str2.
7.
MULTIPLE CHOICE QUESTION
30 sec • 5 pts
What is the correct syntax for defining a function in Python?
def function_name[]:
def function_name():
def function_name{}:
def function_name<>:
Answer explanation
The correct syntax for defining a function in Python is 'def function_name():'. The function name is followed by parentheses and a colon.
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?