COMPUTER SCIENCE – UNIT 2

Examination Name: COMPUTER SCIENCE - UNIT 2
Date: April 5, 2026
Time allowed: 30 minutes

1. 
Consider the loop given below -

for i in range(7, 4, -2):
break
What will be the final value of 'i' after this loop?Deselect Answer

2. 
Which statement below will terminate the entire loop and proceed to the statement after the loop?
3. 
Observe the following sentences-

i. The partition() and split() functions work similarly.
ii. find() and index() are similar functions.
The correct pair of the true statements is-Deselect Answer

4. 
Note the two Assertion and Reason statements below-

Assertion-(A): If and for are valid statements in Python.
Reason (R): If is case sensitive in Python, and its basic selection and looping statements are lowercase.
The correct option below is-Deselect Answer

5. 
What is meant by the end of a statement block or suit in Python?
6. 
Note the two Assertion and Reason statements below -

Assertion-(A): Lists and strings have similar indexing.
Reason-(R): Lists and strings have two-way indexing, forward indexing, and backward indexing.
The correct option below is-Deselect Answer

7. 
Which of the following statements will only terminate the current pass of the loop and proceed with the next iteration of the loop?
8. 
Observe the following sentences?

i. A continue statement can replace a break statement
ii. An equivalent while loop can always be written for a for loop
The correct pair of which is true?Deselect Answer

9. 
What does the following Python program display?

x= 3
if x = ():
print ("Am I here?", end)
else x = 3:
` print("Or here?", end)
else:
Pass
print ("Or over here?")Deselect Answer

10. 
What will be the output when the code below is executed?

Atr1 = “Mission 999”
Str2 = “999”
Print(str1,isdigit(), str2.isdigit())Deselect Answer

11. 
Which of the following statements will create a selection structure?
12. 
Which below is an entry – controlled loop?
13. 
What is the output of the following string operation?

Str1 = “My roll no. is 12”
Print(str1.isalnum())Deselect Answer

14. 
Consider the loop given below-

for i in range(3):
pass
What will be the final value of 'I’ after this loop?Deselect Answer

15. 
Which of the following will print five rows with five “*” in each row?

(A) for i in range(0,5):
print("*"*i)
(B) for i in range(0,5):
print"*”*5)
(C) for i in range(1,5):
print) (“*” * i)
(D) for i in range (1,5):
print (“*” * 5)Deselect Answer

16. 
Note the following two Assertion and Reason statements

Assertion -(A): Creates a list of any comma-separated group of values.
Reason-(R): A list consists of a group of values or expressions separated by commas enclosed in [].
The correct option below isDeselect Answer

17. 
The blank may be filled in, for a in ___________
18. 
Note the following two assertion and reasion statements-

Assertion:- (A) The for loop is a counting loop that operates on a sequence of values
Reason :- (R) range() function creates a range of list type.
The correct option below is-Deselect Answer

19. 
Which of the following is not a valid loop in Python?
20. 
Which of the following string functions will replace "K' with 'z'?
21. 
Which below is not a valid string operator?
22. 
What will be the output when this code is executed?

x = 1
while (x < = 5) :
            x +=1
print(x)Deselect Answer

23. 
Consider the loop given below-

for i in range (10, 5, 3):
print(i)
How many times will this loop run?Deselect Answer

24. 
Note the two Assertion and Reason statements below-

Assertion-(A): String slices and substrings, although subparts of strings, are not the same.
Reason-(R): While the substring contains a continuous subpart of the string, the slice may or may not contain a continuous subpart of the string.
The correct option below is-Deselect Answer

25. 
Observe the following sentences

i. There is no conceptual limit to list size.
ii. All elements of the list must be of the same type.
iii. A given object can appear in a list more than once.
The correct pair below of which is true is given belowDeselect Answer

26. 
Note the two Assertion and Reason statements below-

Assertion-(A): A slice of a list is an extracted part of a list
Reason-(R) A slice of a list is itself a list.
The correct option below is -Deselect Answer

27. 
The function range(3) is equivalent to -
28. 
Which below is not a valid string operator?
29. 
Note the two Assertion and Reason statements below-

Assertion (A): In Python, unlike other types, the elements of a List can be changed from place to place.
Reason-(R): Lists are mutable sequences
The correct option below is –Deselect Answer

30. 
Note the two Assertion and Reason statements below-

Assertion -(A):””” A Sample Python String""" is a valid Python string.
Reason-(R): Triple quotation marks are not valid in Python.
The correct option below is -Deselect Answer

31. 
Observe the following sentences -

i. A list of characters is similar to a string type
ii. For any index n, s[n] + s[n:] will return the original string
iii. A dictionary can contain keys of any valid Python type
The correct pair of which is false is given below?Deselect Answer

32. 
Which of the following functions will return the last three characters of a string s?
33. 
Note the two Assertion and Reason statements below-

Assertion-(A): The individual characters of a string are stored randomly in memory.
Reason-(R): Python strings are stored consecutively as individual characters in contiguous memory locations.
The correct option below is-Deselect Answer

34. 
Guess the output of the following string operations-

Strl = 'Wah'
print (str1 * 2)Deselect Answer

35. 
If the user inputs 2, what will the following code print?

x = float(input())
if(x = = 1):
print("Yes")
elif (x>=2):
print("Maybe")
else
print ("No")Deselect Answer

36. 
Select the correct output of the following string operations.

str1 = 'Study'
print (str1[:3]+'with' + str1[3:])Deselect Answer

37. 
Consider the loop given below-

for i in range)-5):
Print(i)
How many times will this loop run?Deselect Answer

38. 
When the following code runs, how many times is the line " x = x + 2” executed?

x = 1
while (x<20):
             x= x * 2Deselect Answer

39. 
Which is the Jump statement below?
40. 
How many times is the code below executed?

X=1
while (x <= 5) :
          x + 1
print(x)Deselect Answer

41. 
Which below will add the numbers 1 to 4?

(A) for i in range (1,4):
sum = 0
sum = sum + i
(B) Sum = 0
For i in range (1,4);
Sum = sum + i
(C) For i in range (1,5):
sum = 0
sum = sum + i
(D) Sum = 0 
For i in rangle (1,5);
Sum = sum + iDeselect Answer

42. 
Select the correct output of the following string operations.

str = "my name is SWC"
print (str.capitalize())Deselect Answer

43. 
Observe the following sentences-

i. A for loop can always be written as an equivalent for a while loop.
ii. The Range() function can only be used for for loops.
iii. The if-elif-else statement is equivalent to a nested if statement.
The correct pair of which is false?Deselect Answer

44. 
Consider the loop given below -

What will be the final value of ‘I’ after this loop?
for i in range(10):
breakDeselect Answer

45. 
Which of the following statements will create a repeating structure?
46. 
Note the following two Assertion and Reason statements-

Assertion-(A): The break statement can be used with all selection and iteration statements
Reason-(R): Using break with if statement will not cause an error.
The correct option below is-Deselect Answer

47. 
Which of the following functions will return a list containing all words in a string?
48. 
The correct way to create multi-line string in Python -
49. 
Note the two Assertion and Reason statements below-

Assertion-(A): Only while loops can use break statements.
Reason-(R): Loop while is a conditional loop in Python and terminates when its condition returns false.
The correct option below is-Deselect Answer

50. 
Note the two Assertion and Reason statements below

Assertion-(A): The break statement can be used with all selection and iteration statements.
Reason-(R): Using the break with the 'if’ statement has no benefit unless the if statement is part of a looping construct.
The correct option below is-Deselect Answer

This entry was posted in . Bookmark the permalink.
Open chat
Need help?