Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 4 out of 34 pages
Exam (elaborations)

Python 1 Final Exam Questions and Answers

Document preview thumbnail
Preview 4 out of 34 pages

Python 1 Final Exam Questions and Answers The definition of a variable is ____. - Correct Answer️️ -a storage location in a computer program What is the value of the variable named num after the following code snippet? num = 5 num2 = 6 num = num2 + 3 - Correct Answer️️ -9 What is the right way to assign the value of num + 10 to the variable num2? - Correct Answer️️ -num2 = num + 10 What is wrong here? 2ndNum = 78 - Correct Answer️️ -The 2ndNum variable is not a valid variable name Which line of code creates a variable named x and initializes it to the integer 5? - Correct Answer️️ -x = 5 Which of the following statements correctly calculates the average of three numbers, num1, num2, and num3? - Correct Answer️️ -( num1 + num2 + num3 ) / 3 A(n) ______ is a collection of programming instructions that carry out a particular task. - Correct Answer️️ -function If x=5.64, what is returned by this function? round(x) - Correct Answer️️ -6PDF DOCUMENT What must be done first before you can use a function from the standard library? - Correct Answer️️ -the function must be imported What is wrong with the following code snippet? ((num1 + num2) * num3 / 2 * (1 - num4) - Correct Answer️️ -there is an extra parenthesis What is it called when you splice two strings together in Python? - Correct Answer️️ - concatenation Given the code snippet below, what code is needed to print the person's initials? firstName = "Pamela" middleName = "Rose" lastName = "Smith" - Correct Answer️️ -print(firstName[0], middleName[0], lastName[0]) Which statement finds the last letter of the string variable name? - Correct Answer️️ - last = name[len(name) - 1] What is the default data type of input from the keyboard? - Correct Answer️️ -string Given the following statement, what statement correctly saves the number of items in the variable named quantity as an integer? userInput = input("Please enter the quantity: ") - Correct Answer️️ -quantity = int(userInput) What is the output for the following code snippet? area = 25 print("The area is %05d" % area) - Correct Answer️️ -The area is 00025PDF DOCUMENT From a python point of view, what is wrong with this statement? 72 = trombones - Correct Answer️️ -the variable must be on the left of the equal sign If you divide 2 integers with the / operator you get ____. - Correct Answer️️ -a floating point number If you divide 2 integers with the // operator you get ____. - Correct An


Document information

Uploaded on
June 17, 2024
Number of pages
34
Written in
2023/2024
Type
Exam (elaborations)
Contains
Questions & answers
$13.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

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.
OliviaWest
2.7
(23)
Sold
119
Followers
17
Items
8390
Last sold
2 months ago




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

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions

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