Python Programming Intermediate-1

Quiz
•
Computers
•
University
•
Hard

Manzoor Ahmed
Used 34+ times
FREE Resource
15 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
Similar Resources on Wayground
10 questions
6-文件操作

Quiz
•
University
15 questions
Python

Quiz
•
University
10 questions
Python Basics

Quiz
•
University
20 questions
Python Functions and File Operations Quiz

Quiz
•
University
15 questions
CSE 102 Exam 2 Practice

Quiz
•
University
20 questions
Python Prowess

Quiz
•
University
20 questions
Round-1 Technical Aptitude

Quiz
•
11th Grade - Professi...
11 questions
Python Round 3

Quiz
•
University
Popular Resources on Wayground
55 questions
CHS Student Handbook 25-26

Quiz
•
9th Grade
10 questions
Afterschool Activities & Sports

Quiz
•
6th - 8th Grade
15 questions
PRIDE

Quiz
•
6th - 8th Grade
15 questions
Cool Tool:Chromebook

Quiz
•
6th - 8th Grade
10 questions
Lab Safety Procedures and Guidelines

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

Quiz
•
3rd Grade
20 questions
Bullying

Quiz
•
7th Grade
18 questions
7SS - 30a - Budgeting

Quiz
•
6th - 8th Grade
Discover more resources for Computers
36 questions
USCB Policies and Procedures

Quiz
•
University
4 questions
Benefits of Saving

Quiz
•
5th Grade - University
20 questions
Disney Trivia

Quiz
•
University
2 questions
Pronouncing Names Correctly

Quiz
•
University
15 questions
Parts of Speech

Quiz
•
1st Grade - University
1 questions
Savings Questionnaire

Quiz
•
6th Grade - Professio...
26 questions
Parent Functions

Quiz
•
9th Grade - University
18 questions
Parent Functions

Quiz
•
9th Grade - University