Prasnya
Prasnya
Prasnya
Continue with Google
Prasnya
Continue with Google
Week 1 Programming in Python Questions | Prasnya
Programming in Python > Week 1
All PYQs
Topic-Wise PYQs
Start Weekly Test
Mock tests
Week mock
Topic mock
Subject mock
Type:
All
Difficulty:
All
Year:
All
21Q
01
Consider the following Python code. What will be the output? ``` s = "programming" print(s[::-1].replace("g", "#")) ```
Single correct
EASY
3 marks
26 October 2025
02
Consider the following code: ``` text = " >>> Hello, Python! <<< " to_strip = " <>" A = text.strip(to_strip) B = text.lstrip(to_strip) C = text.rstrip(to_strip) D = text.strip() print(A) print(B) print(C) print(D) ``` Which of the following is the correct output?
Single correct
MEDIUM
3 marks
13 July 2025
03
What is the output of the following snippet of code? ``` s = 1 <= 2 <= 3 print(type(s)) ```
Single correct
EASY
3 marks
23 February 2025
04
What is the output of the following snippet of code? Enter an integer as your answer. ``` str1 = "New year" str2 = "day" str3 = str1[:3] + " " + str2[:] # There is a single space between the quotes print(len(str3)) ```
Numerical
EASY
3 marks
23 February 2025
05
What is the value of `a`, the first input entered by the user, if it is given that the user entered a positive integer?
Comprehension
EASY
2 marks
23 February 2025
06
What is the value of `b`, the second input entered by the user, if it is given that the user entered a negative integer?
Comprehension
MEDIUM
2 marks
23 February 2025
07
Consider the input for the first line of the following code snippet to be `"abcd"`, and select the correct option from the choices below. ``` word = input() new_word = word[0::2] + "-" new_word += word[1::2] print(new_word) ```
Single correct
EASY
3 marks
27 October 2024
08
What will be the output of the following code snippet? Enter an integer as your answer. ``` words = ['Learning', 'Python', 'is', 'fun'] final_str = ' ' # Single Space final_str = final_str.join(words) final_str.strip("osle") print(len(final_str)) ```
Numerical
EASY
3 marks
27 October 2024
09
What is the first line of output?
Comprehension
MEDIUM
3 marks
27 October 2024
10
What is the second line of the output? Enter an integer as your answer.
Comprehension
EASY
3 marks
27 October 2024
11
What is the output of the following snippet of code? Snippet-1: ``` s = 3 >= 2 >= 1 print(type(s)) ```
Single correct
EASY
3 marks
07 July 2024
12
What is the output of the following snippet of code? Enter an integer as your answer. ``` str1 = "Paradox" str2 = "Celebration" str3 = str1 + " " + str2[:6] # There is single space in between quote print(len(str3)) ```
Numerical
EASY
3 marks
07 July 2024
13
What is the value of `a`, the first input entered by the user, if it is given that the user entered a positive integer?
Comprehension
EASY
3 marks
07 July 2024
14
What is the value of `b`, the second input entered by the user, if it is given that the user entered a negative integer?
Comprehension
MEDIUM
3 marks
07 July 2024
15
Three of the following codes print the same output, while one prints a different output. Which of the following code prints a different output from the other three? Hint: `str(x)` converts `x` into a string. `'3' * 2` evaluates to `'33'`.
Single correct
MEDIUM
4 marks
29 October 2023
16
`string` is a non-empty string. What does the following code print? ``` # Hint: char.isalpha() returns True if char is an alphabet # it returns False otherwise count = 0 for char in string: if char in "aeiou": count += 1 elif char.isalpha(): count -= -1 print(count) ```
Single correct
EASY
3 marks
29 October 2023
17
What is the output of the following snippet of code? ``` x = '1' + '2' + '3' print(x) ```
Single correct
EASY
3 marks
29 October 2023
18
What is the output of the following snippet of code? ``` word = 'claustrophobic' size = len(word) count = 0 for x in range(size): if word[x] in 'aeiou': if x % 2 == 0: count = count + 1 print(count) ```
Numerical
MEDIUM
4 marks
29 October 2023
19
What is the output of the following code? ``` str1 = "Python" str2 = "Programming" str3 = str1 + " " + str2[:8] # There is single space in between quotes print(len(str3)) ```
Single correct
EASY
2 marks
16 July 2023
20
Consider the following code snippet. What will be the output if the input `days` is
437
437
437
? ``` days = int(input()) years = days // 365 weeks = (days % 365) // 7 remaining_days = (days % 365) % 7 print("Years:", years) print("Weeks:", weeks) print("Days:", remaining_days) ```
Single correct
EASY
2 marks
16 July 2023
21
Let `n` be some positive integer and `word` be some string. Both `n` and `word` are already defined. The following code snippet and output are given. Select all possible values that the string `word` can take. Note that each option is associated with a different value of `n`. Code: ``` # n and word are already defined out = '' # there is no space between the quotes for i in range(n): out = out + word print(out) ``` Output: ``` kindkindkindkindkindkind ```
Multiple correct
MEDIUM
4 marks
05 June 2022
Showing 21 questions.
Programming in Python > Week 1
All PYQs
Topic-Wise PYQs
Start Weekly Test
Mock tests
Week mock
Topic mock
Subject mock
Type:
All
Difficulty:
All
Year:
All
21Q
01
Consider the following Python code. What will be the output? ``` s = "programming" print(s[::-1].replace("g", "#")) ```
Single correct
EASY
3 marks
26 October 2025
02
Consider the following code: ``` text = " >>> Hello, Python! <<< " to_strip = " <>" A = text.strip(to_strip) B = text.lstrip(to_strip) C = text.rstrip(to_strip) D = text.strip() print(A) print(B) print(C) print(D) ``` Which of the following is the correct output?
Single correct
MEDIUM
3 marks
13 July 2025
03
What is the output of the following snippet of code? ``` s = 1 <= 2 <= 3 print(type(s)) ```
Single correct
EASY
3 marks
23 February 2025
04
What is the output of the following snippet of code? Enter an integer as your answer. ``` str1 = "New year" str2 = "day" str3 = str1[:3] + " " + str2[:] # There is a single space between the quotes print(len(str3)) ```
Numerical
EASY
3 marks
23 February 2025
05
What is the value of `a`, the first input entered by the user, if it is given that the user entered a positive integer?
Comprehension
EASY
2 marks
23 February 2025
06
What is the value of `b`, the second input entered by the user, if it is given that the user entered a negative integer?
Comprehension
MEDIUM
2 marks
23 February 2025
07
Consider the input for the first line of the following code snippet to be `"abcd"`, and select the correct option from the choices below. ``` word = input() new_word = word[0::2] + "-" new_word += word[1::2] print(new_word) ```
Single correct
EASY
3 marks
27 October 2024
08
What will be the output of the following code snippet? Enter an integer as your answer. ``` words = ['Learning', 'Python', 'is', 'fun'] final_str = ' ' # Single Space final_str = final_str.join(words) final_str.strip("osle") print(len(final_str)) ```
Numerical
EASY
3 marks
27 October 2024
09
What is the first line of output?
Comprehension
MEDIUM
3 marks
27 October 2024
10
What is the second line of the output? Enter an integer as your answer.
Comprehension
EASY
3 marks
27 October 2024
11
What is the output of the following snippet of code? Snippet-1: ``` s = 3 >= 2 >= 1 print(type(s)) ```
Single correct
EASY
3 marks
07 July 2024
12
What is the output of the following snippet of code? Enter an integer as your answer. ``` str1 = "Paradox" str2 = "Celebration" str3 = str1 + " " + str2[:6] # There is single space in between quote print(len(str3)) ```
Numerical
EASY
3 marks
07 July 2024
13
What is the value of `a`, the first input entered by the user, if it is given that the user entered a positive integer?
Comprehension
EASY
3 marks
07 July 2024
14
What is the value of `b`, the second input entered by the user, if it is given that the user entered a negative integer?
Comprehension
MEDIUM
3 marks
07 July 2024
15
Three of the following codes print the same output, while one prints a different output. Which of the following code prints a different output from the other three? Hint: `str(x)` converts `x` into a string. `'3' * 2` evaluates to `'33'`.
Single correct
MEDIUM
4 marks
29 October 2023
16
`string` is a non-empty string. What does the following code print? ``` # Hint: char.isalpha() returns True if char is an alphabet # it returns False otherwise count = 0 for char in string: if char in "aeiou": count += 1 elif char.isalpha(): count -= -1 print(count) ```
Single correct
EASY
3 marks
29 October 2023
17
What is the output of the following snippet of code? ``` x = '1' + '2' + '3' print(x) ```
Single correct
EASY
3 marks
29 October 2023
18
What is the output of the following snippet of code? ``` word = 'claustrophobic' size = len(word) count = 0 for x in range(size): if word[x] in 'aeiou': if x % 2 == 0: count = count + 1 print(count) ```
Numerical
MEDIUM
4 marks
29 October 2023
19
What is the output of the following code? ``` str1 = "Python" str2 = "Programming" str3 = str1 + " " + str2[:8] # There is single space in between quotes print(len(str3)) ```
Single correct
EASY
2 marks
16 July 2023
20
Consider the following code snippet. What will be the output if the input `days` is
437
437
437
? ``` days = int(input()) years = days // 365 weeks = (days % 365) // 7 remaining_days = (days % 365) % 7 print("Years:", years) print("Weeks:", weeks) print("Days:", remaining_days) ```
Single correct
EASY
2 marks
16 July 2023
21
Let `n` be some positive integer and `word` be some string. Both `n` and `word` are already defined. The following code snippet and output are given. Select all possible values that the string `word` can take. Note that each option is associated with a different value of `n`. Code: ``` # n and word are already defined out = '' # there is no space between the quotes for i in range(n): out = out + word print(out) ``` Output: ``` kindkindkindkindkindkind ```
Multiple correct
MEDIUM
4 marks
05 June 2022
Showing 21 questions.