CIS101 FINAL STUDY GUIDE

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

programming can be defined as converting ideas into _______________ that a computer can understand

instructions

which python keyword is used to send back values from a function?

return

what will this condition print? if (num ? 0): print (num) else: print (-1 * num)

the absolute value of num

which tool is used to write source code?

a text editor

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

hello ("John")

________ is a command line interface that lets you run unix commands to explore directories, execute scripts, and work with python?

terminal

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

we never called the goodbye function

which is not a rational operator?

"="

which value is not an argument to the "hello" function? def hello (name): print ("Hey,", name)

"Hey"

which expression evaluates to 20?

(2+3) * 4

how would you fix the following code to return the remainder of 1,000 divided by 300? 1,000 % 300

1000 % 300

what does this expression evaluate to? 3 + 2 * 5 =

13

what is the output of the following program? def is Even (num): return num % 2 == 0 if is Even (3): print ("3 is even) else: print ("3 is not even")

3 is not even

what will the following code print? number = 3**2 Number = 2**3

9

this is written in _______. if "apples" == "apples" puts "yes" end

Ruby

what programming language is this function written in? def calculate _____ check (hourly_rate) hourly_rate * 40 end

Ruby

to get python code suggestions, you need to tell vs code which python interpreter to use? T or F

True

with if-else statements, we will always execute one of the code blocks depending on the result of the condition test. T or F?

True

which is an example of a runtime error?

name = "It's me!" print ("Hello.", Name)

the ____ keyword is used to send back values from a python function

return

although python ignores empty lines, one place where whitespace does make a difference is inside of ______

strings

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

the # to double is not received

which is not a benefit of functions?

functions eliminate crashes in your code

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 removal of white space be problematic?

removing the space after the "if" in if x == 1

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

0.333333333

which character starts a comment in python?

#

if you were writing your source code in the Java script language, what file extension would you save your file as?

.JS

what does this expression evaluate to? 2 * 3 + 2 * 5 =

16

wich expression evaluates to 2?

5 % 3

source code is written in rich text. T or F

False

the code that's contained inside of a function is often called the function's legs. True or false

False

which language must be compiled before it can run?

Java script

what is the output of this python code? first_name = "Jeff" first_Name = "Sara" print(first_name)=

Jeff

how would you write "hello, world!" program in python?

Print "Hello, world!"

which language is this 1st line of if-else statement written in? if 10> 9

Ruby

in this function definition, the variable "name" is_______ def hello(name): print ("Hey," name)

a parameter

which variable name is valid in python?

account_balance

parameter

allows functions to change behavior based on input

multiple statements grouped together are called a ______

block

any expression that breaks down to either true or false is called a conditional, or ________.

boolean expression

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

checking whether a # is even or odd

when working with the terminal inside of vs code, how can you expand the pane?

click the up arrow

any expression that breaks down to either true or false is _____

conditional or Boolean expression

which keyword does python use to define a function?

def

which command exits from the python command-line prompt?

exit()

computers make decisions with ______ statements

if

which code prints if a test score is pass or fail?

if (score >60): print ("passed") else: print ("failed")

which if-else statement will produce this output? is divisible by 3 num = 16

if num % 3 == 0 print ("is divisible by 3") else: print ("is not divisible by 3")

! evaluates to _____

not equal

how would you write the "hello, world!" program in python?

print ("Hello, world!")

which variable name is valid in python?

speed_____limit

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

terminal

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

the code will not print anything

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

the function does not return a value

why do computer instructions need to be sequential?

the order in which these instructions are executed is important

why are there many programming languages?

to address many different computing needs

why does vs code need a python interpreter to be specified?

to provide code suggestions

if you were developing an app for iPhone, which IDE would you use?

x code

which statement is true regarding python script in VScode ?

you need to install a vs code extension to support python

which of these is NOT a reason why we chose python as the language for the course?

highly performative

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

int

which operator will you use to return true if 2 variables are different?

!=

why doesn't python execute a file when you double - click it?

Double clicking does not run the python interpreter on the source code

python treats all the #'s the same, regardless of numerical value? T or F

False

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

Intellisense

which data type in python represents a # with a decimal point?

float

_________ is a unique feature of VSCode allows you to get code suggestions while you're typing

intellisense

What is the output? number = 36 if # % 4 == 0: print (#, "is divisible by 4") print ("All done")

All done

block

statements grouped together

which string definition results in an error?

'It's 10am'

which language doesn't use a hybrid computer/ interpreter approach?

C++

what is the standard extension to use for a python source code file?

.py

in the python terminal, what is printed when running the following line? 5*2 +1 =_______

11

if you execute the following expression, what is the output? >>> 3+5 *2 =

13

which his an example of a syntax error?

2(4*2)

what is the output? first_name = "Jeff" #first_name = "Sara" print(first_name)

Jeff

what is the issue with the following code? number = input ("Enter a number : ") print ("The number is greater than 10.") else: print ("The number is less than 10.")

The conditional statement is checking for equality

what is the output? num = 16 if num % 3 = 0: print (num, "is divisible by 3") print ("The end")

The end

in programing, a crash is when your program stops early or freezes because something unexpected happened. T or F?

True

which statement is true regarding python on a Mac?

a Mac comes with a version of python already installed

function

block of code packaged together with a name

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

equals (=)

which of these will not output? I'm learning a lot!

print('I'm learning a lot!')

which concern would be considered a disadvantage of python under certain circumstances?

python is a general purpose language

which command will start the python prompt on your computer?

python3

given the 1st line of function definition below, which programming language is this? def factorial (number)

ruby

in 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

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

str

typing "what is 2 plus 2" into the python prompt causes a ______

syntax error


Ensembles d'études connexes

Psychology 041 Final Exam (CHP 1-14) part 1 and 2

View Set

Grade 6 - The Gift of the Nile, The Kingdoms of Egypt

View Set

NURS 350 Adult 1: Exam 1 (Module 2)

View Set

Electrolytes and Fluid Balance Review Questions FROM TEXTBOOKS

View Set

NAFTA (North American Free Trade Agreement)

View Set

RN Pharmacology Online Practice 2019 B

View Set