CS Review Questions 2
Which of the following best describes the relationship between the World Wide Web and the Internet?
The World Wide Web is a system of linked pages, programs, and files that is accessed via a network called the Internet.
composition of functions
Using the result from one block as the input to another
data type
What kind of data something is (number, text string, list, etc.)
Which of the following code segments can be used to interchange the values of the variables num1 and num2 ?
temp ← num1 num1 ← num2 num2 ← temp
Three words are stored in the variables word1, word2, and word3. The values of the variables are to be updated as shown in the following table. Which of the following code segments can be used to update the values of the variables as shown in the table?
temp ← word1 word1 ← word3 word3 ← temp
Which of the following are true statements about the data that can be represented using binary sequences? 1. Binary sequences can be used to represent numbers. 2. Binary sequences can be used to represent video. 3. Binary sequences can be used to represent controller inputs.
1 2 and 3
abstract data type
A custom data type that's meaningful to your program
Imagine this instruction has been run already: long list of states and capitals
Alabama
element
Another name for an item in a list
Binary 11 Binary 1110 Decimal 10 Decimal 16 Which of the following lists the values in order from least to greatest?
Binary 11, Decimal 10, Binary 1110, Decimal 16
constructor
Constructs one example of the data structure
Three different numbers need to be placed in order from least to greatest. For example, if the numbers are ordered 9, 16, 4, they should be reordered as 4, 9, 16. Which of the following algorithms can be used to place any three numbers in the correct order?
If the first number is greater than the middle number, swap them. Then, if the middle number is greater than the last number, swap them. Then, if the first number is greater than the middle number, swap them.
traversing
Looking at each item of the list
A programmer is developing software for a social media platform. The programmer is planning to use compression when users send attachments to other users. Which of the following is a true statement about the use of compression?
Lossy compression of an image file generally provides a greater reduction in transmission time than lossless compression does.
Which of the following is NOT a reason for someone to make their own block while programming?
Make the code have everything in one block so you don't have to see all the code
Which of the following are benefits of procedural abstraction?
Procedural abstraction provides an opportunity to give a name to a block of code that describes the purpose of the code block. Procedural abstraction makes it easier for people to read computer programs.
selector
Selects one piece of the data structure
data abstraction
The creation and use of abstract data types in a program
firstList ← ["cookie", "cake", "chocolate"] secondList ← ["red", "green", "blue"] thirdList ← [] thirdList ← secondList secondList ← firstList firstList ← thirdList whats the contents of firstList
["red", "green", "blue"]
sublist
a list used as an item of another list
primitive data type
data types that are built in