
Sample Paper on Python Programming
Authored by Bhuvi Eswari
Computers
12th Grade
Used 3+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
12 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following functions will return the string with every ‘P’ replaced with a ‘z’ ?
find()
index()
replace()
split()
Answer explanation
The correct function is 'replace()' because it is specifically designed to replace occurrences of a specified substring in a string with another substring. In this case, it will replace every 'P' with 'z'.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
The elements of a list are arranged in descending order. Which of the following two will give same outputs?
print(list_name.sort())
print(max(list_name))
print(list_name.reverse())
print(list_name[-1])
Answer explanation
In a descending ordered list, 'print(max(list_name))' returns the first element (largest), while 'print(list_name[-1])' returns the last element (smallest). Thus, 'print(max(list_name))' is the only correct choice that gives the same output.
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is/ are not legal string operators?
in
+
*
/
Answer explanation
The 'in' operator checks for membership in a collection, not a string operation. The '+' operator concatenates strings, '*' is used for repetition, and '/' is not a string operator. Thus, 'in' is the only non-legal string operator.
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Assertion(A): Assigning a list name to a new name does not create a true copy of a list rather it just creates an alias. Reasoning(R): An alias simple refers to the old list with a new name, while a true copy creates a new list with a different memory location.
Both A and R are true and R is the correct explanation for A
Both A and R are true and R is not the correct explanation for A
A is True but R is False
A is false but R is True
Answer explanation
Both the assertion and reasoning are true. The assertion correctly states that assigning a list to a new name creates an alias, and the reasoning explains that an alias refers to the same memory location, confirming the assertion.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Assertion (A): String slices and substring both are extracted subparts of a string. Reasoning(R): String slices and substrings mean the same.
Both A and R are true and R is the correct explanation for A
Both A and R are true and R is not the correct explanation for A
A is True but R is False
A is false but R is True
Answer explanation
Assertion A is true as both string slices and substrings are parts of a string. However, reasoning R is false because string slices and substrings are not the same; slices can include a range, while substrings are contiguous characters.
6.
OPEN ENDED QUESTION
3 mins • 1 pt
Given a string S, write expressions to print i. First five characters of S ii. Ninth characters of S iii. Reversed S iv. Alternate characters from reversed S OR What is the difference between sort and sorted function in list.
Evaluate responses using AI:
OFF
Answer explanation
To extract parts of string S: i. S[:5] for first five characters, ii. S[8] for the ninth character, iii. S[::-1] for reversed S, iv. S[::-2] for alternate characters from reversed S. For sorting, 'sort()' modifies the list in place, while 'sorted()' returns a new sorted list.
7.
OPEN ENDED QUESTION
3 mins • 1 pt
What is the difference between split() and partition () functions?
Evaluate responses using AI:
OFF
Answer explanation
The split() function divides a string into a list based on a specified delimiter, while partition() splits a string into a tuple of three parts: the part before the delimiter, the delimiter itself, and the part after.
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
10 questions
Impresa e siti web
Quiz
•
8th - 12th Grade
15 questions
Class XI Basics
Quiz
•
11th - 12th Grade
17 questions
Security and Ethics
Quiz
•
9th - 12th Grade
13 questions
INTERNET CONNECTION
Quiz
•
12th Grade
14 questions
[Lớp 12] Access - Ôn tập
Quiz
•
12th Grade
15 questions
Problem Solving : Design Solution
Quiz
•
12th Grade
15 questions
Virtual Private Server
Quiz
•
12th Grade
15 questions
Imagen GIMP
Quiz
•
9th - 12th Grade
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
10 questions
Probability Practice
Quiz
•
4th Grade
15 questions
Probability on Number LIne
Quiz
•
4th Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
6 questions
Appropriate Chromebook Usage
Lesson
•
7th Grade
10 questions
Greek Bases tele and phon
Quiz
•
6th - 8th Grade