String Basics Quiz

String Basics Quiz

7th Grade

12 Qs

quiz-placeholder

Similar activities

chris_gone_crazy

chris_gone_crazy

6th - 7th Grade

10 Qs

Year 7 - Bohunt E-Mail

Year 7 - Bohunt E-Mail

7th Grade

10 Qs

Computer Hardware - CPU & GPU

Computer Hardware - CPU & GPU

7th Grade - University

16 Qs

6th to 19th Century

6th to 19th Century

7th Grade

11 Qs

Editing Tools

Editing Tools

7th Grade

12 Qs

Pengolah Angka

Pengolah Angka

7th Grade

10 Qs

Test Your Knowledge Part One

Test Your Knowledge Part One

1st - 12th Grade

15 Qs

Youtubers Charlie.C-J

Youtubers Charlie.C-J

3rd - 9th Grade

10 Qs

String Basics Quiz

String Basics Quiz

Assessment

Quiz

Computers

7th Grade

Hard

Created by

Mr A Sheik

Used 10+ times

FREE Resource

12 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you declare a string variable `name` that contains your name "Alex" in Python?

`name = Alex`

`name = 'Alex'`

`string name = "Alex"`

`var name = "Alex"`

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code? ```python print("Hello, " + "world!") ```

Hello world!

Hello, world

Hello, world!

"Hello, " + "world!"

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is the correct way to use the input function to get a user's name and store it in a variable called `user_name`?

`user_name = input("What is your name?")`

`input("What is your name?") -> user_name`

`user_name <- input("What is your name?")`

`get("What is your name?", user_name)`

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you concatenate the strings `str1 = "Hello"` and `str2 = "World"` to print out "Hello World"?

`print("str1 str2")`

`print(str1 + " " + str2)`

`print(str1, str2)`

`print(str1.str2)`

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code? ```python name = "Alice" print("Hello, name!") ```

Hello, Alice!

Hello, name!

Hello, + name + !

SyntaxError

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is the correct way to print a string across multiple lines?

`print("Line 1 \nLine 2")`

`print("Line 1 // Line 2")`

`print("Line 1 \Line 2")`

`print("Line 1" + "Line 2")`

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you correctly capture an input with the prompt "Enter your age:" and convert it to an integer?

`age = int(input("Enter your age:"))`

`age = input(int("Enter your age:"))`

`int age = input("Enter your age:")`

`age = input("Enter your age:").toInt()`

Create a free account and access millions of resources

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

By signing up, you agree to our Terms of Service & Privacy Policy

Already have an account?