0% found this document useful (0 votes)
53 views2 pages

Xicomp SC Pt3432

Uploaded by

moammed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views2 pages

Xicomp SC Pt3432

Uploaded by

moammed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

SAMPLE PAPER

General Instruction:
(a). Make sure to follow a sequence while writing.
(b). Paper is divided into three sections i.e. A, B and C
(c). Section A contains VERY Short Answer Type questions of 5 marks
(d). Section B contains Short Answer Type Questions of 10 marks with internal choices
(e). Section C contains Long Answer Type Questions of 10 marks

SECTION A (VERY SHORT ANSWER TYPE)-5 MARKS


Q1. Which of the following functions will return the string with every ‘P’ replaced with a ‘z’ ? 1
a. find() b. index()
c. replace() d. split()
Q2. The elements of a list are arranged in descending order. Which of the following two will 1
give same outputs?
i. print(list_name.sort()) ii. print(max(list_name))
iii. print(list_name.reverse()) iv. print(list_name[-1])
Q3. Which of the following is/ are not legal string operators? 1
a) in b) +
c) * d) /
e)
Q4 and Q5 are ASSERTION AND REASONING based questions. Mark the correct choice as
A) Both A and R are true and R is the correct explanation for A
B) Both A and R are true and R is not the correct explanation for A
C) A is True but R is False
D) A is false but R is True
Q4. Assertion(A): Assigning a list name to a new name does not create a true copy of a list 1
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.
Q5. Assertion (A): String slices and substring both are extracted subparts of a string. 1
Reasoning(R): String slices and substrings mean the same.
SECTION B (SHORT ANSWER TYPE QUESTIONS)- 10 MARKS
Q6. Given a string S, write expressions to print 2
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.
Q7. What is the difference between split() and partition () functions? 2
Q8. Predict an output of the following: 2
x=’hello world’
print(x[:2],x[:-2],x[-2:])
print(x[6],x[2:4])
print(x[2:-3],x[-4:-2])
OR
Predict an output of the following:
my_lst:-[‘p’,’r’,’o’,’b’,’l’,’e’,’m’]
my_lst[2:3]=[]
print(my_lst)
my_lst[2:5]=[]
print(my_lst)
Q9. An index out of bounds given with a list name causes error, but not with a list slices. Why? 2
Q10. Start with the list [8,9,10]. Do the following using list functions 2
a. Remove the second entry from the list
b. Double the list
c. Add 4,5 and 6 to the end of the list
d. Sort the list
SECTION C (LONG ANSWER TYPE QUESTIONS)- 10 MARKS
Q11. A. Write a program in Python that consider any list of numbers and finds out the 4
product of all unique numbers. As an example [2+2]
If the list is [2,3,4,1,2,6,5,3,4,7], result will be 5x1x6x7 = 210
B. Write a program that takes a sentence as an input where each word in the sentences
is separated by a space the function should replace each blank with a hyphen and
then print the modified sentences.
Q12. A. Write a program in list which considers any list of numbers and remove all the 6
occurrence of an element from a list. [3+3]
B. Write a program which replaces all vowels in the string with ‘*’ and print the new
string

You might also like