Quiz
Introduction to Python Test 1
Dieses Quiz enthält Fragetypen, die sich im gewohnten Player öffnen.
Fragen in diesem Quiz (100)
1Although stages (steps) of the software development life cycle can repeat, are the following stages listed in order from top to bottom?
1. Requirements Analysis
2. Design
3. Development
4. Testing
5. Implementation- ARichtig
- BFalsch
2Which is the most difficult (challenging) level of thinking?
- ARemembering
- BApplying
- CEvaluating
- DCreating
- EUnderstanding
- FAnalyzing
3A sequence of steps that solves a problem or accomplishes a task.
- AFlowchart
- BAlgorithm
- CFunction
- DSyntax
4Visual symbols, text, and directional arrows used to represent an algorithm
- AHierarchy Charts
- BSemantics
- CFlow chart
- DPseudocode
5English-like statements and informal syntax used to represent an algorithm.
- APseudocode
- BSyntax
- CFlow chart
- DSemantics
6Visual modules used to represent parts or chunks of a software application or a task.
- AFunction
- BFlow chart
- CHierarchy Charts
- DString Literal
7A collection of programming instructions that carry out a particular task.
- APseudocode
- BSemantics
- CAlgorithm
- DFunction
8Rules that define how to form instructions in a particular programming language.
- ASemantics
- BSyntax
- CString Literal
- DPseudocode
9The meaning of an instruction (what it performs).
- AFunction
- BPseudocode
- CAlgorithm
- DSemantics
10A sequence of characters surrounded by quotes.
- ASyntax
- BSemantics
- CString Literal
- DHierarchy Charts
11Which flow chart shape signifies a decision?
- AOval
- BParallelogram
- CDiamond
- DRectangle
12What symbol introduces a Python single line comment
- A"
- B//
- C#
- D$
13What does the following statement output in many cases?
print()- ABlank Space
- BNothing
- CA Blank Line
- DEmpty String
14What must separate multiple arguments in a function call?
- Acommas
- Bsemicolons
- Cspaces
- Dparentheses
15In Python what character is used at the beginning and end of String Literals?
- A" (double quote)
- B' (single quote)
- C#
- DEither " or ' (double quote or single quote)
16Which of the following is a correct statement for getting data from the user?
- Avalue = Input("Data: ")
- Bvalue : Input("Data: ")
- Cinput("Data: ") = value
- Dvalue = input("Data: ")
17For this course, inside file header documentation, what precedes the author's first and last name.
- Aname
- B@name
- C@author
- D#name
18Suppose a user enters the number 20 at an input prompt. What is returned from the input function?
- A20
- B"20"
- C2
- D"2"
19When getting a numeric zip code from a user, int will be needed to convert it into an integer.
- ARichtig
- BFalsch
20What is the Python symbol for multiplication?
- Ax
- B*
- C.
- D/
21What is the Python symbol for division?
- A/
- B\
- C%
- D>
22Instructions in a high-level language that must be translated before being executed on a computer.
- AByte code
- BCompiler
- CSource code
- DVirtual Machine
23Intermediate instructions executed by a virtual machine.
- ACompiler
- BByte code
- CSource code
- DVirtual Machine
24A program that converts programming code in one language into another language.
- ACompiler
- BVirtual Machine
- CByte code
- DSource code
25A program that simulates a CPU to execute byte code.
- ASource code
- BByte code
- CCompiler
- DVirtual Machine
26The following statement would result in what type of an error?
x = input("Enter value: )- ALogic Error
- BSyntax Error
- CRuntime Error
- DID 10 T Error
27What error can be the hardest error to track down?
- ASyntax Error
- BRuntime Error
- CLogic Error
28What is the result of executing the following statement?
print(input("First name: "))- AA syntax error occurs
- BA blank line is output
- CA runtime error occurs
- DWhatever name the user enters is echoed back to the console window
29English-like statements and informal syntax used to represent an algorithm
- ABoolean
- BLiteral
- CPseudo-code
- DAlgorithm
30What is the output from the following statement:
print(7//2)- A3.5
- B3
- C1
- D// is not a valid operator
31What is the output of the following code?
HALF_DAY_HOURS = 12
time = 15 % HALF_DAY_HOURS
print(time)- A0
- B1
- C1.25
- D3
32The following statement is valid in Python:
population = int("245,241")- ARichtig
- BFalsch
33The data type of the following literal value is a string:
"True"- ARichtig
- BFalsch
34What is the data type of the following literal value:
12.0- AInteger
- BFloat
- CString
- DBoolean
35Which of the choices utilizes a compound operator that is equivalent to the following statement:
x = x + 2- Ax += x + 2
- B2 += x
- Cx += 2
- Dx =+ 2
36What value is returned from round(4.5) ?
- A4
- B5
37What import statement would you need to include in a program with the following statement:
print(math.ceil(5.1))- Aimport print
- Bimport math
- Cimport ceil
- Dimport all
38What are the two problem-solving strategies discussed in the notes (lecture):
- ATrial and Error
- BCode Reuse and Top-Down Design
- CBottom-Up Design and Flowcharting
39If name contains the string value Kansas City, what character is accessed by name[3] ?
- An
- Bs
- Ca
40A string of length 0 is called __________________ string.
- ANull
- BZero
- CEmpty
- DIncomplete
41Suppose gallonsUsed contains a numeric value. Which of the following is the correct way to display gallonsUsed with 3 digits of precision?
- Aprint(f"Gallons used: {gallonsUsed}:.3f")
- Bprint(f"Gallons used: {gallonsUsed:.3d}")
- Cprint(f"Gallons used: {gallonsUsed:.3f}")
- Dprint("Gallons used: {gallonsUsed:.3f}")
42Suppose a variable named area exists that contains the integer value 30. Which f-string print statement below would display the following output:
The area is 30 sq units.- Aprint(f"The area is {area:d} sq units.")
- Bprint("The area is {area:d} sq units.")
- Cprint(f"The area is {area:f} sq units.")
- Dprint("The area is f{area:d} sq units.")
43After the following code runs, what is output?
school = "Missouri S&T"
print(school.upper())
print(school.lower())
print(school)- AMISSOURI S&T
missouri s&t
Missouri S&T - Bmissouri s&t
MISSOURI S&T
Missouri S&T - CMISSOURI S+T
missouri s+t
Missouri S&T - DMISSOURI S&T
missouri S&T
Missouri S&T
- AMISSOURI S&T
44Which of the following will correctly store the string C:\downloads into a variable named folder?
- Afolder = "C:\downloads"
- Bfolder = "C:\\downloads"
- Cfolder = "C:/\downloads"
- Dfolder = "C:'\'downloads"
45What ASCII values represents the characters M, m, T, and t?
- A77, 109, 84, 116
- B78, 110, 85, 115
- C79, 108, 83, 114
46Will the following code will create an empty list?
hourlyTemperatures = ()- ARichtig
- BFalsch
47Suppose a list named groceries contains data. Which choice below will display the first element of the list.
- Aprint ( groceries[0] )
- Bprint ( groceries[1] )
- Cprint ( groceries(0) )
- Dprint ( groceries(1) )
48Suppose a list named groceries contains data. Which choice below will copy the data at index 4 into the element at index 2.
- Agroceries[4] = groceries[2]
- Bgroceries[3] = groceries[1]
- Cgroceries[2] = groceries[4]
- Dgroceries[1] = groceries[3]
49Suppose a list of 100 numbers named scores exists. Write one statement that assigns the maximum value in scores to a variable named maxScore.
- AmaxScore = max(scores)
- BmaxScore = maximum(scores)
- CmaxScore = largest(scores)
- DmaxScore = scores.max
50A dictionary associates ____________ with ____________.
- Akeys, values
- Bindex, values
- Cinput, output
- Dwords, definitions
51Which statement assigns an empty dictionary to a variable named webForm?
- AwebForm = ()
- BwebForm = []
- CwebForm = {}
- DwebForm = new dictionary
52Suppose an empty dictionary named stateCaps exists. Write one statement that would insert a key of Kansas with a value of Topeka. (Note: Just write in the literal string values for Kansas and Topeka when creating the statement. There is no input from a user.)
[blank_start]stateCaps["Kansas "] = "Topeka"[blank_end]- AstateCaps["Kansas "] = "Topeka"
53Which digits are used by the binary number system?
[blank_start]0 and 1[blank_end]- A0 and 1
54Which digits and letters are used by the hexadecimal number system?
- A0 through 9 and A through F.
- B1 through 10 and A through Z.
- C0 through 9 and A through Z.
- D1 through 10 and A through F.
55Suppose a base 6 number system is used. What digits would be used?
- A0 through 5.
- B1 through 6.
- CA through F.
- DThere is no base 6 number system.
56How can a 0 and 1 be electrically represented in the computer?
- ALow voltage represents 0
High voltage represents 1 - BHigh voltage represents 1
Low voltage represents 1 - CNo voltage represents 0
High voltage represents 1
- ALow voltage represents 0
57How many bits are in one byte?
[blank_start]8[blank_end]- A8
58How many bits are in 8 bytes of data?
[blank_start]64[blank_end]- A64
59 What is the sum of the following binary numbers?
10111
+ 00001
-----------
[blank_start]11000[blank_end]- A11000
60Convert from binary to decimal. On the actual test, you must show your work to receive
potential credit and that work must be done according to the video. For this quiz, you can use scratch paper.
1101 1001
[blank_start]217[blank_end]- A217
61What is the purpose of variables?
- AInstruct the processor to execute an action.
- BStore values for later use.
- CAutomatically color text in the editor.
- DMake math problems easier in Python.
62What is the command in Python to get data entered from the user's keyboard?
- Aprint
- Bgetdata
- Cinput
- Dprompt
63What type of data is returned from the input statement in Python?
- AInteger
- BFloat
- CString
- DList
64Which of the following statements will display the following on the user's screen: Hello World!
- Aprint(Hello World!)
- Bprint('Hello World!")
- Cprint("Hello World!")
- DPRINT('Hello World')
65Which pair of statements print output on the same line?
- Aprint('Halt!')
print('No access!') - Bprint('Halt!', end=' ')
print('No access!') - Cprint(Halt!, end=' ')
print(No Access!, end=' ')
- Aprint('Halt!')
66Write a statement that prints the value of the variable num_people:
[blank_start]print(num_people)[blank_end]- Aprint(num_people)
67Assume variable age = 22, pet = "dog", and pet_name = "Gerald".
What is the output of
print('You are', age, 'years old.')
[blank_start]You are 22 years old.[blank_end]- AYou are 22 years old.
68Which of the following statements will get data from a user's keyboard and convert it to an integer value in the variable yourAge?
- AyourAge = int(input("What is your age?"))
- ByourAge = INT(input("What is your age?"))
- CyourAge = integer(input("What is your age?))
- Dyour_age = int(input("What is your age?"))
69What type of error occurs when a user enters "Bob" to answer the following input statement?
yourScore = int(input("Enter your score on the test:"))- ASyntax Error
- BRuntime Error
- CLogical Error
- DUser Error
70The program contains invalid code that cannot be understood.
- ASyntax Error
- BIndentation Error
- CName Error
- DType Error
71The lines of the program are not properly indented.
- AIndentation Error
- BSyntax Error
- CName Error
- DType Error
72The program tries to use a variable that does not exist.
- AName Error
- BType Error
- CIndentation Error
- DSyntax Error
73An operation uses incorrect types – can occur if adding an integer to a string.
- AType Error
- BSyntax Error
- CIndentation Error
- DName Error
74Which of the following is an example of a lower camel case variable?
- Adays_of_the_week
- BDaysOfTheWeek
- Cdays_Of_The_Week
- DdaysOfTheWeek
75Which coding style should you use for the names of variables, functions, and methods in CIS 142?
- AUnderscore Naming (days_of_the_week)
- BUpper Camel Case (DaysOfTheWeek)
- CLower Camel Case (daysOfTheWeek)
- DNo special style, the names just need to be unique.
76What type of coding style should you use for named constants in your programs written for CIS 142?
- ALower Camel Case (weeksInAYear)
- BUpper Camel Case (WeeksInAYear)
- CAll Upper Case with underscores (WEEKS_IN_A_YEAR)
- DNo special style, just prefix each constant with the word CONST.
77When substituting other variable data in a string literal or string variable, what is the preferred method of string formatting?
- AString concatenation
- Bf-Strings
- Cstr.format
- D% operators
78What character must precede a string literal in order for it to be treated as an f-string in Python?
- A%
(example: %"My name is {yourName}") - Bf
(example: f"My name is {yourName}") - Cs
(example: s"My name is {yourName}") - Dp
(example: p"My name is {yourName}")
- A%
79In a flowchart, the diamond shape is used to indicate what?
- Ainput from the user
- Ba decision made by the algorithm
- Cexecution of a set of operations
- Doutput to the user
80An algorithm written according to the rules of a given programming language is a ___________________.
- Acomputer program
- Bflowchart
- Cfunction
- Dexecutable
81In the following print statement, how many arguments are passed to the print function?
print("My name is", inputName, "and I am", inputAge, "years old")- A6
- B3
- C4
- D5
82An error caused by violating the rules of a programming language is called a ______________.
- Asyntax error
- Bsemantic error
- Clogical error
- Dprogrammer error
83A memory location whose contents may change during program execution.
- Aconstant
- Bvariable
- Cargument
- Dstatement
84_____________ are names given by a programmer to variables, constants, and functions.
- AIdentifiers
- BAddresses
- CCommands
- DSubstitutes
85The two numeric data types in Python are called:
- Astring and int
- Bfloat and string
- Cint and float
- Dint and boolean
86When declaring an identifier in Python, why type of character cannot be used as the first character in the identifier's name?
- Aupper case character
- Bdigit (0-9)
- Clower case character
- Dunderscore
87In Python, the following identifiers represent the same variable in memory?
day
Day
DAY- ARichtig
- BFalsch
88In Python, is the following statement a valid declaration of a variable?
if = 20- ARichtig
- BFalsch
89What is the value of x after the following operation?
x = 13 % 5- A2
- B3
- C0
- D5
90What is the value of x after the following operation? Use operator precedence to calculate correctly.
x = 4 / 2 * 3 ** 2- A0.25
- B18.0
- C36.0
- D0.11
91Which of the following is the simplest piece of code to reduce the finalPrice by 10%?
- AfinalPrice = finalPrice - (finalPrice *.10)
- BfinalPrice -= (finalPrice * .10)
- CfinalPrice = finalPrice * .90
- DfinalPrice *= .90
92In Python, do the following two statements set x to the same value?
x = 3 ** 3
x = pow(3, 3)- ARichtig
- BFalsch
93What is the value of x after the execution of this statement?
x = min(100, 20, 10, 16, 3, 150, 30, 2, 123)- A0
- B3
- C2
- D1
94If you have a Python statement in your program that exceeds 80 characters in length, you can use this character to continue the statement on the next line so the code easier to read?
- A/ (forward slash)
- B\ (backslash)
- C& (ampersand)
- D+ (plus sign)
95What would be the output of the following statement in Python?
print("The teacher said to the students, "Why isn't your homework finished".\nThe students just shrugged.")- AThe teacher said to the students, "Why isn't your homework finished".
The students just shrugged. - BThe teacher said to the students, "Why isn't your homework finished". The students just shrugged.
- CSyntax Error: invalid syntax: <string>
- DThe teacher said to the students, "Why isn't your homework finished".
The students just shrugged.
- AThe teacher said to the students, "Why isn't your homework finished".
96What would be the output of the following lines of code?
mealPrice = 10
print(mealPrice)
print( "$" + str(mealPrice))
print (f"${mealPrice}" )
print(f"Price: ${mealPrice: .2f}")
print(f"{mea1Price + 1.5: .3f}, {mealPrice:d}")- A10
$10
$10
$10.00
11.500, 10 - B10
$10
$10
Price: $10.00
11.500, 10 - C10
$10
$10
Price: $10.00
11.500, 10.00
- A10
97Which of the following escape characters can be used in a string to indicate a newline when printing the string?
- A\t
- B\\
- C\n
- D\*
98If you wanted to input a backslash in a string, which escape character would you use?
- A\n
- B\t
- C\\
- D\"
99What would be the output of the following print statement?
print("I'm trying to learn Python.\nThe programming language,\nnot the SNAKE. But escape characters\nare making my head hurt."- AI'm trying to learn Python. The programming language, not the SNAKE. But escape characters are making my head hurt.
- BI'm trying to learn Python.
The programming language,
not the SNAKE. But escape characters
are making my head hurt. - CI'm trying to learn Python.
The programming language, not the SNAKE.
But escape characters are making my head hurt.
100One way to define an empty list is using the following statement:
myList = []
Which is another way to define an empty list?- AmyList = list()
- BmyList = emptyList
- CmyList = [empty]
- Dmylist = [0]
Informationen
- Beschreibung
- Quiz am Introduction to Python Test 1, erstellt von Ashley Barton am 07/03/2021.
- Autor
- Ashley Barton
- Sprache
- English
- Aufrufe
- 1
- Schlagwörter
- Bewertung
- Noch keine Bewertungen Bewerte dieses Quiz