Discovery Python

Discovery Python

University

10 Qs

quiz-placeholder

Similar activities

Python modules, operators and random

Python modules, operators and random

University

15 Qs

Python-loops, branches, functions

Python-loops, branches, functions

University

15 Qs

Intro-Computacao_3.2

Intro-Computacao_3.2

University

10 Qs

Python - Introduction

Python - Introduction

University

13 Qs

T02: Python - The Basics

T02: Python - The Basics

University

10 Qs

Python Conditional Statements

Python Conditional Statements

University

8 Qs

Diagnóstico python

Diagnóstico python

University

10 Qs

ASK F2 -KOD ARAHAN (PYTHON)

ASK F2 -KOD ARAHAN (PYTHON)

1st Grade - University

15 Qs

Discovery Python

Discovery Python

Assessment

Quiz

Computers

University

Medium

Created by

Ayman Marzouk

Used 3+ times

FREE Resource

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the following shell command do?

echo 'print("Hello, World!")'

  • Executes the Python script hello_world.py.

Saves the text print("Hello, World!") to a file.

Prints the text print("Hello, World!") in the terminal.

Converts the text to uppercase.

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How would you run a Python script named age.py from the terminal?

run age.py

python3 age.py

Both b and c

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will this Python script print?

age = 25

print(f"In 42 years, you will be {age + 42}")

In 42 years, you will be 42

In 42 years, you will be 67

In 42 years, you will be 25

Throws a syntax error.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will the following Python snippet do?

number = float(input("Enter a number: "))

if number == 0:

print("The number is zero.")

else:

print("The number is non-zero.")

Always prints "The number is zero."

Always prints "The number is non-zero."

Checks if the input is zero or non-zero and prints the respective message.

Raises an error if the input is not a valid number.

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the result of this Python code?

word = "Python"

print(word.upper())

  • PYTHON

python

Throws an error.

Python

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will this Python code output?

number = 5

while number < 10:

print(number)

number += 2

5 7 9

5 6 7 8 9

5 7 9 11

Infinite loop.

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does this Python snippet do?

password = "letmein"

entered_password = input("Enter your password: ")

if entered_password == password:

print("Access Granted")

else:

print("Access Denied")

Compares the entered password with password and prints the respective message.

Throws an error because input is not defined.

Always prints "Access Granted."

Always prints "Access Denied."

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?