Python Revision Quiz

Python Revision Quiz

12th Grade

25 Qs

quiz-placeholder

Similar activities

1ºDAM/DAW - Entornos de Desarrollo - UD1-6 - Prof. C. Boni

1ºDAM/DAW - Entornos de Desarrollo - UD1-6 - Prof. C. Boni

University - Professional Development

20 Qs

PARC Linux Basic Part 2

PARC Linux Basic Part 2

University

20 Qs

Visual Basic Assessment

Visual Basic Assessment

11th - 12th Grade

21 Qs

CORLANG Week6-7

CORLANG Week6-7

10th Grade - University

20 Qs

Chapter 8. Securing Network Media and Devices

Chapter 8. Securing Network Media and Devices

University

20 Qs

Quiz No. 3 (Finals)

Quiz No. 3 (Finals)

University

20 Qs

QUIZ 1(SSAD)

QUIZ 1(SSAD)

University

20 Qs

Lesson 1 and 2 Quiz

Lesson 1 and 2 Quiz

University

20 Qs

Python Revision Quiz

Python Revision Quiz

Assessment

Quiz

Computers

12th Grade

Practice Problem

Medium

Created by

VIJITHA M

Used 6+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

25 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Dictionaries in Python are mutable but Strings are immutable.

True

False

Answer explanation

Dictionaries in Python can be changed after creation (mutable), while strings cannot be altered once created (immutable). Therefore, the statement is true.

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

str="R and Data Science"

z=str.split()

newstr="=".join([z[2].upper(),z[3],z[2]+z[3],z[1].capitalize()])

newstr is equal to

'DATA=Science=DataScience=And'

'DATA=DataScience=And'

'DATA=Science=And'

'DATA=Science==DataScience=And'

Answer explanation

The string is split into words: ['R', 'and', 'Data', 'Science']. The new string is formed by joining the uppercase of 'Data', 'Science', the concatenation of 'Data' and 'Science', and the capitalized 'and', resulting in 'DATA=Science=DataScience=And'.

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Consider the given expression:

True and not AAA and not True or True

Which of the following will be correct output if the given expression is evaluated

with AAA as False?

True

False

NONE

NULL

Answer explanation

Evaluating the expression with AAA as False: True and not False and not True or True simplifies to True and True and False or True, which further simplifies to True or True, resulting in True.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What shall be the output of the following statement?

“TEST”.split(‘T’,1)

[ ‘ ‘, ’ ES ’ ,’ ‘ ]

[ ‘T’, ’ ES ’ ,’T’]

[ ‘ ‘, ‘ EST ’]

Error

Answer explanation

The statement 'TEST'.split('T', 1) splits the string at the first occurrence of 'T'. It results in [' ', 'EST'], where the first part is before 'T' and the second part is after. Thus, the correct output is [' ', 'EST'].

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What shall be the output for the execution of the following statement? “ANTARTICA”.strip(‘A’)

NTRCTIC

[‘ ‘, ‘NT’, ‘RCTIC’, ‘ ‘]

'NTARTIC'

Error

Answer explanation

The method strip('A') removes 'A' characters from both ends of the string 'ANTARTICA'. The result is 'NTARTIC', as the leading and trailing 'A's are stripped, making 'NTARTIC' the correct output.

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Consider The following: t=(12,13,14,16,[2,3])

What changes will be made in t after the execution of the following statement?

t.append(4)

t=(12,13,14,16,[2,3],4)

t= (12,13,14,16,[2,3,4])

t=(4,12,13,14,16,12,3)

It will give an error

Answer explanation

The tuple 't' is immutable in Python, meaning you cannot change it after creation. Attempting to use 't.append(4)' will result in an AttributeError, as tuples do not have an 'append' method. Thus, it will give an error.

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

0

1

2

Error

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?