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

Python Exam 1 Questions with Correct Answers Graded A+

Rating
-
Sold
-
Pages
19
Grade
A+
Uploaded on
10-04-2025
Written in
2024/2025

Python Exam 1 Questions with Correct Answers Graded A+ What is the output of: 11.0//2 - Answers 5.0 Floor division to the nearest whole number Returns a float What is the output of: 11//2 - Answers 5 Return an int What is the output of: 11/2 - Answers 5.5 Returns a float What is the output of: 11/2.0 - Answers 5.0 What is the output of: 20%2 - Answers 0 What is the output of: 21%2 - Answers 1 What is the output of: 11%3 - Answers 2 x = 'Texas A&M University' x [-3] = ? - Answers i x = 'Texas A&M University' x [3] = ? - Answers a x = 'Texas A&M University' len(x) = ? - Answers 20 x = 'Texas A&M University' x [0:5:2] = ? - Answers Txs It starts at 0 and ends at 5, incremented by 2 x = 'Texas A&M University' x [4:] = ? - Answers s A&M University x = 'Texas A&M University' x [:4] = ? - Answers Texa x = 'Texas A&M University' 'A' in x = ? - Answers True Acts as a Boolean, determines if it is in the string x = 'Texas A&M University' 't' in x = ? - Answers True x = 'Texas A&M University' 'A&M' in x = ? - Answers True x = 'Texas A&M University' ' ' in x = ? - Answers True x = 'Texas A&M University' ' ' in x = ? - Answers False 2**1+1 - Answers 3 3* 1**3 - Answers 3 2*(3+1) - Answers 4 6+4/2 - Answers 8.0 Returns a float due to the division

Show more Read less
Institution
Python
Course
Python










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

Written for

Institution
Python
Course
Python

Document information

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

Subjects

Content preview

Python Exam 1 Questions with Correct Answers Graded A+

What is the output of: 11.0//2 - Answers 5.0

Floor division to the nearest whole number

Returns a float

What is the output of: 11//2 - Answers 5

Return an int

What is the output of: 11/2 - Answers 5.5

Returns a float

What is the output of: 11/2.0 - Answers 5.0

What is the output of: 20%2 - Answers 0

What is the output of: 21%2 - Answers 1

What is the output of: 11%3 - Answers 2

x = 'Texas A&M University'

x [-3] = ? - Answers i

x = 'Texas A&M University'

x [3] = ? - Answers a

x = 'Texas A&M University'

len(x) = ? - Answers 20

x = 'Texas A&M University'

x [0:5:2] = ? - Answers Txs

It starts at 0 and ends at 5, incremented by 2

x = 'Texas A&M University'

x [4:] = ? - Answers s A&M University

x = 'Texas A&M University'

x [:4] = ? - Answers Texa

,x = 'Texas A&M University'

'A' in x = ? - Answers True

Acts as a Boolean, determines if it is in the string

x = 'Texas A&M University'

't' in x = ? - Answers True

x = 'Texas A&M University'

'A&M' in x = ? - Answers True

x = 'Texas A&M University'

' ' in x = ? - Answers True

x = 'Texas A&M University'

' ' in x = ? - Answers False

2**1+1 - Answers 3

3* 1**3 - Answers 3

2*(3+1) - Answers 4

6+4/2 - Answers 8.0

Returns a float due to the division

len('Hello world') = ? - Answers 11

Be sure to count the spaces as values

int(-2.3) = ? - Answers -2

float(32) = ? - Answers 32.0

str(3.14159) = ? - Answers 3.14159

[0] * 4 = ? - Answers [0, 0, 0, 0]

[1, 2, 3] * 3 = ? - Answers [ 1, 2, 3, 1, 2, 3, 1, 2, 3]

x=1

y=0

, x >= 2 and (x/y) >2 = ? - Answers False

x=6

y=2

x >= 2 and (x/y) >2 = ? - Answers True

x=1

y=0

x >= 2 and y != 0 and (x/y) >2 = ? - Answers False

What is the purpose of the "def" keyword in Python? - Answers It indicates that start of a function

It indicates that the follow indented section of code id to be stored for later

What will the following Python program print out?



def fred():

-> print ("Zap")

def jane():

-> print ("ABC")



jane()

fred()

jane() - Answers ABC Zap ABC

What will the following Python program print out?



count = 0



for number in [3, 41, 12, 9, 74, 15]:

-> count = count + 1

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.
TutorJosh Chamberlain College Of Nursing
View profile
Follow You need to be logged in order to follow users or courses
Sold
337
Member since
1 year
Number of followers
16
Documents
28401
Last sold
13 hours ago
Tutor Joshua

Here You will find all Documents and Package Deals Offered By Tutor Joshua.

3.6

53 reviews

5
18
4
14
3
12
2
0
1
9

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