Python Basics: Constants, Variables, and More

Python Basics: Constants, Variables, and More

9th Grade

10 Qs

quiz-placeholder

Similar activities

String Manipulation

String Manipulation

9th - 11th Grade

13 Qs

Unit 7 quiz on strings AP CSP

Unit 7 quiz on strings AP CSP

9th - 12th Grade

14 Qs

CodeHS Lessons 2.1 - 2.5

CodeHS Lessons 2.1 - 2.5

8th - 12th Grade

11 Qs

CodeHS Python

CodeHS Python

7th - 12th Grade

10 Qs

Python Programming

Python Programming

6th - 12th Grade

9 Qs

Y9 Homework 1: Python Revisited 1

Y9 Homework 1: Python Revisited 1

9th Grade

13 Qs

Python - 01

Python - 01

9th - 12th Grade

10 Qs

Java Script Quiz

Java Script Quiz

9th - 12th Grade

15 Qs

Python Basics: Constants, Variables, and More

Python Basics: Constants, Variables, and More

Assessment

Quiz

Computers

9th Grade

Medium

Created by

Martin Bishell

Used 1+ times

FREE Resource

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is a correct way to define a constant in Python?

`const PI = 3.14`

`PI = 3.14`

`constant(PI) = 3.14`

`#define PI 3.14`

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the correct way to declare a variable `x` with the value `10` in Python?

`int x = 10`

`x := 10`

`x = 10`

`var x = 10`

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is used to print a message in Python?

`print("Hello, World!")`

`echo "Hello, World!"`

`System.out.println("Hello, World!")`

`printf("Hello, World!")`

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following data types does not exist in Python?

`list`

`tuple`

`array`

`set`

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you concatenate two strings, `a` and `b`, in Python?

`a + b`

`a.concat(b)`

`concat(a, b)`

`a & b`

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code snippet? `print("Python"[1:3])`

`Pyt`

`yth`

`yt`

`tho`

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is the correct way to convert the string `"123"` to an integer in Python?

`int("123")`

`parseInt("123")`

`"123".toInt()`

`convert.toInt("123")`

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?