Python

Python

University

5 Qs

quiz-placeholder

Similar activities

Que son los mainframes?

Que son los mainframes?

University

10 Qs

Visual Basic 2010

Visual Basic 2010

8th Grade - University

10 Qs

Cuestionario Steve Jobs

Cuestionario Steve Jobs

12th Grade - University

10 Qs

Website Usability and UX

Website Usability and UX

University

10 Qs

Python Week 1 & 2

Python Week 1 & 2

University

10 Qs

Pint of Science Carballo Día 3

Pint of Science Carballo Día 3

University

10 Qs

Quiz 1: The background and history of IoT

Quiz 1: The background and history of IoT

University

10 Qs

Justicia Social en un mundo digitalizado

Justicia Social en un mundo digitalizado

University

10 Qs

Python

Python

Assessment

Quiz

Computers

University

Practice Problem

Medium

Created by

Mohamed Ibrahim

Used 6+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

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

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?

Discover more resources for Computers