100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
CMPSC 101 MIDTERM EXAM 1 QUESTIONS & ANSWERS(RATED A+) $13.49
Add to cart

Exam (elaborations)

CMPSC 101 MIDTERM EXAM 1 QUESTIONS & ANSWERS(RATED A+)

 0 purchase
  • Course
  • CMPSC 101
  • Institution
  • CMPSC 101

What command should you type in the interpreter to check your Python installation? - ANSWERpython What do you call a saved file containing Python instructions? - ANSWERA module How can you write the expression "n = n * 2" using short-hand operators? - ANSWERn *= 2 Which string function do ...

[Show more]

Preview 2 out of 5  pages

  • February 26, 2025
  • 5
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
  • CMPSC 101
  • CMPSC 101
avatar-seller
papersbyjol
CMPSC 101 MIDTERM EXAM 1
QUESTIONS & ANSWERS(RATED A+)
What command should you type in the interpreter to check your Python installation?
- ANSWERpython

What do you call a saved file containing Python instructions? - ANSWERA module

How can you write the expression "n = n * 2" using short-hand operators? -
ANSWERn *= 2

Which string function do you call when you want to convert the first letter in the string
to uppercase? - ANSWERstr.capitalize()

Which function do you call to check the number of items in a list? - ANSWERlen()

Which operator is used to concatenate two lists? - ANSWER+ (plus)

Which function do you call when you want to append an element at the end of a list?
- ANSWERlist.append()

What is the name of the output you get when an error occurs in your program? -
ANSWERStack trace or traceback

What is the output of running the following script?
>>> print(5*4) - ANSWER20

What are variables? - ANSWERThey refer to values in a memory

Which function can be used to convert strings to integers? - ANSWERint()

What is the syntax for assigning a variable, x, to the value 8? - ANSWERx = 8

What type of value is returned by the input function? - ANSWERString

How do you write an inline comment in Python? - ANSWER>>>print(ans) # this is
answer

What is the output of the following script?
>>> a, b, c = 1, 2, 3
>>> print(a)
>>> print(b)
>>> print(c) - ANSWER1
2
3

, Which function should you use to convert an integer into a binary number? -
ANSWERbin()


What is the order of operations while evaluating an expression? -
ANSWERPEMDAS

What is the output of the following script?
>>> string = "championship"
>>> print(string[0:5]) - ANSWERchamp

What is the output of the following script?
>>> fruits = ["apples", "bananas", "strawberries", "mangoes", "pears"]
>>>print(fruits[3]) - ANSWERmangoes

How many values do Boolean data types contain? - ANSWER2

Which of the following best describes a software engineering process used by most
successful programmers? - ANSWERDesign a solution carefully; document the
design; then code accordingly

Everyone can figure out that 90 minutes after 2:15 PM is 3:45 PM. We know the
value 45 is correct because - ANSWER(15 + 90) % 60 = 45

The primary difference between / and // in Python 3 is that - ANSWER// always
results in an integer; / may result in fractions or decimals

When is it appropriate to get an input with "int(input___))" instead of merely
"input(___)"? - ANSWERWhen the input should be a number and not a string

To get the first item from a list named 'names', use - ANSWERnames[0]

What would be displayed by the following code sequence?
a = [1, 2, 3]
b =a
a.append(4)
b.append(4)
print(b) - ANSWER[1, 2, 3, 4, 4]

If one wishes to use square brackets to access elements in a dictionary, within the
square brackets one must put - ANSWERa key value to search for

Which of these is not automatically available for lists in Python? -
ANSWERaverage(list) -- compute the average of values

_+1
_+2
_+3

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 papersbyjol. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

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

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

69484 documents were sold in the last 30 days

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

Start selling
$13.49
  • (0)
Add to cart
Added