Week 8 Programing with python Questions | Prasnya
Prasnya
Continue with Google
Practice path
Dashboard
Exam
Qualifier / Quiz 1
Go to subject
Programing with python
Go to chapter
Week 8
All questions
Give Mock Test
Topic wise questions
Filters
Question type / Difficulty / Years (4)
Question type
4
Difficulty
4
Years
4
Q1
Assume `s` is a `str` variable. What is the type of the expression below? ```python "".join(sorted(set(s.lower()))) ```
Single correct
OCTOBER 26, 2025
OCTOBER 26, 2025
Q2
Consider the following Python code. How many elements will be present in `result`? ``` P = {1, 2, 3, 4} Q = {3, 4, 5, 6} R = {4, 5, 6, 7} S = {2, 4, 6, 8} result = ((P | Q) - R) & S print(result) ```
Integer answer
OCTOBER 26, 2025
OCTOBER 26, 2025
Q3
When will the following code snippet output `True`? ``` word_1 = input() word_2 = input() flag = True if len(word_1) < len(word_2): for ch in word_1: if ch not in word_2: flag = False else: for ch in word_2: if ch not in word_1: flag = False print(flag) ```
Single correct
OCTOBER 27, 2024
OCTOBER 27, 2024
Q4
A programmer wishes to write code that accepts a string `word` as input and computes a list `V` that stores the frequencies of occurrence of the vowels `'aeiou'` in the string. Each element in `V` corresponds to the frequency of one vowel in the string: - `V[0]`: frequency of `'a'` - `V[1]`: frequency of `'e'` - `V[2]`: frequency of `'i'` - `V[3]`: frequency of `'o'` - `V[4]`: frequency of `'u'` Study the two codes given below and determine their correctness for this task. A code is correct only if it is error-free and produces the correct output for any given input. Assume that the input to the code will have only lower-case letters. Code-1 ``` word = input() V = [] for i in range(5): V[i] = 0 vowels = 'aeiou' for char in word: if char in vowels: index = vowels.index(char) V[index] += 1 ``` Code-2 ``` word = input() V = [] for i in range(5): V.append(0) vowels = 'aeiou' for char in word: if char in vowels: index = vowels.index(char) V[index] += 1 ```
Single correct
JUNE 05, 2022
JUNE 05, 2022
Showing 4 questions.