Milestone 1: Programming Basics

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

Which value pair will return True using the Boolean operator "and"?

A= TRUE, B=TRUE

Decimal values are also called what?

Base 10 numbers

__________ is the first step in programming.

Defining the problem

When designing an algorithm, the next step after determining the inputs is what?

Determining the outputs

What is the output of the following program that tests whether the variable num is a multiple of five? num=20 if num%5==0: print("Hello") else: print("Goodbye")

Hello

What happens if an exception is not handled?

The program will halt and generate an error.

Attempting to operate on variables with incompatible data types is an example of which error type?

TypeError

Which of these programs would produce the output shown below? 2 3 2 3 2 3 2 3 2 3 5

myVar1 = '3' myVar2 = '2' lines = int(myVar1) + int(myVar2) myStr = myVar2 + ' ' + myVar1 + '\n' result = myStr * lines + str(lines) print(result)

How would you construct a print statement to print the following quote? Programming isn't about what you know; it's about what you can figure out

print('Programming isn\'t about what you know; it\'s about what you can figure out')

This script checks whether a person is eligible for voting or not. Which function would be used to display a message to the user on line 3? 1 age=int(input("Enter your age")) 2 if ___ <=18: 3 ____("Eligible for voting") 4 ____: 5 print("not eligible for voting")

print()

How would you add a single space when concatenating the two variables a="firstname" and b="lastname" ?

print(a + ' ' + b)

If x = 8 and y = 2, what is the value of the following expression? x + y * 3

14

What will happen when the following script is run?

4 will be printed

1 price = 12 2 quantity = 2 3 amount = price*quantity 4 5 if amount > 100: 6 if amount > 500: 7 print("Amount is greater than 500") 8 else: 9 if amount < 500 and amount > 400: 10 print("Amount is between 400 and 500") 11 elif amount < 500 and amount > 300: 12 print("Amount is between 300 and 500") 13 else: 14 print("Amount is between 200 and 500") 15 elif amount == 100: 16 print("Amount is 100") 17 else: 18 print("Amount is less than 100")

6,9

Consider this program. Which score represents a corner case that should be tested? score = 70 if score > 90 and score <= 100: print('You got an A! Congrats!') elif score > 80 and score <= 90: print('You got a B! Well done!') elif score > 70 and score <= 80: print('You got a C.') else: print("You did not pass the exam.")

80

Which best describes the output operation?

It displays results.

Function names are followed by which symbols?

Parenthesis

In Python, a numeric data type that is the sum of a real number and an imaginary number is a(n) __________ data type.

complex

The __________ feature in the Replit IDE is used to create breakpoints in the code.

debug


संबंधित स्टडी सेट्स

APR 271 EXAM 1 (PHASE 1 FORMATIVE RESEARCH: STEPS 1-3: WEEKS 1-4)

View Set

Chapter 13 The Spinal Cord, Spinal Nerves, and Somatic Reflexes

View Set

AMT 112 prog 4 fill in the blank

View Set

Anthro Midterm questions chapter 9

View Set

Chapter 9. Pathways That Harvest Chemical Energy (HOMEWORK & QUIZ)

View Set