Programming Foundation Fundamentals

¡Supera tus tareas y exámenes ahora con Quizwiz!

What is the output of the following Python code? first_name = "Jeff" #first_name = "Sara" print(first_name)

Jeff

Programming can be defined as:

converting ideas into instructions that a computer can understand

Why is there no output for this program? def goodbye(): print("Bye")

we never called the goodbye function

What is the standard extension to use for a Python source code file?

.py

Multiple statements grouped together are called a___

Block

Which language does not use a hybrid compiler/interpreter approach?

C++

Which IDE feature allows you to get code suggestions while you are typing?

IntelliSense

Typing "What is 2 plus 2?" into the Python prompt causes a...(what type of error?)

Syntax error

Why do computer instruction need to be sequential?

The order in which these instructions are executed is important

T/F: With if-else statements, we will always execute one of the code blocks depending on the result of the condition test.

True

This expression results in a syntax error (T/F): 2 (4*2)

True

Which Python keyword is used to send back values from a function?

return

What will the following condition print? if (num>=0): print(num) else: print(-1 * num)

the absolute value of num

Why does VS Code need a Python interpreter to be specified?

to provide code suggestions

Which operator will you use to return true if two variables are different?

!=

Which character starts a comment in Python?

#

When working with the Terminal inside of VSCode, how can you expand the pane?

Click the up arrow

Why doesn't a Python file execute when you double-click it?

Double-clicking does not run the Python interpreter on the source code

T/F: Python treats all numbers the same, regardless of numerical value.

False

T/F: The code that's contained inside of a function is often called the function's legs.

False, parameters

Which language is considered an interpreted language?

JavaScript

Which concern could be considered a disadvantage of Python under certain circumstances?

Python is a general-purpose language

T/F:In programming, a crash is when your program stops early or freezes because something unexpected happened.

True

How would you writhe the "Hello, world!" program in Python?

print("Hello, world!")

T/F: source code is written in rich text.

False

Which data type in Python represents a number with a decimal point?

Float

Although Python ignores empty lines, one place where whitespace does make a difference is inside of___

Strings

Which Mac application allows you to run commands and execute scripts in a command-line interface?

Terminal

T/F: to get Python code suggestions, you need to tell VS Code which Python interpreter to use.

True

If you were developing an application for an iPhone, which IDE would you use?

XCode

What is true regarding Python support in VS Code?

You need to install a VS Code extension to support Python.

What can the following function be used for? def mystery(x): if (x % 2 == 0): return("yes") else: return("no")

checking whether a number is even or odd

Which keyword does Python use to define a function?

def

Given the following code, how would you call the function? def hello(name): print("Hey,", name)

hello("John")

Which command will start the Python prompt on your computer?

python3

You have Python 3 installed. How will you run the Python code in the file "process.py" on the command-line prompt?

python3 process.py

When would a removal of white space be problematic?

removing the space after the "if" in an if-statement

What will the following code print? variable = "12" print(type(variable))

str

What does the void keyword mean when it is specified before a function definition?

the function does not return a value

What is the issue with this function as defined? def double(): print(x*2)

the number to double is not received

What will the following code print? def compare(): print(5, "is greater than", 6)

this code will not print anything

Why are there many programming languages?

to address many different computing needs

If you were writing your source code in the JavaScript programming language, what file extension would you use to save your file?

.js

What does this expression evaluate to: 2 * 3 + 2 * 5

16

Which statement is true regarding Python on a Mac?

A Mac comes with a version of Python already installed.

Any expression that breaks down to either true or false is called a conditional, or___

Boolean expression

What operator do you use to assign a value to a variable?

equals (=)

Which command exits from the Python command-line prompt?

exit( )

What is the type of the following value: '12'?

int

What will the following program print? def mult_inv(num): return 1/num result=mult_inv(3) print(result)

0.33333333

What is the output of the following program? number = 10 if number % 4 == 0: print(number, "is divisible by 4") print("All done")

All done

The code below, which is supposed to print the value of the variable x, is not working. Which category does the error fall under? x = 5 print("x")

Semantic error

Which tool is used to write source code?

a text editor


Conjuntos de estudio relacionados

Raising funds for schemes and dreams

View Set

Chapter 37: Impact of Cognitive and Sensory Impairment on the Child and Family NCLEX

View Set

Real Estate: Valuation/ Market Analysis

View Set

пмк інформ 2 модуль

View Set

Romanticism, 3B Flashcards, Unit 8 Self Test 1, Chapter 4 test review, Literary Terms, english 10 quiz 1, Cards

View Set

Attitudes and Persuasion Final Exam

View Set

Geography; Places I don't even live in

View Set