100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
Python Coding Exam Questions and Answers R225,32   Add to cart

Exam (elaborations)

Python Coding Exam Questions and Answers

 13 views  0 purchase
  • Course
  • Python Coding
  • Institution
  • Python Coding

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) Wh...

[Show more]

Preview 3 out of 17  pages

  • August 12, 2024
  • 17
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
  • Python Coding
  • Python Coding
avatar-seller
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 stephen.marquard@uct.ac.za 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?

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through EFT, credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying this summary from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller Perfectscorer. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy this summary for R225,32. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

79223 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy summaries for 14 years now

Start selling
R225,32
  • (0)
  Buy now