
python - program based questions
Quiz
•
Professional Development
•
University
•
Hard
JJ Data science
Used 1+ times
FREE Resource
25 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Consider the file "d://test.txt" with the contents as given below:
Hi there,
I am loving Python.
Python is Simple
Choose the correct output from the above code snippet from the given options:
Read String is : Hi there,
Read String is : Python is simple.
Syntax error
Read String is : Hi there,
I am loving Python.
Python is simple.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Consider the file "d://test.txt" with the contents as given below:
Hi there,
I am loving Python.
Python is Simple
Choose the correct output from the above code snippet from the given options:
Read String is : Hi there
Read String is : Hi there,
Syntax error
Hi there,
I am loving Python.
Python is simple.
3.
MULTIPLE SELECT QUESTION
1 min • 1 pt
Consider a file test.txt in D Drive with the following contents:
I Love Python
Choose the output for the following Python code from the given options(Select all applicable):
Stmt2 prints the contents of the file test.txt
Stmt5 will print number of tokens(words) in the file separated by a space ' '
Stmt6 should be uncommented to close the open file.
Stmt3 results in an error
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Consider a file read.txt in D Drive with the following contents:
Banana
Apple
Grapes
Choose the output for the following Python code from the given options:
{}
{0: 'Banana', 1: 'Apple', 2: 'Grapes'}
[0: 'Banana', 1: 'Apple', 2: 'Grapes']
{'Banana':0, 'Apple':1, 'Grapes':2}
5.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
Consider a file read.txt in D Drive with the following contents:
Banana
Apple
Grapes
Choose the output for the following Python code from the given options:
[]
['Banana', 'Apple', 'Grapes']
{'Banana', 'Apple', 'Grapes'}
Error
6.
MULTIPLE SELECT QUESTION
1 min • 1 pt
Consider a list, fruits=["Mango", "Banana", "Guava", "Strawberry"]. Match the following:
a. fruits[-4:]
b. fruits[-2:]
c. fruits[-4:-1]
d. fruits[1:4]
Select the correct answer for a, b, c & d
['Banana', 'Guava', 'Strawberry']
['Mango', 'Banana', 'Guava', 'Strawberry']
['Mango', 'Banana']
['Mango', 'Banana', 'Guava']
['Guava', 'Banana', 'Mango']
7.
MULTIPLE SELECT QUESTION
45 sec • 1 pt
Assume the following list definition:
a = ['foo', 'bar', 'baz', 'qux', 'quux', 'corge']
print(a[4::-2])
a[:] is a
max(a[2:4] + ['grault'])
print(a[-5:-3])
Create a free account and access millions of resources
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
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?
Similar Resources on Wayground
20 questions
Advanced Concepts in Classes & Recursion
Quiz
•
University
20 questions
Fundamental of Ethics
Quiz
•
University
30 questions
A Workshop on Analytical Mastery : Unraveling Complex Questions
Quiz
•
University
30 questions
Sistemas informáticos - Unidades 1 y 2
Quiz
•
University
21 questions
Introduction to Quality
Quiz
•
University
20 questions
Basic 2 Python
Quiz
•
12th Grade - Professi...
25 questions
Zion Round 1 Test Set 2
Quiz
•
University
20 questions
Nutrition - Macro's Vs Micro's
Quiz
•
University - Professi...
Popular Resources on Wayground
20 questions
Brand Labels
Quiz
•
5th - 12th Grade
10 questions
Ice Breaker Trivia: Food from Around the World
Quiz
•
3rd - 12th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
20 questions
ELA Advisory Review
Quiz
•
7th Grade
15 questions
Subtracting Integers
Quiz
•
7th Grade
22 questions
Adding Integers
Quiz
•
6th Grade
10 questions
Multiplication and Division Unknowns
Quiz
•
3rd Grade
10 questions
Exploring Digital Citizenship Essentials
Interactive video
•
6th - 10th Grade
Discover more resources for Professional Development
11 questions
NFL Football logos
Quiz
•
KG - Professional Dev...
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)
Quiz
•
8th Grade - University
7 questions
Force and Motion
Interactive video
•
4th Grade - University
36 questions
Unit 5 Key Terms
Quiz
•
11th Grade - University
38 questions
Unit 6 Key Terms
Quiz
•
11th Grade - University
20 questions
La Hora
Quiz
•
9th Grade - University
7 questions
Cell Transport
Interactive video
•
11th Grade - University
7 questions
What Is Narrative Writing?
Interactive video
•
4th Grade - University