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

Python Coding Exam Questions and Answers

Rating
-
Sold
-
Pages
17
Grade
A+
Uploaded on
12-08-2024
Written in
2024/2025

Python Coding Exam Questions and Answers print () - Answer-(Chapter 6) How would you print out the following variable in all upper case in Python? greet = 'Hello Bob' twist() - Answer-(Chapter 6) Which of the following is not a valid string method in Python? .ma - Answer-(Chapter 6) What will the following Python code print out? data = 'From Sat Jan 5 09:14:16 2008' pos = ('.') print data[pos:pos+3] strip() - Answer-(Chapter 6) Which of the following string methods removes whitespace from both the beginning and end of a string? Collection variables can store multiple values in a single variable - Answer-(Chapter 8) How are "collection" variables different from normal variables? print len(data) - Answer-(Chapter 8) Which of the following Python statements would print out the length of a list stored in the variable data? A list of integers - Answer-(Chapter 8) What type of data is produced when you call the range() function? x = range(5) append() - Answer-(Chapter 8) What list method adds a new item to the end of an existing list? for / in - Answer-(Chapter 8) What are the Python keywords used to construct a loop to iterate through a list? print friends[2] - Answer-(Chapter 8) For the following list, how would you print out 'Sally'? friends = [ 'Joseph', 'Glenn', 'Sally' ]

Show more Read less
Institution
Python Coding
Course
Python Coding










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

Written for

Institution
Python Coding
Course
Python Coding

Document information

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

Subjects

Content preview

Python Coding Exam Questions and
Answers

print greet.upper() - Answer-(Chapter 6) How would you print out the following variable
in all upper case in Python?
greet = 'Hello Bob'

twist() - Answer-(Chapter 6) Which of the following is not a valid string method in
Python?

.ma - Answer-(Chapter 6)
What will the following Python code print out?
data = 'From Sat Jan 5 09:14:16 2008'

pos = data.find('.')

print data[pos:pos+3]

strip() - Answer-(Chapter 6) Which of the following string methods removes whitespace
from both the beginning and end of a string?

Collection variables can store multiple values in a single variable - Answer-(Chapter 8)
How are "collection" variables different from normal variables?

print len(data) - Answer-(Chapter 8) Which of the following Python statements would
print out the length of a list stored in the variable data?

A list of integers - Answer-(Chapter 8) What type of data is produced when you call the
range() function?
x = range(5)

append() - Answer-(Chapter 8) What list method adds a new item to the end of an
existing list?

for / in - Answer-(Chapter 8) What are the Python keywords used to construct a loop to
iterate through a list?

print friends[2] - Answer-(Chapter 8) For the following list, how would you print out
'Sally'?
friends = [ 'Joseph', 'Glenn', 'Sally' ]

6 - Answer-(Chapter 8) What does the following Python code print out?

,a = [1, 2, 3]

b = [4, 5, 6]

c=a+b

print len(c)

Glenn - Answer-(Chapter 8)
What will the following Python code print out?
friends = [ 'Joseph', 'Glenn', 'Sally' ]

friends.sort()

print friends[0]

t[2:4] - Answer-(Chapter 8) Which of the following slicing operations will produce the list
[12, 3]?
t = [9, 41, 12, 3, 74, 15]

Nothing would print - the program fails with a traceback - Answer-(Chapter 8) What
would the following Python code print out?
fruit = 'Banana'

fruit[0] = 'b'

print fruit

Zap
ABC
Zap - Answer-(Midterm) What will the following Python program print out:

What Python statement would you like me to run? - Answer-(Chapter 1) When Python is
running in the interactive mode and displaying the chevron prompt (>>>) - what question
is Python asking you?

20 - Answer-(Chapter 1) What will the following program print out:

>>> x = 15
>>> x = x + 5
>>> print x

.py - Answer-(Chapter 1) Python scripts (files) have names that end with:

for - Answer-(Chapter 1) Which of these words is a reserved word in Python ?

, quit() - Answer-(Chapter 1) What is the proper way to say "good-bye" to Python?

Central Processing Unit - Answer-(Chapter 1) Which of the parts of a computer actually
execute the program instructions?

A sequence of instructions in a programming language - Answer-(Chapter 1) What is
"code" in the context of this course?

Secondary Memory - Answer-(Chapter 1) A USB memory stick is an example of which
of the following components of computer architecture?

The computer did not understand the statement that you entered - Answer-(Chapter 1)
What is the best way to think about a "Syntax Error" while programming?

Random steps - Answer-(Chapter 1) Which of the following is not one of the
programming patterns covered in Chapter 1?

# This is a test - Answer-(Chapter 2) Which of the following is a comment in Python?

123abc - Answer-(Chapter 2) What does the following code print out?

hours - Answer-(Chapter 2) Which of the following variables is the "most mnemonic"?

stop - Answer-(Chapter 2) Which of the following variables is the "most mnemonic"?

Retrieve the current value for x, add two to it and put the sum back into x - Answer-
(Chapter 2) What does the following statement do? x = x + 2

Parenthesis () - Answer-(Chapter 2) Which of the following elements of a mathematical
expression in Python is evaluated first?

2 - Answer-(Chapter 2) What is the value of the following expression? 42 % 10

5 - Answer-(Chapter 2) What is the value in x after the following statement executes: x =
1+2*3-8/4

98 - Answer-(Chapter 2) What value be in the variable x when the following statement is
executed?
x = int(98.6)

Pause the program and read data from the user - Answer-(Chapter 2) What does the
Python raw_input() function do?

Indent the line below the if statement - Answer-(Chapter 3)
What do we do to a Python statement that is immediately after an if statement to
indicate that the statement is to be executed only when the if statement is true?
R222,27
Get access to the full document:

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


Document 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.
Perfectscorer Chamberlain College Of Nursng
Follow You need to be logged in order to follow users or courses
Sold
483
Member since
3 year
Number of followers
354
Documents
8823
Last sold
2 weeks ago

Our store offers a wide selection of materials on various subjects and difficulty levels, created by experienced teachers. We specialize on NURSING,WGU,ACLS USMLE,TNCC,PMHNP,ATI and other major courses, Updated Exam, Study Guides and Test banks. If you don't find any document you are looking for in this store contact us and we will fetch it for you in minutes, we love impressing our clients with our quality work and we are very punctual on deadlines. Please go through the sets description appropriately before any purchase and leave a review after purchasing so as to make sure our customers are 100% satisfied. I WISH YOU SUCCESS IN YOUR EDUCATION JOURNEY

Read more Read less
3,6

74 reviews

5
27
4
15
3
17
2
5
1
10

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 exams and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can immediately select a different document that better matches what you need.

Pay how you prefer, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card or EFT 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