0% found this document useful (0 votes)
9 views

Programming in Python - Unit 11 - Week 11 (Contents) - Input-Output

Uploaded by

Anjali Tibe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Programming in Python - Unit 11 - Week 11 (Contents) - Input-Output

Uploaded by

Anjali Tibe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

4/27/24, 10:36 PM Programming in Python - - Unit 11 - Week 11 (Contents): Input-Output

(https://swayam.gov.in) (https://swayam.gov.in/nc_details/CEC)

[email protected]

CEC (https://swayam.gov.in/explorer?ncCode=CEC) » Programming in Python (course)

Course Assessment-11-2024
outline Assignment not submitted Due date: 2024-04-28, 23:59 IST.

1) A file is stored in _______memory. 1 point


Week 1
(Contents) :
Primary
Planning the
Computer Cache
Program () Volatile
Secondary
Week 2
(Contents): 2) What function is used to read data from the keyboard in Python? 1 point
Techniques
of Problem
Solving () read()
input()
Week 3
write()
(Contents):
Introduction print()
to Python ()
3) What will be the output of the following code? 1 point
Week 4 file = open("test.txt", "w")
(Contents): file.write("Hello, World!")
Conditional file.close()
Statements file = open("test.txt", "r")
and Looping print(file.read())
()
Hello, World!
Week 5 Hello World!
(Contents):
Hello, World
String

https://onlinecourses.swayam2.ac.in/cec24_cs01/unit?unit=62&assessment=103 1/3
4/27/24, 10:36 PM Programming in Python - - Unit 11 - Week 11 (Contents): Input-Output

Manipulation Error
()
4) Which of the following is used to close a file in python? 1 point
Week 6
(Contents):
Introduction end()
to list. () terminate()
finish()
Week 7 close()
(Content):
Introduction
5) Which method is used to read a single line from the file? 1 point
to tuples. ()

Week 8 reads()
(Contents):
read()
Introduction
to readlines()
dictionaries () readline()

Week 9 6) By default, a new file is created in which directory? 1 point


(Contents):
Python
Functions ()
current working directory
Week 10
(Contents) : root directory
Python python directory
Modules ()
f drive

Week 11
7) What is the purpose of the with statement in Python file handling? 1 point
(Contents):
Input-Output
()
To create a new file
Lecture 1: File
Handling-I
(unit?
To open an existing file
unit=62&lesson
=63)

Lecture 2: File To read the contents of a file


Handling-II
(unit?
To ensure that a file is properly closed after its operations are completed
unit=62&lesson
=64)
8) What is the purpose of the seek() method in Python file handling? 1 point
Lecture 3:
Practical
Examples
(unit? To open a file

https://onlinecourses.swayam2.ac.in/cec24_cs01/unit?unit=62&assessment=103 2/3
4/27/24, 10:36 PM Programming in Python - - Unit 11 - Week 11 (Contents): Input-Output

unit=62&lesson
=65) To read the contents of a file

Lecture
Material (unit?
unit=62&lesson
To write data to a file
=66)
To set the current position in a file
Quiz:
Assessment- 9) How can you read the entire contents of a file named "data.txt" into a variable named 1 point
11-2024 content?
(assessment?
name=103)

Week 12 content = read("data.txt")


(Contents):
Exception
Handling () content = file.read("data.txt")

content = open("data.txt").read()

content = read_file("data.txt")

10) Which of the following modes is used to open a file for reading and writing in Python? 1 point

r
w
a
r+

You are allowed to submit this assignment only once.


Submit Answers

https://onlinecourses.swayam2.ac.in/cec24_cs01/unit?unit=62&assessment=103 3/3

You might also like