100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
CPEN 333 Midterm Review Set with 100% complete answers $17.99   Add to cart

Exam (elaborations)

CPEN 333 Midterm Review Set with 100% complete answers

 2 views  0 purchase
  • Course
  • CPEN 333 M Re
  • Institution
  • CPEN 333 M Re

Which one of these print statements is NOT correct? A: print("Hello world") B: print "Hello World" correct answersB Which one of these print statements is NOT correct? A: print("Hello world") B: print('Hello world') C: x = 2 print(x) D: name = "CPEN333" print(f"Course: {name}") E: N...

[Show more]

Preview 3 out of 23  pages

  • August 28, 2024
  • 23
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
  • CPEN 333 M Re
  • CPEN 333 M Re
avatar-seller
QUILLSKY
CPEN 333 Midterm Review Set

Which one of these print statements is NOT correct?



A: print("Hello world")

B: print "Hello World" correct answersB



Which one of these print statements is NOT correct?

A: print("Hello world")

B: print('Hello world')

C: x = 2

print(x)

D: name = "CPEN333"

print(f"Course: {name}")

E: None of the above correct answersE



Is the following code segment valid? (note that valid and good-style are two different things)

print("Python is fantastic"); print("Python is fun")

A: Yes

B: No correct answersA



An identifier can contain digits, but cannot start with a digit. True or False?

Example:

2Be = "To Be" correct answersTrue



What will be displayed by the following code?

x=1

,x = x + 2.5

print(x) correct answers3.5



The word True is? correct answersboth a keyword and a Boolean literal



Analyze the following code.

even = False

if even:

print("It is even!") correct answersPrints nothing



How many times will the following code print "Welcome to Python"?

count = 0

while count < 10:

print("Welcome to Python")

count += 1 correct answers10



Which of the following function returns a sequence 0, 1, 2, 3?

A: range(0,3);

B: range(0,4); correct answersB



_______ is a template, blueprint, or contract that defines objects of the same type. correct answersA
Class



The keyword __________ is required to define a class. correct answersclass



An object is an instance of a __________. correct answersclass



Analyze the following code:

class A:

, def __init__(self, s):

self.s = s

def print(self):

print(s)



a = A("Welcome")

a.print() correct answersThe program would run if you change print(s) to print(self.s).



What is printed by the following code?

class Count:

def __init__(self):

self.count = 0



def increment(c, times):

c.count += 1

times += 1



def main():

myCount = Count()

times = 0



for i in range(0, 100):

increment(myCount, times)



print("count is", myCount.count, "and times is", times)



if __name__=="__main__":

main() correct answerscount is 100 and times is 0

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 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 these notes from?

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

Will I be stuck with a subscription?

No, you only buy these notes for $17.99. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

75619 documents were sold in the last 30 days

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

Start selling
$17.99
  • (0)
  Add to cart