Python Revision Quiz

Python Revision Quiz

12th Grade

19 Qs

quiz-placeholder

Similar activities

PCEP Section 4D: Basics of Python Exception Handling

PCEP Section 4D: Basics of Python Exception Handling

12th Grade

15 Qs

Python String

Python String

12th Grade

20 Qs

python_1

python_1

5th - 12th Grade

22 Qs

ULANGAN TIK KELAS 7

ULANGAN TIK KELAS 7

12th Grade

20 Qs

Python Built-in Functions

Python Built-in Functions

11th - 12th Grade

15 Qs

Python Review

Python Review

9th - 12th Grade

16 Qs

BTEC L2 Unit 1 Online World 1-8

BTEC L2 Unit 1 Online World 1-8

11th - 12th Grade

15 Qs

Java Math Review

Java Math Review

9th - 12th Grade

18 Qs

Python Revision Quiz

Python Revision Quiz

Assessment

Quiz

Computers

12th Grade

Medium

Created by

VIJITHA M

Used 5+ times

FREE Resource

19 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

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?

Discover more resources for Computers