Python

Python

University

5 Qs

quiz-placeholder

Similar activities

PHP Tours Meetup #22 (Super Apéro)

PHP Tours Meetup #22 (Super Apéro)

University - Professional Development

10 Qs

data list control

data list control

University

10 Qs

Microcontroller

Microcontroller

11th Grade - University

10 Qs

Tin 8/1

Tin 8/1

KG - University

10 Qs

Prework Etapa 1 - Bogotá

Prework Etapa 1 - Bogotá

University

10 Qs

ESBrotherX_Medical AI_Lecture

ESBrotherX_Medical AI_Lecture

University

7 Qs

UAS SISTEM PENDUKUNG KEPUTUSAN SUSULAN

UAS SISTEM PENDUKUNG KEPUTUSAN SUSULAN

University

10 Qs

Capitulo 2 Inicio

Capitulo 2 Inicio

1st Grade - 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