Search Header Logo

python basic

Authored by KEERTHI BADUGU

Computers

Professional Development

Used 6+ times

python basic
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

21 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is used to create a single-line comment in Python?

  • a) // This is a comment

  • b) # This is a comment

  • c) /* This is a comment */

  • d) <!-- This is a comment -->

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is a valid variable name in Python?

  • a) 1variable

  • b) variable1

  • c) variable-1

  • d) variable 1

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is a mutable data type in Python?

  • a) tuple

  • b) list

  • c) str

  • d) int

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is the correct syntax for an if statement in Python?

  • a) if x == 10 then:

  • b) if (x == 10):

  • c) if x == 10:

  • d) if x = 10:

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you create an infinite loop in Python?

  • a) while (true):

  • b) while True:

  • c) for(;;):

  • d) while (1):

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you define a function in Python?

  • a) function my_function():

  • b) def my_function():

  • c) define my_function():

  • d) func my_function():

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is the correct way to open a file for reading in Python?

  • a) open('filename', 'r')

  • b) open('filename', 'w')

  • c) open('filename', 'rw')

  • d) open('filename', 'read')

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?