3/27/2019 Files - Python Questions and Answers - Sanfoundry
(//www.sanfoundry.com)
Why Trade Is Evolving, Not Going Away
Get the latest financial news from Citi, the worldwide leader in consumer and corporate banking.
Ad by Citi
See More
Python Multiple Choice Questions | MCQs | Quiz
Practice Python questions and answers for interviews, campus placements, online tests, aptitude tests, quizzes and competitive exams.
Get Started
• Variable Names (https://www.sanfoundry.com/python-questions-answers-variable-names/)
• Basic Operators (https://www.sanfoundry.com/python-mcqs-basic-operators/)
• Core Data Types (https://www.sanfoundry.com/python-mcqs-core-datatypes/)
• Numeric Types (https://www.sanfoundry.com/python-questions-answers-numeric-types/)
• Precedence Associativity-1 (https://www.sanfoundry.com/python-questions-answers-precedence-associativity-1/)
• Precedence Associativity-2 (https://www.sanfoundry.com/python-questions-answers-precedence-associativity-2/)
https://www.sanfoundry.com/python-mcqs-files-1/ 1/15
3/27/2019 Files - Python Questions and Answers - Sanfoundry
• Bitwise - 1 (https://www.sanfoundry.com/python-questions-answers-bitwise-1/)
• Bitwise - 2 (https://www.sanfoundry.com/python-questions-answers-bitwise-2/)
• Boolean (https://www.sanfoundry.com/python-questions-answers-boolean/)
• Formatting - 1 (https://www.sanfoundry.com/python-questions-answers-formatting-1/)
• Formatting - 2 (https://www.sanfoundry.com/python-questions-answers-formatting-2/)
• Advanced Formatting (https://www.sanfoundry.com/python-questions-answers-advanced-formatting/)
• Decorators (https://www.sanfoundry.com/python-questions-answers-decorators/)
• While & For Loops - 1 (https://www.sanfoundry.com/python-questions-answers-while-and-for-loops-1/)
• While & For Loops - 2 (https://www.sanfoundry.com/advanced-python-questions-answers/)
• While & For Loops - 3 (https://www.sanfoundry.com/tough-python-questions-answers/)
• While & For Loops - 4 (https://www.sanfoundry.com/python-questions-answers-freshers/)
• While & For Loops - 5 (https://www.sanfoundry.com/python-questions-answers-experienced/)
• While & For Loops - 6 (https://www.sanfoundry.com/python-technical-questions-answers/)
• Strings - 1 (https://www.sanfoundry.com/python-mcqs-strings-1/)
• Strings - 2 (https://www.sanfoundry.com/advanced-python-interview-questions-answers/)
• Strings - 3 (https://www.sanfoundry.com/python-technical-interview-questions-answers/)
• Strings - 4 (https://www.sanfoundry.com/python-coding-questions-answers/)
• Strings - 5 (https://www.sanfoundry.com/basic-python-questions-answers/)
• Strings - 6 (https://www.sanfoundry.com/python-quiz/)
• Strings - 7 (https://www.sanfoundry.com/python-quiz-online/)
• Strings - 8 (https://www.sanfoundry.com/python-multiple-choice-questions-answers/)
• Strings - 9 (https://www.sanfoundry.com/python-mcqs/)
• Strings - 10 (https://www.sanfoundry.com/python-test/)
• Strings - 11 (https://www.sanfoundry.com/python-online-test/)
• Strings - 12 (https://www.sanfoundry.com/python-problems/)
• Strings - 13 (https://www.sanfoundry.com/python-question-bank/)
• Lists - 1 (https://www.sanfoundry.com/python-mcqs-lists-1/)
• Lists - 2 (https://www.sanfoundry.com/python-coding-interview-questions-answers/)
• Lists - 3 (https://www.sanfoundry.com/python-programming-questions-answers/)
• Lists - 4 (https://www.sanfoundry.com/python-programming-interview-questions-answers/)
• Lists - 5 (https://www.sanfoundry.com/python-question-papers/)
• Lists - 6 (https://www.sanfoundry.com/python-questions-answers-lists-6/)
• Lists - 7 (https://www.sanfoundry.com/python-questions-answers-lists-7/)
• List Comprehension (https://www.sanfoundry.com/python-questions-answers-list-comprehension/)
• List Comprehension - 1 (https://www.sanfoundry.com/python-questions-answers-list-comprehension-1/)
• List Comprehension - 2 (https://www.sanfoundry.com/python-questions-answers-list-comprehension-2/)
• Matrix List Comprehension (https://www.sanfoundry.com/python-questions-answers-matrix-list-comprehension/)
• Tuples - 1 (https://www.sanfoundry.com/python-mcqs-tuples/)
• Tuples - 2 (https://www.sanfoundry.com/python-questions-answers-tuples-2/)
https://www.sanfoundry.com/python-mcqs-files-1/ 2/15
3/27/2019 Files - Python Questions and Answers - Sanfoundry
• Tuples - 3 (https://www.sanfoundry.com/python-questions-answers-tuples-3/)
• Sets - 1 (https://www.sanfoundry.com/python-questions-answers-sets-1/)
• Sets - 2 (https://www.sanfoundry.com/python-questions-answers-sets-2/)
• Sets - 3 (https://www.sanfoundry.com/python-questions-answers-sets-3/)
• Sets - 4 (https://www.sanfoundry.com/python-questions-answers-sets-4/)
• Sets - 5 (https://www.sanfoundry.com/python-questions-answers-sets-5/)
• Dictionary - 1 (https://www.sanfoundry.com/python-mcqs-dictionary-1/)
• Dictionary - 2 (https://www.sanfoundry.com/python-questions-answers-dictionary-2/)
• Dictionary - 3 (https://www.sanfoundry.com/python-questions-answers-dictionary-3/)
• Dictionary - 4 (https://www.sanfoundry.com/python-questions-answers-dictionary-4/)
• Built-in Functions - 1 (https://www.sanfoundry.com/python-questions-answers-built-in-functions-1/)
• Built-in Functions - 2 (https://www.sanfoundry.com/python-questions-answers-built-in-functions-2/)
• Built-in Functions - 3 (https://www.sanfoundry.com/python-questions-answers-built-in-functions-3/)
• Function - 1 (https://www.sanfoundry.com/python-mcqs-function-1/)
• Function - 2 (https://www.sanfoundry.com/python-questions-entrance-exams/)
• Function - 3 (https://www.sanfoundry.com/python-questions-campus-interview/)
• Function - 4 (https://www.sanfoundry.com/python-questions-answers-function-4/)
• Argument Passing - 1 (https://www.sanfoundry.com/python-puzzles/)
• Argument Passing - 2 (https://www.sanfoundry.com/tricky-python-questions-answers/)
• Global vs Local Variables-1 (https://www.sanfoundry.com/python-questions-answers-global-local-variables-1/)
• Global vs Local Variables-2 (https://www.sanfoundry.com/python-questions-answers-global-local-variables-2/)
• Recursion (https://www.sanfoundry.com/python-questions-answers-recursion/)
• Shallow Copy vs Deep Copy (https://www.sanfoundry.com/python-questions-answers-shallow-copy-deep-copy/)
• Functional Tools (https://www.sanfoundry.com/python-questions-answers-functional-programming-tools/)
• Mapping Functions - 1 (https://www.sanfoundry.com/python-interview-questions-answers/)
• Mapping Functions - 2 (https://www.sanfoundry.com/tough-python-interview-questions-answers/)
• Mapping Functions - 3 (https://www.sanfoundry.com/python-interview-questions-answers-freshers/)
• Python Modules (https://www.sanfoundry.com/python-questions-answers-modules/)
• Math - 1 (https://www.sanfoundry.com/python-objective-questions-answers/)
• Math - 2 (https://www.sanfoundry.com/python-developer-questions-answers/)
• Math - 3 (https://www.sanfoundry.com/python-developer-interview-questions-answers/)
• Datetime Module - 1 (https://www.sanfoundry.com/python-questions-answers-datetime-module-1/)
• Datetime Module - 2 (https://www.sanfoundry.com/python-questions-answers-datetime-module-2/)
• Random Module - 1 (https://www.sanfoundry.com/python-questions-answers-random-module/)
• Random Module - 2 (https://www.sanfoundry.com/python-aptitude-test-questions/)
• Sys Module (https://www.sanfoundry.com/python-questions-answers-sys-module/)
• Operating System (https://www.sanfoundry.com/python-exam-questions-answers/)
• Turtle Module - 1 (https://www.sanfoundry.com/python-questions-answers-turtle-module-1/)
• Turtle Module - 2 (https://www.sanfoundry.com/python-questions-answers-turtle-module-2/)
https://www.sanfoundry.com/python-mcqs-files-1/ 3/15
3/27/2019 Files - Python Questions and Answers - Sanfoundry
• Turtle Module - 3 (https://www.sanfoundry.com/python-questions-answers-turtle-module-3/)
• Pickle Module (https://www.sanfoundry.com/python-questions-answers-pickle-module/)
• Regular Expressions (https://www.sanfoundry.com/python-questions-answers-regular-expressions/)
• Regular Expressions - 1 (https://www.sanfoundry.com/python-questions-answers-regular-expressions-1/)
• Regular Expressions - 2 (https://www.sanfoundry.com/python-questions-answers-regular-expressions-2/)
• Regular Expressions - 3 (https://www.sanfoundry.com/python-questions-answers-regular-expressions-3/)
• Regular Expressions - 4 (https://www.sanfoundry.com/python-questions-answers-regular-expressions-4/)
• Regular Expressions - 5 (https://www.sanfoundry.com/python-questions-answers-regular-expressions-5/)
• Files - 1 (https://www.sanfoundry.com/python-mcqs-files-1/)
• Files - 2 (https://www.sanfoundry.com/python-certification-questions-answers/)
• Files - 3 (https://www.sanfoundry.com/python-scripting-questions-answers/)
• Files - 4 (https://www.sanfoundry.com/python-scripting-interview-questions-answers/)
• Files - 5 (https://www.sanfoundry.com/python-written-test-questions-answers/)
• Operator Overloading (https://www.sanfoundry.com/python-interview-questions-answers-experienced/)
• Classes & Objects - 1 (https://www.sanfoundry.com/python-questions-answers-classes-objects-1/)
• Classes & Objects - 2 (https://www.sanfoundry.com/python-questions-answers-classes-objects-2/)
• Inheritance - 1 (https://www.sanfoundry.com/python-questions-answers-inheritance-1/)
• Inheritance - 2 (https://www.sanfoundry.com/python-questions-answers-inheritance-2/)
• Polymorphism (https://www.sanfoundry.com/python-questions-answers-polymorphism/)
• Encapsulation (https://www.sanfoundry.com/python-questions-answers-encapsulation/)
• Exception Handling - 1 (https://www.sanfoundry.com/python-questions-answers-exception-handling/)
• Exception Handling - 2 (https://www.sanfoundry.com/python-questions-answers-exception-handling-2/)
• Exception Handling - 3 (https://www.sanfoundry.com/python-questions-answers-exception-handling-3/)
Best Reference Books
Python Books (https://www.sanfoundry.com/best-reference-books-python-programming/)
Python Programming Tests
Certification Test (https://rank.sanfoundry.com/python-programming-certification-test/)
Internship Test (https://rank.sanfoundry.com/python-programming-internship-test/)
Job Test (https://rank.sanfoundry.com/python-programming-job-test/)
All Tests (https://rank.sanfoundry.com/python-programming-tests/)
Top Rankers (https://rank.sanfoundry.com/top-rankers-python-programming/)
Practice Test 1 (https://rank.sanfoundry.com/python-programming-practice-test-1/)
Practice Test 2 (https://rank.sanfoundry.com/python-programming-practice-test-2/)
https://www.sanfoundry.com/python-mcqs-files-1/
Practice Test 3 (https://rank.sanfoundry.com/python-programming-practice-test-3/) 4/15
3/27/2019 Files - Python Questions and Answers - Sanfoundry
Practice Test 4 (https://rank.sanfoundry.com/python-programming-practice-test-4/)
Practice Test 5 (https://rank.sanfoundry.com/python-programming-practice-test-5/)
Practice Test 6 (https://rank.sanfoundry.com/python-programming-practice-test-6/)
Practice Test 7 (https://rank.sanfoundry.com/python-programming-practice-test-7/)
Practice Test 8 (https://rank.sanfoundry.com/python-programming-practice-test-8/)
Practice Test 9 (https://rank.sanfoundry.com/python-programming-practice-test-9/)
Practice Test 10 (https://rank.sanfoundry.com/python-programming-practice-test-10/)
Mock Test 1 (https://rank.sanfoundry.com/python-programming-mock-test-1/)
Mock Test 2 (https://rank.sanfoundry.com/python-programming-mock-test-2/)
Mock Test 3 (https://rank.sanfoundry.com/python-programming-mock-test-3/)
Mock Test 4 (https://rank.sanfoundry.com/python-programming-mock-test-4/)
Mock Test 5 (https://rank.sanfoundry.com/python-programming-mock-test-5/)
Mock Test 6 (https://rank.sanfoundry.com/python-programming-mock-test-6/)
Mock Test 7 (https://rank.sanfoundry.com/python-programming-mock-test-7/)
Mock Test 8 (https://rank.sanfoundry.com/python-programming-mock-test-8/)
Mock Test 9 (https://rank.sanfoundry.com/python-programming-mock-test-9/)
Mock Test 10 (https://rank.sanfoundry.com/python-programming-mock-test-10/)
« Prev Page (https://www.sanfoundry.com/python-questions-answers-regular-expressions-5/)
Next Page (https://www.sanfoundry.com/python-certification-questions-answers/) »
Python Questions and Answers – Files – 1
This set of Python Multiple Choice Questions & Answers (MCQs) focuses on “files”.
1. To open a file c:\scores.txt for reading, we use
a) infile = open(“c:\scores.txt”, “r”)
b) infile = open(“c:\\scores.txt”, “r”)
c) infile = open(file = “c:\scores.txt”, “r”)
d) infile = open(file = “c:\\scores.txt”, “r”)
View Answer
Answer: b
Explanation: Execute help(open) to get more details.
https://www.sanfoundry.com/python-mcqs-files-1/ 5/15
3/27/2019 Files - Python Questions and Answers - Sanfoundry
advertisement
2. To open a file c:\scores.txt for writing, we use
a) outfile = open(“c:\scores.txt”, “w”)
b) outfile = open(“c:\\scores.txt”, “w”)
c) outfile = open(file = “c:\scores.txt”, “w”)
d) outfile = open(file = “c:\\scores.txt”, “w”)
View Answer
Answer: b
Explanation: w is used to indicate that file is to be written to.
3. To open a file c:\scores.txt for appending data, we use
a) outfile = open(“c:\\scores.txt”, “a”)
b) outfile = open(“c:\\scores.txt”, “rw”)
c) outfile = open(file = “c:\scores.txt”, “w”)
d) outfile = open(file = “c:\\scores.txt”, “w”)
View Answer
Answer: a
Explanation: a is used to indicate that data is to be appended.
4. Which of the following statements are true?
a) When you open a file for reading, if the file does not exist, an error occurs
b) When you open a file for writing, if the file does not exist, a new file is created
c) When you open a file for writing, if the file exists, the existing file is overwritten with the new file
d) All of the mentioned
View Answer
Answer: d
Explanation: The program will throw an error.
https://www.sanfoundry.com/python-mcqs-files-1/ 6/15
5. To read
3/27/2019 two characters from a file object infile, we use Files - Python Questions and Answers - Sanfoundry
a) infile.read(2)
b) infile.read()
c) infile.readline()
d) infile.readlines()
View Answer
Answer: a
Explanation: Execute in the shell to verify.
advertisement
6. To read the entire remaining contents of the file as a string from a file object infile, we use
a) infile.read(2)
b) infile.read()
c) infile.readline()
d) infile.readlines()
View Answer
Answer: b
Explanation: read function is used to read all the lines in a file.
7. What is the output?
1. f = None
2. for i in range (5):
3. with open("data.txt", "w") as f:
4. if i > 2:
5. break
6. print(f.closed)
a) True
b) False
c) None
d) Error
View Answer
https://www.sanfoundry.com/python-mcqs-files-1/ 7/15
Answer:
3/27/2019 a Files - Python Questions and Answers - Sanfoundry
Explanation: The WITH statement when used with open file guarantees that the file object is closed when the with block exits.
8. To read the next line of the file from a file object infile, we use
a) infile.read(2)
b) infile.read()
c) infile.readline()
d) infile.readlines()
View Answer
Answer: c
Explanation: Execute in the shell to verify.
advertisement
9. To read the remaining lines of the file from a file object infile, we use
a) infile.read(2)
b) infile.read()
C) infile.readline()
d) infile.readlines()
View Answer
https://www.sanfoundry.com/python-mcqs-files-1/ 8/15
Answer:
3/27/2019 d Files - Python Questions and Answers - Sanfoundry
Explanation: Execute in the shell to verify.
10. The readlines() method returns
a) str
b) a list of lines
c) a list of single characters
d) a list of integers
View Answer
Answer: b
Explanation: Every line is stored in a list and returned.
Sanfoundry Global Education & Learning Series – Python.
To practice all areas of Python, here is complete set of 1000+ Multiple Choice Questions and Answers (https://www.sanfoundry.com/1000-python-
questions-answers/).
« Prev Page - Python Questions and Answers – Regular Expressions – 5 (https://www.sanfoundry.com/python-questions-answers-regular-expressions-5/)
» Next Page - Python Questions and Answers – Files – 2 (https://www.sanfoundry.com/python-certification-questions-answers/)
advertisement
Deep Dive @ Sanfoundry:
1. Java Programming Examples on Java.Lang (https://www.sanfoundry.com/java-programming-examples-java-lang/)
2. Java Programming Examples on Utility Classes (https://www.sanfoundry.com/java-programming-examples-utility-classes/)
3. Java Programming Examples on Multithreading (https://www.sanfoundry.com/java-programming-examples-multithreading/)
4. Java Programming Examples on Event Handling (https://www.sanfoundry.com/java-programming-examples-event-handling/)
5. Programming Questions and Answers (https://www.sanfoundry.com/programming-questions-answers/)
6. Java Programming Examples on File Handling (https://www.sanfoundry.com/java-programming-examples-file-handling/)
7. Java Programming Examples on Collections (https://www.sanfoundry.com/java-programming-examples-collections/)
8. Python Questions and Answers (https://www.sanfoundry.com/1000-python-questions-answers/)
9. Python Programming Examples (https://www.sanfoundry.com/python-problems-solutions/)
10. C# Programming Examples on Files (https://www.sanfoundry.com/csharp-programming-examples-on-files/)
https://www.sanfoundry.com/python-mcqs-files-1/ 9/15
3/27/2019 Files - Python Questions and Answers - Sanfoundry
Do You Know Your Strange
Tech Tidbits?
Bill Gates has a favorite tree at home
that he has monitored electronically 24
0/10
hours to make sure it’s never dry
SCORE
TRUE FALSE
Sponsored
Manish Bhojasia (https://in.linkedin.com/in/manishbhojasia?trk=profile-badge) Manish Bhojasia (https://www.sanfoundry.com/about/), a technology
veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He is Linux Kernel Developer & SAN Architect and is passionate about
competency developments in these areas. He lives in Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux
Debugging, Linux Device Drivers, Linux Networking, Linux Storage, Advanced C Programming, SAN Storage Technologies, SCSI Internals & Storage
Protocols such as iSCSI & Fiber Channel. Stay connected with him @ LinkedIn (https://www.linkedin.com/in/manishbhojasia) | Facebook
(https://www.facebook.com/sanfoundry) | Twitter (https://www.twitter.com/sanfoundry)
Best Careers
Developer Tracks (https://www.sanfoundry.com/salary-50l/)
SAN Developer (https://www.sanfoundry.com/san-storage-developer-training-courses/)
Linux Kernel Developer (https://www.sanfoundry.com/linux-kernel-developer-training-courses-jobs/)
Linux Driver Developer (https://www.sanfoundry.com/linux-device-driver-developer-training/)
Linux Network Developer (https://www.sanfoundry.com/linux-network-developer-training/)
Live Training Photos (https://www.sanfoundry.com/sanfoundry-classes/)
https://www.sanfoundry.com/python-mcqs-files-1/ 10/15
3/27/2019 Files - Python Questions and Answers - Sanfoundry
Mentoring (https://www.sanfoundry.com/professional-mentoring-coaching-career-guidance-cto/)
Software Productivity (https://www.sanfoundry.com/programming-discipline-and-software/)
GDB Assignment (https://www.sanfoundry.com/gdb-example-tutorial/)
Sanfoundry is No. 1 choice for Deep Hands-ON Trainings in SAN, Linux & C, Kernel Programming. Our Founder has trained employees of almost all
Top Companies in India such as VMware, Citrix, Oracle, Motorola, Ericsson, Aricent, HP, Intuit, Microsoft, Cisco, SAP Labs, Siemens, Symantec,
https://www.sanfoundry.com/python-mcqs-files-1/ 11/15
Redhat,
3/27/2019 Chelsio, Cavium, ST-Micro, Samsung, LG-Soft, Wipro,
Files -TCS, HCL, IBM,
Python Questions Accenture,
and Answers HSBC, Mphasis, Tata-Elxsi, Tata VSNL, Mindtree,
- Sanfoundry
Cognizant and Startups.
Best Trainings
SAN I - Technology (https://www.sanfoundry.com/san-storage-area-networks-training/)
SAN II - Admin (https://www.sanfoundry.com/san-administration-training-course/)
Linux Fundamentals (https://www.sanfoundry.com/linux-administration-training/)
Advanced C Training (https://www.sanfoundry.com/advanced-c-programming-training/)
Linux-C Debugging (https://www.sanfoundry.com/training-on-linux-debugging-techniques/)
System Programming (https://www.sanfoundry.com/training-on-linux-internals-systems/)
Network Programming (https://www.sanfoundry.com/training-socket-network-programming/)
Linux Threads (https://www.sanfoundry.com/training-multithreaded-parallel/)
Kernel Programming (https://www.sanfoundry.com/linux-kernel-internals-training/)
Kernel Debugging (https://www.sanfoundry.com/linux-kernel-debugging-training/)
Linux Device Drivers (https://www.sanfoundry.com/training-on-linux-device-drivers/)
https://www.sanfoundry.com/python-mcqs-files-1/ 12/15
3/27/2019 Files - Python Questions and Answers - Sanfoundry
Best Reference Books
Computer Science Books (https://www.sanfoundry.com/best-reference-books-computer-science-engineering/)
Algorithm & Programming Books (https://www.sanfoundry.com/best-reference-books-programming-hot-technologies)
Electronics Engineering Books (https://www.sanfoundry.com/best-reference-books-electrical-electronics-engineering/)
Electrical Engineering Books (https://www.sanfoundry.com/best-reference-books-electrical-electronics-engineering/)
https://www.sanfoundry.com/python-mcqs-files-1/ 13/15
Chemical
3/27/2019 Engineering Books (https://www.sanfoundry.com/best-reference-books-chemical-engineering/)
Files - Python Questions and Answers - Sanfoundry
Civil Engineering Books (https://www.sanfoundry.com/best-reference-books-civil-engineering/)
Mechanical Engineering Books (https://www.sanfoundry.com/best-reference-books-mechanical-engineering/)
Industrial Engineering Books (https://www.sanfoundry.com/best-reference-books-industrial-engineering-operations-research/)
Instrumentation Engg Books (https://www.sanfoundry.com/best-reference-books-instrumentation-engineering/)
Metallurgical Engineering Books (https://www.sanfoundry.com/best-reference-books-metallurgical-engineering/)
All Stream Best Books (https://www.sanfoundry.com/best-reference-books-tech-engineering-sciences/)
Questions and Answers
1000 C Questions & Answers (https://www.sanfoundry.com/c-interview-questions-answers/)
1000 C++ Questions & Answers (https://www.sanfoundry.com/cplusplus-interview-questions-answers/)
1000 C# Questions & Answers (https://www.sanfoundry.com/1000-csharp-questions-answers/)
1000 Java Questions & Answers (https://www.sanfoundry.com/java-questions-answers-freshers-experienced/)
1000 Linux Questions & Answers (https://www.sanfoundry.com/technical-interview-questions/)
1000 Python Questions (https://www.sanfoundry.com/1000-python-questions-answers/)
1000 PHP Questions & Answers (https://www.sanfoundry.com/1000-php-questions-answers/)
1000 Hadoop Questions (https://www.sanfoundry.com/1000-hadoop-questions-answers/)
Cloud Computing Questions (https://www.sanfoundry.com/1000-cloud-computing-questions-answers/)
Computer Science Questions (https://www.sanfoundry.com/computer-science-questions-answers/)
All Stream Questions & Answers (https://www.sanfoundry.com/)
India Internships
Computer Science Internships (https://www.sanfoundry.com/internships-computer-science-engineering/)
Instrumentation Internships (https://www.sanfoundry.com/internships-instrumentation-engineering/)
Electronics Internships (https://www.sanfoundry.com/internships-electronics-electrical-engineering/)
Electrical Internships (https://www.sanfoundry.com/internships-electronics-electrical-engineering/)
Mechanical Internships (https://www.sanfoundry.com/internships-mechanical-engineering/)
Industrial Internships (https://www.sanfoundry.com/internship-industrial-engineering/)
Systems Internships (https://www.sanfoundry.com/internships-systems-control-engineering/)
Chemical Internships (https://www.sanfoundry.com/internships-chemical-engineering/)
Civil Internships (https://www.sanfoundry.com/internships-civil-engineering/)
IT Internships (https://www.sanfoundry.com/internship/)
All Stream Internships (https://www.sanfoundry.com/internship/)
About Sanfoundry
https://www.sanfoundry.com/python-mcqs-files-1/ 14/15
About Us
3/27/2019 (https://www.sanfoundry.com/about/) Files - Python Questions and Answers - Sanfoundry
Copyright (https://www.sanfoundry.com/copyright/)
Terms (https://www.sanfoundry.com/tos-privacy-policy/)
Privacy Policy (https://www.sanfoundry.com/privacy-policy/)
Jobs (https://www.sanfoundry.com/jobs/)
Bangalore Training (https://www.sanfoundry.com/coursesfees/)
Online Training (https://www.sanfoundry.com/online-training-san-linux-kernel-device-drivers/)
Developers Track (https://www.sanfoundry.com/salary-50l/)
Mentoring Sessions (https://www.sanfoundry.com/professional-mentoring-coaching-career-guidance-cto/)
Contact Us (https://www.sanfoundry.com/contact/)
Sitemap (https://www.sanfoundry.com/sitemap_index.xml)
© 2011-2019 Sanfoundry. All Rights Reserved.
https://www.sanfoundry.com/python-mcqs-files-1/ 15/15