Python
Quiz
•
Computers
•
University
•
Practice Problem
•
Medium
Mohamed Ibrahim
Used 6+ times
FREE Resource
Enhance your content in a minute
5 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
A program to print every character of a string entered by user in a new line using loop.
Choose the correct answer
a = raw_input()
for a in i:
print i
a = string_input()
for i in a:
print i
a = string_input()
for i in a:
print a
a = raw_input()
for i in a:
print i
2.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
Choose the correct answer:
A program to find the length of the string "refrigerator" without using len function.
a = "refrigerator"
count = 1
for i in a:
count = count+1
print count
a = "refrigerator"
count = 0
for i in a:
count = count+1
print count
a = "refrigerator"
for i in a:
count = 0
count = count+1
print count
a = "refrigerator"
count = 1
for i in a:
count = count+a[i]
print count
3.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
Choose the correct answer:
A program to check if the word 'orange' is present in the "This is orange juice".
a = "This is orange juice"
print 'orange' in a
a = "This is orange juice"
print 'Orange' in a.split()
a = "This is orange juice"
print 'orange' in a.split()
a = "This is orange juice"
print 'orange' is a.split()
4.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
What is the output for the following code:
def char_frequency(str1):
dict = {}
for n in str1:
keys = dict.keys()
if n in keys:
dict[n] += 1
else:
dict[n] = 1
return dict
print(char_frequency('google.com'))
{'o': 0, '.': 1, 'g': 2, 'l': 1, 'e': 1, 'c': 2, 'm': 0}
{'o': 5, '.': 1, 'g': 2, 'l': 1, 'e': 1, 'c': 2, 'm': 1}
{'o': 3, '.': 1, 'g': 2, 'l': 1, 'e': 1, 'c': 0, 'm': 0}
{'o': 3, '.': 1, 'g': 2, 'l': 1, 'e': 1, 'c': 1, 'm': 1}
5.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
Given your function, what is the correct output:
def chars_mix_up(a, b):
new_a = b[:2] + a[2:]
new_b = a[:2] + b[2:]
return new_a + ' ' + new_b
print(chars_mix_up('abc', 'xyz'))
Sample String : 'abc', 'xyz'
Expected Result : 'xyc abz'
Sample String : 'abc', 'xyz'
Expected Result : 'xbc ayz'
Sample String : 'abc', 'xyz'
Expected Result : 'xyc abc'
Sample String : 'abc', 'xyz'
Expected Result : 'ayc xbz'
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
Software Testing
Quiz
•
University
10 questions
Hệ Điều Hành Của Máy Tính
Quiz
•
10th Grade - University
10 questions
C++ Array Quiz
Quiz
•
University
10 questions
paquetes contables lección 1
Quiz
•
11th Grade - Professi...
10 questions
Sistema Binario
Quiz
•
1st Grade - University
10 questions
Node.js
Quiz
•
University
10 questions
PHP Introduction - Assignment 1
Quiz
•
University
10 questions
margaret hamilton
Quiz
•
University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
