Python

Quiz
•
Computers
•
University
•
Medium

Mohamed Ibrahim
Used 6+ times
FREE Resource
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'
Similar Resources on Wayground
10 questions
Python3

Quiz
•
4th Grade - University
10 questions
Stringmethoden in Python

Quiz
•
University
10 questions
2-列表与元组

Quiz
•
University
10 questions
Basics Of C Programming

Quiz
•
University
10 questions
Kuiz Dasar Python

Quiz
•
University
10 questions
04 - Python - Lists

Quiz
•
University - Professi...
10 questions
Datentypen, Variablen & Eingabe in Python

Quiz
•
University
10 questions
Python01

Quiz
•
University
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
9/11 Experience and Reflections

Interactive video
•
10th - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
9 questions
Tips & Tricks

Lesson
•
6th - 8th Grade
Discover more resources for Computers
21 questions
Spanish-Speaking Countries

Quiz
•
6th Grade - University
20 questions
Levels of Measurements

Quiz
•
11th Grade - University
7 questions
Common and Proper Nouns

Interactive video
•
4th Grade - University
12 questions
Los numeros en español.

Lesson
•
6th Grade - University
7 questions
PC: Unit 1 Quiz Review

Quiz
•
11th Grade - University
7 questions
Supporting the Main Idea –Informational

Interactive video
•
4th Grade - University
12 questions
Hurricane or Tornado

Quiz
•
3rd Grade - University
7 questions
Enzymes (Updated)

Interactive video
•
11th Grade - University