100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.6 TrustPilot
logo-home
Exam (elaborations)

Python- Multiple Choice (MCQ) Real Exam Prep Questions And Correct Answers Success Guaranteed.

Rating
-
Sold
-
Pages
3
Grade
A+
Uploaded on
03-02-2025
Written in
2024/2025

Which of the following statements create a dictionary? (Multiple Correct Answers Possible) a) d = {} b) d = {"john":40, "peter":45} c) d = {40:"john", 45:"peter"} d) d = (40:"john", 45:"50") - correct answer b, c & d. Which one of these is floor division? a) / b) // c) % d) None of the mentioned - correct answer b) // What is the maximum possible length of an identifier? a) 31 characters b) 63 characters c) 79 characters d) None of the above - correct answer D Why are local variable names beginning with an underscore discouraged? a) they are used to indicate a private variables of a class b) they confuse the interpreter c) they are used to indicate global variables d) they slow down execution - correct answer a Which of the following is an invalid statement? a) abc = 1,000,000 b) a b c = c) a,b,c = 1000, 2000, 3000 d) a_b_c = 1,000,000 - correct answer b) What is the output of the following? try: if '1' != 1: raise "someError" else: print("someError has not occured") except "someError": print ("someError has occured") a) someError has occured b) someError has not occured c) invalid code d) none of the above - correct answer C A new exception class must inherit from a BaseException. There is no such inheritance here. Suppose list1 is [2, 33, 222, 14, 25], What is list1[-1] ? a) Error b) None c) 25 d) 2 - correct answer c) 25 The index -1 corresponds to the last index in the list. To open a file c: for writing, we use a) outfile = open("c:", "r") b) outfile = open("c:", "w") c) outfile = open(file = "c:", "r") d) outfile = open(file = "c:", "o") - correct answer b) The location contains double slashes ( ) and w is used to indicate that file is being written to. What is the output of the following? f = None for i in range (5): with open("", "w") as f: if i > 2: break print d a) True b) False c) None d) Error - correct answer

Show more Read less
Institution
MCQ
Course
MCQ








Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
MCQ
Course
MCQ

Document information

Uploaded on
February 3, 2025
Number of pages
3
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

Python- Multiple Choice (MCQ)

Which of the following statements create a dictionary? (Multiple Correct Answers Possible)

a) d = {}

b) d = {"john":40, "peter":45}

c) d = {40:"john", 45:"peter"}

d) d = (40:"john", 45:"50") - correct answer b, c & d.



Which one of these is floor division?

a) /

b) //

c) %

d) None of the mentioned - correct answer b) //



What is the maximum possible length of an identifier?

a) 31 characters

b) 63 characters

c) 79 characters

d) None of the above - correct answer D



Why are local variable names beginning with an underscore discouraged?

a) they are used to indicate a private variables of a class

b) they confuse the interpreter

c) they are used to indicate global variables

d) they slow down execution - correct answer a



Which of the following is an invalid statement?
CA$19.30
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached


Also available in package deal

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
RealGrades Nursing
Follow You need to be logged in order to follow users or courses
Sold
170
Member since
2 year
Number of followers
52
Documents
11665
Last sold
3 weeks ago

4.0

26 reviews

5
12
4
5
3
7
2
1
1
1

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions