Computer Science Quiz: Programming Concepts and Terminology, Study notes of Computer Science

A series of questions and answers covering fundamental concepts in computer science, including programming languages, data structures, object-oriented programming, and operating systems. It serves as a valuable resource for students to test their knowledge and understanding of key topics. The questions cover a range of subjects, from basic syntax and data types to more advanced concepts like polymorphism and file handling. This quiz is designed to reinforce learning and identify areas for further study, making it an effective tool for both self-assessment and exam preparation. It includes questions about compilers, accumulators, data attributes, iteration, polymorphism, file types, and memory management. The quiz also covers essential programming practices and command-line operations, providing a comprehensive review of computer science fundamentals.

Typology: Study notes

2025/2026

Available from 12/23/2025

cecil27
cecil27 🇺🇸

1.6K documents

1 / 19

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Pyth Programming Language:
Understanding Strings, Control
Statements, and Functions - Prof,
Study notes of Computer Science
________ are relational operators.
and, or
if-else
=
>, <, >=, <=, ==, != - correct answer>, <, >=, <=, ==, !=
A __________ -controlled loop repeats a specific number of times.
counter
decision
Boolean
sentinel/condition - correct answercounter
A __________ -controlled loop uses a true/false condition to control the number of
times that it repeats.
decision
sentinel/condition
counter
Boolean - correct answersentinel/condition
A __________ is a name that references a value in the computer's memory.
variable
register
RAM slot
byte - correct answervariable
A __________ is a sequence of characters.
text block
string
character collection
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13

Partial preview of the text

Download Computer Science Quiz: Programming Concepts and Terminology and more Study notes Computer Science in PDF only on Docsity!

Pyth Programming Language:

Understanding Strings, Control

Statements, and Functions - Prof,

Study notes of Computer Science

________ are relational operators. and, or if-else =

, <, >=, <=, ==, != - correct answer>, <, >=, <=, ==, != A __________ -controlled loop repeats a specific number of times. counter decision Boolean sentinel/condition - correct answercounter A __________ -controlled loop uses a true/false condition to control the number of times that it repeats. decision sentinel/condition counter Boolean - correct answersentinel/condition A __________ is a name that references a value in the computer's memory. variable register RAM slot byte - correct answervariable A __________ is a sequence of characters. text block string character collection

char sequence - correct answerstring A __________ structure can execute a set of statements only under certain circumstances. Boolean circumstantial sequence decision - correct answerdecision A byte is enough memory to store a(n) __________ value. character exponential integer floating point - correct answercharacter A byte is made up of __________ bits. 2 8 16 4 - correct answer A compound Boolean expression created with the _________ operator is true if either of its sub expressions is true. not

= or and - correct answeror A compound Boolean expression created with the __________ operator is true only if both of its sub expressions are true. and

not or both - correct answerand A file that data is read from is known as a(n) output file sequential access binary file

A(n) __________ expression has a value of either true or false. input output assignment Boolean - correct answerBoolean A(n) __________ loop has no way of ending and repeats until the program is interrupted. timeless indeterminate interminable infinite - correct answerinfinite A(n) __________ makes a variable reference a value in the computer's memory. assignment statement variable declaration string literal math expression - correct answerassignment statement A(n) __________ program translates a high-level language program into a separate machine language program. translator assembler compiler utility - correct answercompiler A(n) __________ variable keeps a running total. constant valued counter sentinel accumulator - correct answeraccumulator A(n) ______________ is a component of a class that references data. method instance data attribute module - correct answerdata attribute A(n) ______________ method gets the value of a data attribute but does not change it.

mutator accessor retriever constructor - correct answeraccessor A(n) ______________ method stores a value in a data attribute or changes its value in some other way. modifier constructor accessor mutator - correct answermutator An object is a(n) ______________. variable cookie cutter instance blueprint - correct answerinstance and, or, and not are __________ operators. relational conditional logical ternary - correct answerlogical Before a file can be used by a program, it must be encrypted opened closed formatted - correct answeropened By doing this you can hide a class's attribute from code outside the class. begin the attribute's name with two underscores avoid using the self parameter to create the attribute begin the name of the attribute with private__ begin the name of the attribute with the @ symbol - correct answerbegin the attribute's name with two underscores Computers can only execute programs that are written in __________.

nouns name responsibilities synonyms - correct answerresponsibilities In one approach to identifying the classes in a problem, the programmer identifies the ______________ in a description of the problem domain. nouns adjectives verbs adverbs - correct answernouns In the __________ numbering system, all numeric values are written as sequences of 0s and 1s. octal hexadecimal decimal binary - correct answerbinary In the vi/vim editor what key must be pressed to go to command mode? shift-f cntrl esc i - correct answeresc It is not possible to call a superclass's init method from a subclass's init method. True False - correct answerFalse Only the init method can be overridden. True False - correct answerFalse Polymorphism allows you to write methods in a subclass that have the same name as methods in the superclass. True False - correct answerTrue

