100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
COSC Final exam review questions and answers $12.99   Add to cart

Exam (elaborations)

COSC Final exam review questions and answers

 8 views  0 purchase
  • Course
  • COSC
  • Institution
  • COSC

COSC Final exam review questions and answers

Preview 2 out of 15  pages

  • August 24, 2024
  • 15
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
  • COSC
  • COSC
avatar-seller
millyphilip
COSC Final exam review questions and
answers
Which of the following Python syntax (code) correctly prints
" Hello World" - Answer -print("Hello World")

What will the following print?

result = 1
result = 3 + 2
print(result) - Answer -5

What does the following line in a Python code do?

name = "Larry" - Answer -Creates a variable called name and assigns it the string
"Larry" (or stores the string "Larry" in the variable name)

Python is a compiled programming language and does not use an interpreter (T/F) -
Answer -false

A variable provides a way to label, store and access information in a computer program
(T/F) - Answer -true

Why would a programmer use

if ... elif ... else? - Answer -An if, elif, else statement will execute one block of statements
if its condition is true, or another block if the condition is false. When this statement
executes, the condition is tested. If it is true, the block of indented statements following
the if clause is executed, then control of the program jumps to the statement that follows
the if-else statement. If the condition is false, the block of indented statements following
the else clause is executed, then control of the program jumps to the statement that
follows the if-else statement.

Define programming language - Answer -A Programming language is a set of
commands, instructions, and other syntax use to create a software program. it's a
formal language, which comprises a set of instructions that produce various kinds of

, output. Programming languages are more often used in computer programming to
implement algorithms.

Name two data types - Answer -integers , boolean ,

\n (meaning) - Answer -new line

/ (meaning) - Answer -divison

// - Answer -a mathematical function (divison) that returns a whole number

% - Answer -a mathematical function (divison) that returns the remainder

What does the below Python function do?

round(<put number here>) - Answer -round to the nearest whole number

What is syntax? - Answer -the grammatical rules and structural patterns for writing
computer code

Write a Python code (program) that:

Prints out the following three lines:

First number: 452
Second number: 35
Third number: 186 - Answer -#This program will print the follwing three lines:

print(" first number: ", 452)

print("second number: ", 35)

print (" third number: ", 186)

Write a Python code (program) that:

Calculates the total of the three variables,
var1, var2, var3,
and prints out the variables and the total.


You do not have to actually compute the total or use actual numbers, just write the lines
of code that will total the numbers. Punctuation counts.

You do not need to create a function. - Answer -total = var1 + var2 + var3

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

Will I be stuck with a subscription?

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

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

77254 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
$12.99
  • (0)
  Add to cart