stud
bud
Sign up
Log in
Home
Library
Explore
SAT
More
Python practice test Flashcards | StudBud
Explore
/
Python practice test
Python practice test
73 terms
·
StudBud Administration
·
29 plays
Imported from external platform
Flashcards
73 cards
F
Practice quiz
P
Host live
L
Questions
73
Answers
1
You are writing a Python Practice Test program that evaluates an arithmetic formula.
DAFCE
ACFEB
CDEFA
BAFCE
2
You write the following code: You run the program. What is the output?
April--07--17 1,234,567.8900 Press any key to continue...
April--07--17 1234567.89 Press any key to continue...
Apr--07--2017 1,234,567,8900 Press any key to continue...
2017--April--07 1,234,567.890 Press any key to continue...
3
Northwind Electric Cars needs help updating their file system using Python Practice Test code.
DCBC
ADBC
BCAD
CBCB
4
You are creating a Python Practice Test program that compares numbers. You create the following code
NYYN
YNYY
YNYY
YYNY
5
You work for a company that distributes media for all ages.
CABD
BADC
DABC
ADBC
6
You are writing a Python Practice Test program to validate employee numbers.
AAAB
ABBA
AABA
BAAB
7
You are writing a function that increments the player score in a game. The function has the following requirements:
YYNN
NYNN
YNYY
NNYY
8
The out.txt file does not exist. You run the code. The code will execute without error.
The code runs but generates a logic error.
The code will generate a runtime error.
No change is needed
The code will generate a syntax error.
9
Tailspin Toys is converting an existing application to Python Practice Test.
FEACDB
FBEACD
ADECFB
EDFCBA
10
You create the following program to locate a conference room and display the room name.
BBC
CBD
ADA
CDB
11
You are writing a Python Practice Test program. The program collects customer data and stores it in a database
DBACA
ADCBC
BADAC
CDADC
12
ou are creating a Python Practice Test script to evaluate input and check for upper and lower case.
BDFE
ADEF
CDED
FDEB
13
You are writing a Python Practice Test application for a dance studio. Which code should you add on line 03?
if (not minor) or senior:
if not (minor or senior):
if (not minor) and senior:
if not (minor and senior):
14
You find errors while evaluating the following code. Line numbers are included for reference only.
CA
BD
AB
BA
15
You are creating a function to calculate admission fees by using Python Practice Test. Admission fees
BCA
CBA
BAC
ABC
16
You are creating a program that accepts user input. The program must cast the input into an integer.
AC
DC
CC
BC
17
You are writing a Python Practice Test program to perform arithmetic operations. You create the following code:
DBA
BCA
CBA
ACB
18
You are creating a function that reads a data file and prints each line of the file. You write the following code.
HFG
FHG
HGF
FGH
19
Find the count of particular letters in their publications to ensure that there is a good balance
BD
CD
AD
DD
20
You are creating an ecommerce script that accepts input from the user and outputs the data in a comma delimited format.
BEC
BCE
DAE
ACE
21
You create a function to calculate the power of a number by using Python Practice Test.
NNYY
YNYY
YNNY
NYNY
22
Woodgrove Bank must generate a report that shows the average balance for all customers each day.
AD
BC
DA
CC
23
You are writing a Python Practice Test program to automate inventory. Which code should you write for line O5 and 06?
05 if line != ‘‘: 06 if line != “\n”:
05 if line != ‘‘: 06 if line !=””:
05 if line != ‘\n’: 06 if line != None:
05 if line != ‘\n’: 06 if line != “”:
24
Company needs a simple program that their call center will use to enter survey data for a new coffee variety.
CDA
DDA
BDA
ADA
25
01 start = input(”How old were you on your start date?)02 end = input(’How old are you today?”)Which code @ line 03?
print(“congratulations on “ + int(end - start) + “ years of service!”)
print(“congratulations on “ + (int(end) - int(start))+“ years of service!”)
print(“congratulations on “ + str(end - start) + “ years of service!”)
print(”congratulations on “+str(int(end) - int(start))+“years of service!”)
26
You are developing a Python Practice Test program that compares numbers.
ABAB
CBAA
DCBA
BABA
27
You need to write code that generates a random float with a minimum value of 0.0 and a maximum value of 1.0.
random.randrange()
. random.randrange(0.0, 1.0)
random.random()
random.randint(0, 1)
28
6Match the data type to the type operations. To answer, drag the appropriate data type to the correct type operation.
ADCD
CCDA
DBCD
BBCD
29
You are writing a function ¡n Python Practice Test that must meet the following requirements:
ADCBE
CDEAB
DABCE
EACDB
30
You are writing a function that works with files. You need to ensure the function returns None if the file doesn't exist
CDABE
ADCBE
DEACB
BCDAE
31
Southridge Video needs a way to determine the cost that a customer will pay for renting a DVD.
CAA
ABB
ABC
BAA
32
You need to read and write data to a text file. If the file does not exist it must be created. Which code should you use
open(“local_data”, “w”)
open(“local_data”, “w+”)
open(“local_data”, “r+”)
open(“local_data”, “r”)
33
Tailspin Toys is building a basketball court for its employees to improve company morale.
CD
DB
AD
BD
34
You develop a Python Practice Test application for your company.
DA
BA
CA
AC
35
You must write a script that asks the user for a value. You needto write the code to meet the requirements
totalltems = int(input(”How many items would you like?”))
totalltems = input(”How many items would you like?”)
totalltems = str(input(”How many items would you like?”))
totalltems = float(input(”How many items would you like?”))
36
A coworker wrote a program that inputs names into a database.
CC
BC
AC
DC
37
You evaluate the following code
False
5
True
4
38
Adventure Works Cycles is creating a program that allows customers to log the number of miles biked.
BA
AF
DF
CB
39
You are creating a function that manipulates a number. The function has the following requirements:
CE
DE
BE
AE
40
You develop a Python Practice Test application for your company. A list named employees contains 200 employee names
BC
DA
CD
AD
41
During school holidays, you volunteer to explain some basic programming concepts to your younger siblings.
YNY
YYN
YNY
NNY
42
You are writing a function to perform safe division.
CC
BB
DD
AA
43
application that uses the sqrt function. The program must reference the function w/ the name squareRoot. import / code s
from math import sqrt as squareRoot
from math.sqrt as squareRoot
import sqrt from math as squareRoot
import math.sqrt as squareRoot
44
You write the following code:
ABC
BAB
ABA
BAC
45
A classmate has asked you to debug the following code: What is the output that is printed to the screen?
party greeting birthday cake
birthday party greeting cake
party birthday birthday cake
birthday greeting party cake
46
Which error exists in the code?
Line 05 has a syntax error because it should read (power == True).
Line 08 has a syntax error because + = is an invalid statement.
Line 07 causes a runtime error due to division by zero.
Line 05 causes a runtime error because the expression is incomplete.
47
Wingtip Toys is creating an interactive Times Table Helper program intended for elementary school children
DD
BB
AA
CC
48
You develop a Python Practice Test application for your company. You add notes so other team members will understand it
Place the notes after the # sign on any line
Place the notes inside of parentheses on any line
Place the notes after the last line of code separated by a blank line.
Place the notes before the first line of code separated by a blank line.
49
You need to write code that generates a random number that meets the following requirements
CA
DC
BB
AB
50
For each of the following statements, select Yes if the statement is true. Otherwise, select No
NNNY
YYNN
NYNY
YYYN
51
You develop a Python Practice Test application for your school. Which code should you use?
colors[2:2]
colors [::2]
colors [1::2]
colors[1:2]
52
You have the following list structure: alph = “abcdefghijklnnopqrstuvwxyz”
BCDAHG
CFHBDA
DGHFAC
AFDBAH
53
You are an intern for Northwind Electric Cars
BC
DC
CB
AC
54
You are writing code that generates a random integer with a minimum value of 5 and a maximum value of 11.
DA
AD
BD
CB
55
You are building a Python Practice Test program that displays all of the prime numbers from 2 to 100.
CBEE
AGCE
AGGC
BGCE
56
You are coding a math utility by using Python Practice Test. You are writing a function to compute roots
BDDD
ACBC
CDCD
DABC
57
Wingtip Toys is creating an interactive Times Table Helper program intended for elementary school children.
CB
BC
AC
DC
58
You are designing a decision structure to convert a student’s numeric grade to a letter grade.
ABAB
BDDD
CDAD
DDDA
59
ou are writing a Python Practice Test program to ask the user to enter a number
ABA
CBB
DAB
BAB
60
You are developing a Python Practice Test application for an online product distribution company.
DCA
CDC
ADC
BCD
61
You are developing a Python Practice Test application for an online game.
BDD
ACD
ABA
BAB
62
Which code should you write at line 02?
. name = input()
input(”name”)
input(name)
name = input
63
You develop a Python Practice Test application for your company. You have the following code.
ABA
BAB
CBA
ACC
64
You are writing a function to read a data file and print the results as a formatted table.
AGFE
DGFE
BGFE
CGFE
65
You are creating a Python Practice Test program that lets user guess a number from 1-10. Allowed up to three guesses
BAE
CBE
CDE
ACE
66
You are developing a Python Practice Test application for your company. You write the following code:
YNYN
YNYY
NYYY
NYYN
67
You write a function that reads a data file and prints each line of the file. You write the following code.
The isfile method does not exist in the path object.
You need to import the os library.
The isfile method does not accept one parameter.
The path method does not exist in the os object.
68
You have been hired to document the migrated code. Which documentation syntax is correct?
Returns the current bal of the bank account def get_balance(): return bal
//Returns the current bal of the bank account def get_balance(): return bal
def get_balance(): /*Returns the current bal of the bank acc*/ return bal
//Returns the current bal of the bank account def get_balance(): return bal
69
Relecloud Virtual Learning asks you to debug some code that is causing problems with their payroll.
CA
BB
DA
AB
70
program, users for their age and the current year, then outputs the user’s year of birth. You write the following code.
BAB
BCD
CDA
ABA
71
You are writing a function that returns the data type of the value that is passed in. You write the following code.
BCDA
DBCA
CBDA
ABCD
72
Evaluate the following Python Practice Test arithmetic expression:(3*(1+2)**2 - (2**2)*3)What is the result?
13
15
69
3
73
You write the following code: You run the code. What is the output value?
[[1, 2], [3, 4], [1, 2], [3, 4], [1, 2], [3, 4]]
[[1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4]]
[1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4]
[3, 6, 9, 12]