Refer to the following python code snippet: a = 100 b = 1 c = 5 while a > 1: b += 1 a=0. print(b,c) What is b? flag sentinel value counter boolean - correct answercounter Refer to the following python code snippet: a = 100 b = 1 c = 5 while a > 1: b += 1 a=0. print(b,c) What is the loop control variable? a c b 1 - correct answera

key() pop() - correct answerget() The _________ function returns the number of elements in a dictionary: len() count() elements() size() - correct answerlen() The _________ method returns a randomly selected key-value pair from a dictionary. rand_pop() popitem() pop() random() - correct answerpopitem() The _________ method returns all of a dictionary's keys and their associated values as a sequence of tuples. get() values() items() keys_values() - correct answeritems() The __________ translates an assembly language program to a machine language program. assembler translator compiler interpreter - correct answerassembler The ___________ operator takes a Boolean expression as its operand and reverses its logical value. either not and or - correct answernot The ______________ method is automatically called when an object is created. object str

init init - correct answer__init__ The ______________ programming practice is centered on creating functions that are separate from the data that they work on. procedural functional object-oriented modular - correct answerprocedural The ______________ programming practice is centered on creating objects. objective object-centric object-oriented procedural - correct answerobject-oriented The -= operator is an example of a(n) __________ operator. augmented assignment reverse assignment complex assignment relational - correct answeraugmented assignment The contents of this type of file can be viewed in an editor such as Notepad. English file binary file image file text file - correct answertext file The following function returns the number of elements in a set: size() elements() len() count() - correct answerlen() The part of a computer that runs programs is called __________. CPU secondary storage RAM main memory - correct answerCPU

This is an operator that raises a number to a power. / % **

    • correct answer** This is the first index in a string. 0 The size of the string minus one 1 -1 - correct answer This is the last index in a string. size of the string minus one 0 1 size of the string - correct answersize of the string minus one This operator can be used to find the difference of two sets.

& | ^ - correct answer- This operator can be used to find the intersection of two sets. &

|

^ - correct answer& This operator can be used to find the symmetric difference of two sets. & ^

| - correct answer^ This operator can be used to find the union of two sets.

^

| - correct answer| This operator determines whether one string is contained inside another string. is_in contains == in - correct answerin This operator performs integer division. % ** / // - correct answer// This set method removes an element but does not raise an exception if the element is not found. discard erase remove delete - correct answerdiscard This string method returns a copy of the string with all leading and trailing whitespace characters removed. rstrip remove_whitespace clean strip - correct answerstrip This string method returns a copy of the string with all leading whitespace characters removed. lstrip strip_leading remove rstrip - correct answerlstrip This string method returns the lowest index in the string where a specified substring is found.

undo mode command mode edit mode insert mode - correct answercommand mode What does mv my_file.py my_file2.py do? renames my_file2.py to my_file.py renames my_file.py to my_file2.py moves my_file2.py to the directory my_file.py moves my_file.py to the directory my_file2.py - correct answerrenames my_file.py to my_file2.py What is the command to create a directory? rmdir cdir mkdir cd - correct answermkdir What is the command to save a file in the vi/vim editor? :w :q :s :set nu - correct answer:w What is the return datatype of the function input()? string float integer boolean - correct answerstring When a program is finished using a file, it should do this. erase the file open the file close the file encrypt the file - correct answerclose the file When working with this type of file, you access its data from the beginning of the file to the end of the file. direct access

sequential access random access binary access - correct answersequential access When working with this type of file, you can jump directly to any piece of data in the file without reading the data that comes before it. sequential access binary access ordered access direct access - correct answerdirect access Which command allows you to get help on the command ls? help ls help list man list man ls - correct answerman ls Which command allows you to view the contents of a file without opening a text editor? ls -l pwd less cat - correct answercat Which command is used to print the path to the current working directory? path chmod cat pwd - correct answerpwd Which of the following statements will cause an error? x = 17 x = 42 % 7 17 = x x = '17' - correct answer17 = x You can add a group of elements to a set with this method. update add merge

if if-call test-jump if-else - correct answerif-else You use a(n) __________ statement to write a single alternative decision structure. test-jump if-elif-else if-else if - correct answerif You write this statement to respond to exceptions. run/handle try/handle try/except attempt/except - correct answertry/except