Python-Recap 1

Python-Recap 1

9th - 12th Grade

5 Qs

quiz-placeholder

Similar activities

Give Away Quiz

Give Away Quiz

10th Grade

10 Qs

PREPERIODOD 1, TERCER PERIODO

PREPERIODOD 1, TERCER PERIODO

9th Grade

10 Qs

Intro. to ICT

Intro. to ICT

11th - 12th Grade

10 Qs

KHỐI 10 - KT LẦN 2

KHỐI 10 - KT LẦN 2

10th - 12th Grade

10 Qs

TIK KELAS X

TIK KELAS X

9th Grade - Professional Development

10 Qs

Simulation - ICT

Simulation - ICT

KG - Professional Development

10 Qs

Lenguaje de programación P2

Lenguaje de programación P2

12th Grade

10 Qs

susulan dasar osiloskop

susulan dasar osiloskop

11th Grade

10 Qs

Python-Recap 1

Python-Recap 1

Assessment

Quiz

Instructional Technology

9th - 12th Grade

Practice Problem

Medium

Created by

Zubaidah Shaheen

Used 3+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

5 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Which Python code segment will display “Hello, world!” on the screen?

"Hello, world!"

print "Hello, world!"

print("Hello, world!")

display Hello, world!

Answer explanation

The correct choice is 'print("Hello, world!")' because it uses the print function with parentheses, which is the proper syntax in Python 3 to display text on the screen.

2.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

What does the following Python code display?

print("Hello")

print("World")

HelloWorld

Hello

World

Hello World

World

Hello

Answer explanation

The code prints 'Hello' on one line and 'World' on the next line. Therefore, the output is 'Hello' followed by 'World', making the correct answer 'Hello' and 'World'.

3.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

What type is the following variable?

x = "Hi there"

float

integer

boolean

string

Answer explanation

The variable x is assigned the value "Hi there", which is enclosed in double quotes. This indicates that x is a string type, as strings are sequences of characters. Therefore, the correct answer is string.

4.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

What is the type of the variable x in the following Python program?

x = input("Enter something: ")

integer

string

float

boolean

Answer explanation

In Python, the input() function always returns data as a string, regardless of what the user enters. Therefore, the variable x will be of type string.

5.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

What can you use to make the user enter numbers?

int(input("enter a number"))

print(int("enter a number"))

input("enter a number")

int(input "enter a number")

Answer explanation

The correct choice, int(input("enter a number")), combines input() to prompt the user and int() to convert the input string to an integer, ensuring the user enters a number. The other options are incorrect or incomplete.