Search Header Logo

Python Function Quiz

Authored by Adham Elmuntser

Computers

1st Grade

Used 1+ times

Python Function Quiz
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

26 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

In the given get_name function, which method is used to remove leading and trailing spaces?

trim()

strip()

clean()

remove()

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will get_password function print if the entered password is '12345'?

Password is valid.

Please enter a valid number for your age.

Password must be at least 6 characters long.

Invalid input! Please enter a number.

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

In the get_age function, what is the purpose of the try block?

To convert the age to a float.

To handle cases where input is not an integer.

To compare the age with 120.

To check the length of the input.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which function is used to check if a file path exists in get_file_path?

os.path.isfile()

os.path.ispath()

os.path.exists()

os.path.check()

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

In the get_email function, which characters are checked to validate the email?

@ and #

@ and .

. and !

# and .

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will the get_credit_card_number function output if the input is '123456789012345'?

Invalid credit card number. It should be 16 digits.

Credit card number is valid.

Please enter a valid number for your age.

Name cannot be empty!

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following functions is used to change the input to lowercase in the get_confirmation function?

lower()

to_lower()

downcase()

lowercase()

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?