CS101 Final

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

A computer is a single device that performs different types of tasks for its users. A. True B. False

A

Both clauses would generate the same number of loop iterations. for num in range(4): for num in range(1, 5): A. True B. False

A

Decision structures are also known as selection structures. A. True B. False

A

If a whole paragraph is included in a single string, the split() method can be used to obtain a list of the sentences in the paragraph. A. True B. False

A

Invalid indexes do not cause slicing expressions to raise an exception. A. True B. False

A

Lists are dynamic data structures such that items may be added to them or removed from them. A. True B. False

A

Python allows a programmer to break a statement into multiple lines. A. True B. False

A

The index -1 identifies the last character of a string. A. True B. False

A

To assign a value to global variable in a function, the global variable must be first declared in the function. A. True B. False

A

When a function is called by its name during the execution of its program, then it is ____. A. executed B. located C. defined D. exported

A

When using the camelCase naming convention, the first word of the variable name is written in lowercase and the first characters of all subsequent words are written in uppercase. A. True B. False

A

Where does a computer store a program and the data that the program is working with while the program is running? A. in the main memory B. in the CPU C. in secondary storage D. in the microprocessor

A

Which of the following describes what happens when a piece of data is written to a file? A. The data is copied from a variable in RAM to a file. B. The data is copied from a variable in the program to a file. C. The data is copied from the program to a file. D. The data is copied from a file object to a file.

A

Which of the following would you use if an element is to be removed from a specific index? A.a del statement B. a remove method C. an index method D. a slice method

A

Which step creates a connection between a file and program? A. open the file B. read the file C. process the file D. close the file

A

A list cannot be passed as an argument to a function. A. True b. False

B

A local variable can be accessed from anywhere in the program. A. True B. False

B

A(n) __________ structure is a logical design that controls the order in which a set of statements execute. A. function B. control C. sequence D. iteration

B

According to the behavior of integer division, when an integer is divided by an integer, the result will be a float. A. True B. False

B

All programs are normally stored in ROM and are loaded into RAM as needed for processing. A. True B. False

B

How many types of files are there in Python? A. One B. Two C. Three D. More than three

B

If a file with the specified name already exists when the file is opened and the file is opened in 'w' mode, then an alert will appear on the screen. A. True B. False

B

In Python, math expressions are always evaluated from left to right, no matter what the operators are A. True B. False

B

Programs are commonly refereed to as... A. system Software B. software C. application programs D. utility programs

B

Python allows you to compare strings, but it is not case sensitive A. True B. False

B

The "not" operator is a unary operator which must be used in a compound expression. A. True B. False

B

The Python language is not sensitive to block structuring of code. A. True B. False

B

The first line in a while loop is referred to as the condition clause. A. True B. False

B

The remove method removes all occurrences of an item from a list. A. True B. False

B

What are the data items in a list called? A. data B. elements C. items D. values

B

What is the process of retrieving data from a file called? A. retrieving data B. reading data C. reading input D. getting data

B

Multiple Boolean expressions can be combined by using a logical operator to create __________ expressions. A. sequential B. logical C. compound D. mathematical

C

The decision structure that has two possible paths of execution is known as... A. single alternative B. double alternative C. dual alternative D. two alternative

C

What is an advantage of using a tuple rather than a list? A. Tuples are not limited in size B. Tuples can include any data as an element C. Processing a tuple is faster than processing a list D. There is no advantage

C

What was the worlds first programmable computer? A. IBM B. Dell C. ENIAC D. gateway

C

What will be assigned to the variable some_nums after the following code executes? special = '0123456789' some_nums = special[0:10:2] A. '0123456789' B. '24682468' C. '02468' D. '02020202020202020202'

C

When working with multiple sets of data, one would typically use a(n)... A. list B. tuple C. nested list D. sequence

C

Which of the following is associated with a specific file and provides a way for the program to work with that file? A. the filename B. the file extension C. the file object D. the file variable

C

Given that the customer file references a file object, and the file was opened using the 'w' mode specifier, how would you write the string 'Mary Smith' to the file? A. customer file.write('Mary Smith') B. customer.write('w', 'Mary Smith') C. customer.input('Mary Smith') D. customer.write('Mary Smith')

D

The primary difference between a tuple and a list is that... A. you don't use commas to separate elements in a tuple B. a tuple can only include string elements C. a tuple cannot include lists as elements D. once a tuple is created, it cannot be changed

D

What will be displayed after the following code is executed? total = 0 for count in range (1,4) : total += count print(total) A. 1 3 6 B. 5 C. 1 4 D. 6

D

When a file has been opened using the 'r' mode specifier, which method will return the file's contents as a string? A. write B. input C. get D. read

D

Which list will be referenced by the variable number after the following code is executed? number = range(0, 9, 2) A.[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] B. [1, 3, 5, 7, 9] C. [2, 4, 6, 8] D. [0, 2, 4, 6, 8]

D

A ______ structure causes a set of statements to execute repeatedly.

repetitive


Kaugnay na mga set ng pag-aaral

مقدمة في المنطق الرياضي والهندسة المستوية

View Set

Topic 1 - The Study of Life - SL

View Set

Module 5: Price Elasticity or Demand and Supply

View Set