1/97
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
A computer, in some cases, understands more than machine code. T/F
False
Which of the following is an example of software?
A. RAM
B. Motherboard
C. WingIDE 101
D. CPU
C. WingIDE 101
High level programming languages include:
A. Python
B. Java
C. C
D. All of the above
D. All of the above
Examples of operating systems include the following, except:
A. Mac
B. Linux
C. Excel
D. Windows
C. Excel
_______ refers to the tangible part of a computer system.
A. Software
B. Malware
C. Memory
D. Hardware
D. Hardware
What piece of hardware connects all the components and devices of a computer?
A. Motherboard
B. Central Processing Unit (CPU)
C. Hard drive
D. RAM
A. Motherboard
A computer's "working memory" is its:
A. RAM
B. ROM
C. Flash drive
D. CPU
A. RAM
System software provides the real functionality of a computer, helping your computer do specific types of work. T/F
False
Of the options below, which equal one gigabyte?
A. 1024 Megabytes (MB)
B. 1024 Terabytes (TB)
C. 1048576 Bytes
D. 1024 Kilobytes (KB)
A. 1024 Megabytes (MB)
Python is commonly used to create things like websites, games, and graphic interfaces. T/F
True
Examples of application software include all of the following, except:
A. Microsoft Office
B. Google Chrome
C. Brightspace
D. Android
D. Android
Which of the following is an example of an input device?
A. Mouse
B. Speakers
C. Monitor
D. Processor
A. Mouse
A bit is the smallest unit of data in a computer. T/F
True
System software is used for __________.
A. Using the internet
B. Programming code
C. Specialized work for various operations
D. Managing a computer's resources
D. Managing a computer's resources
Python is considered a low-level language. T/F
False
What is Syntax?
A. Rules that say what the program means
B. A translator between the programming language and machine code
C. A tool to find and repair bugs
D. Rules that say what programs look like, and how the statements in the programming language are formed
D. Rules that say what programs look like, and how the statements in the programming language are formed
How many bytes are in a kilobyte?
A. 512
B. 8
C. 1000
D. 1024
D. 1024
Which of the following is not a device used to store data in a computer?
A. DVD
B. Flash Drive
C. Hard Drive
D. RAM
D. RAM
A string is a numerical type of data. T/F
False
Which of the following is an example of an integer?
A. True
B. "Hello, World!"
C. 4
D. 29.35
C. 4
What is the extension of the source file for a python program?
A. .python
B. .py
C. .source
D. .exe
B. .py
String values can never be converted to integer values. T/F
False
"Hello, World!" is a string T/F
True
Which of the following displays a proper string literal?
A. ProgrammerDialogue = 'Coding in python is fun!'
B. CNIT = I am a CIT student.
C. PurdueString = I attend Purdue University.
D. All the above
A. ProgrammerDialogue = 'Coding in python is fun!'
Python needs a main function to operate. T/F
False
Which of the following is an example of a comment in python?
A. // This is a comment in python.
B. # This is a comment in python.
C. $ This is a comment in python
D. * This is a comment in python.
B. # This is a comment in python.
Which of the following is an example of a boolean value?
A. "Welcome"
B. True
C. 23.546
D. 4
B. True
Which of the following is a legal variable name?
A. student name
B. student-name
C. 1studentname
D. studentname1
D. studentname1
print() is an example of an input T/F
False
Which of the following is true about an integer?
A. True is an integer
B. An integer is a textual data type
C. An integer can contain decimals
D. An integer can be stored as a variable
D. An integer can be stored as a variable
Rules of naming identifiers include the following, except:
A. Can include a space.
B. Starting with a letter or an underscore, followed by a sequence of letters, digits, and underscores.
C. The name is case sensitive.
D. The name must not be a reserved/keyword.
A. Can include a space.
What is the name of the python functions that tells you a class's type?
A. Type
B. Print
C. Define
D. Input
A. Type
Values cannot be converted from one type to another T/F
False
What is the value of the following expression?
9 + 3 2 * 2 / (18-16)
15
Which of the following operators has the highest priority in an expression?
A. +
B. /
C. ()
D. **
C. ()
Which is the output of the following code?
x = John
print("Hello ", x)
Hello John
Which of the following is a proper name for a variable?
A. True
B. StudentID
C. Class Roster
D. 1studentname
B. StudentID
What is the output of the following code?
Output = 11 / 2
print(int(Output))
5
Boolean values are case sensitive T/F
True
The print function does not return a value T/F
True
Which of the following import statements is correct to use math functions?
A. import math from *
B. import math
C. from * import math
D. from math import all
B. import math
The ^ operator is the same as the ** operator in Python. T/F
False
What is the output of the following code?
StudentIDJohn = 84219643
StudentIDEmily = 41305431
print(str(StudentIDJohn) + " " + str(StudentIDEmily))
84219643 41305431
Which of the following will increment the data variable by 4?
A. data %= 4
B. data += 4
C. data = 4
D. data *= 4
B. data += 4
7%3 is the same as 7//3. T/F
False
Any inputted data is considered string data, regardless of what the user inputted. T/F
True
Which of the following is a valid identifier in Python?
A. first-name
B. radius 3
C. vel12city
D. 1smith
C. vel12ciry
Which data type is 19.256?
A. integer
B. string
C. float
D. list
C. float
Which of the following is NOT a rule for naming an identifier?
A. The name must not be a reserved/keyword.
B. Starts with a letter, underscore, or number, followed by a sequence of letters, digits, and underscores.
C. It must not include a space.
D. The name is case sensitive.
B. Starts with a letter, underscore, or number, followed by a sequence of letters, digits, and underscores.
Evaluate 10 % 3.
A. 1
B. 3.33
C. 30
D. 3
A. 1
Which expression is written correctly?
A. 2x
B. 3(2a)
C. 3(4 + 3)
D. 5 * (7 + 4)
D. 5 * (7 + 4)
Which of the following is equal to n = n - 2?
A. n =- 2
B. n -= 2
C. n = -2
D. n = 2 - 2
B. n -= 2
The expression (2 +2 / 2 * 3) results in an integer value. T/F
False
Evaluate 12 + (3 ** 2)
21
Exponentiation has the highest priority, and is always calculated first. T/F
False
What is the output of the following code?
Day = 22
Month = 11
Year = 2021
print(Month, Day, Year, sep="/")
11/22/2021
Evaluate 20 // 3
6
(// is floor division, rounding down to the nearest whole number)
Evaluate 40 / (4 + 6) - 3*2
-2
Syntax Errors occur when a program provides you with actual outputs that are different from the desired outputs (The program runs but it gives wrong results). T/F
False
Assume a = 7;
b = 2;
Evaluate a // b.
3
Operations cannot be performed on strings. T/F
False
What is the term for a programming error?
A. Problem
B. Bug
C. Error
D. Syntax
B. Bug
Which of the following add up all the values in the list mylist and sets it to the variable total?
A. total = add(mylist)
B. total = sum(mylist)
C. total = count(mylist)
D. total = total(mylist)
B. total = sum(mylist)
Which of the following refer to the last element in a list names?
A. names[len(names)]
B. names[len(names)]
C. names[-0]
D. names[-1]
D. names[-1]
The list needs one more city added to the end - "Cario". Which piece of code below would do this?
cityList = ["Washington D.C.", "London", "Sydney", "Rio de Janeiro", "Seoul"]
A. cityList.append("Cario")
B. cityList.add("Cario")
C. cityList.push("Cario")
D. cityList.append[Cario"]
A. cityList.append("Cario")
Suppose list1 is [1, 3, 2], What is the result of list1 * 2?
[1, 3, 2, 1, 3, 2]
Which of the following would declare an empty list?
A. EmptyList = []
B. EmptyList[]
C. EmptyList = ()
D. EmptyList = ["empty"]
A. EmptyList = []
What output will this code produce?
color = []
color = ["blue", "green", "red"]
color.reverse()
print(color)
["red", "green", "blue"]
What will be the value of m[1][2] If you have the following m list:
m = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15]]
8
In the following list, what is the value at index 1 (names[1])?
names = ['Fred', 'John', 'Sue']
John
Which of the following is the correct code for creating a list of names?
A. nameList = ['John', 'Harry', 'Jesse', 'John', 'Harry', 'Harry']
B. nameList = John, Harry, Jesse, John, Harry, Harry
C. nameList = ('John', 'Harry', 'Jesse', 'John', 'Harry', 'Harry')
D. nameList = [John, Harry, Jesse, John, Harry, Harry]
A. nameList = ['John', 'Harry', 'Jesse', 'John', 'Harry', 'Harry']
Given a tuple t = (3, 6, 2, 4), which of the following will result in errors?
A. print(t[2])
B. t[0] = 5
C. print(max(t))
D. print(len(t))
B. t[0] = 5
What is the output of the following code segement?
sampleList = [10, 20, 30, 40, 50]
sampleList.append(60)
print(sampleList)
sampleList.append(60)
print(sampleList)
[10, 20, 30, 40, 50, 60,]
[10, 20, 30, 40, 50, 60, 60]
What is the output of the following list operation?
cityList = ["Washington D.C.", "London", "Sydney", "Rio de Janeiro", "Seoul"]
print(cityList[1:3])
["London", "Sydney"]
Which of the following will remove the second value from the list sampleList?
A. del sampleList[2]
B. remove sampleList[2]
C. del sampleList[1]
D. remove sampleList[1]
C. del sampleList[1]
What is the output of the following code?
sampleList = [10, 20, 30, 40, 50]
sampleList[-2] = 20
print(sampleList)
[10, 20, 30, 20, 50]
What is the output of the following print statement?
sampleList = [10, 20, 30, 40, 50, 60]
print(sampleList[-2])
50
Which of the following options will correctly add the elements of ListTwo to ListOne in Python.
ListOne = ["a", "b", "c", "d"]
ListTwo = ["e", "f", "g"]
A. ListOne = ListOne.extend(ListTwo)
B. ListOne.add(ListTwo)
C. ListOne = ListOne +ListTwo
D. ListOne + ListTwo
C. ListOne = ListOne +ListTwo
Which output will the following code produce?
color = []
color = ["blue", "green", "red"]
print(color[2])
red
Which of the following will randomize the order of elements in a list sampleList? Assume that the required library has been imported correctly.
A. sort(sampleList)
B. shuffle(sampleList)
C. random(sampleList)
D. randomize(sampleList)
B. shuffle(sampleList)
list1 = [1, 2, 3, 4]
list2 = [5, 6, 7, 8]
print ( len(list1 + list2) )
8
Passing a list as an argument passes a copy of the list. T/F
False
Lists are mutable T/F
True
The built-in function split() return a list T/F
True
The index of the first value in a python list is 1 T/F
False
Lists are a type of data structure that can store many values under one name T/F
True
Analyze the following code:
count = 0
while count < 100:
#Point A
print("Welcome to Python!")
count += 1
#Point B
#Point C
A. count < 100 is always True at point c
B. count < 100 is always True at point b
C. All answers are False
D. count < 100 is always True at point A
B. count < 100 is always True at point b
While loops are pretest loops T/F
True
In Python, the division operator (/) gives a float result, even if both of the numbers are integers T/F
False
What is the output of the following code?
n = 20
while (n <= 25):
print(n,"\n")
n = n+1
20,21,22,23,24,25
If we want score to be a random number in the range of [10.0, 50.0), which statement would be correct (assuming the random library has been imported)?
A. score = 40.0 * random + 10.0
B. score = 50.0 * random + 10.0
C. score = 10.0 * random + 40.0
D. score = random() + 50.0
A. score = 40.0 * random + 10.0
The expression 3 ** 3 - (6-2)/2 has the value _____. Is it an integer or a float value? __________________.
A. 7, int
B. 25, float
C. 7, float
D. 25, int
B. 25, float
Suppose you're given a list of words, intList. Write Python code that will print one line for each number, repeating that number twice. For example, if intList is [60, 70, 80, 90], then your code would print:
60 60
70 70
80 80
90 90
def main():
intList = [60, 70, 80, 90]
for i in range(0, len(intList)):
print(intList[i], " ", intList[i], "\n")
i += 1
main()
Write a Python program to check if the letter 'e' is in a given string:
Example:
Enter a string: play
The letter e is not exist in the string.
Enter a string: Umbrella
The letter e is exist in the string.
def main():
userinput = input("Enter a string: ")
userinputupper = userinput.upper()
numE = userinputupper.count("E")
if numE > 0:
print("The letter e is exist in the string.")
else:
print("The letter e is not exist in the string.")
main()
Write a Python program that requests an integer from the user. If the value is between 1 and 100 inclusive, print "OK". Otherwise, do not print anything.
The input function returns a boolean if the user types in True. T/F
True
Strings can be used as a sequence in a for loop. T/F
True
Which of the following range function syntax is incorrect?
A. range(0, 3, 5)
B. range(10, 4, -1)
C. range(1, 3, 1)
D. range(1, 2.5, 4.5)
D. range(1, 2.5, 4.5)