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

CPEN 333 Midterm Review Set with 100% complete answers

Rating
-
Sold
-
Pages
23
Grade
A+
Uploaded on
28-08-2024
Written in
2024/2025

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

Show more Read less
Institution
CPEN 333 M Re
Course
CPEN 333 M Re










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

Written for

Institution
CPEN 333 M Re
Course
CPEN 333 M Re

Document information

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

Subjects

Content preview

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

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.
QUILLSKY Yale University
View profile
Follow You need to be logged in order to follow users or courses
Sold
512
Member since
2 year
Number of followers
275
Documents
13973
Last sold
10 hours ago
,STUDY GUIDES,TESTBANKS AND QUALITY EXAMS IS THE KEY TO STUDENTS CAREER EXCELLENCE!!!

On this page, you find all documents, package deals, and flashcards offered by seller MAXGRADES WELCOME TO MAXGRADES ALL THE BEST !!!!!!

3.6

129 reviews

5
49
4
23
3
29
2
6
1
22

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