Computer science U4 Review

¡Supera tus tareas y exámenes ahora con Quizwiz!

Which of the following is a simplified but equivalent Boolean expression to the following: (X > 0 AND X ? 20) OR (X > -5 AND X < 15)

(X > -5) AND (X ? 20)

onsider the following segment of code. IF (num > 10) { num mc026-1.jpg num * 2 } IF (num < 40) { num mc026-2.jpg num / 2

15

hat is not a concern when you are thinking about whether or not to compress your files?

Security of the files

Consider the following equivalent code segments that each display the first 12 positive and even integers.

Segment B will execute in less time than Segment A.

. Which of the following is an advantage that text-based programming languages (i.e. Processing) have over block-based programming languages (i.e. Scratch

Text-based programming languages offer programmers more detailed control over lower-level functionality when writing a program.

Which of the following is a true statement about data compression?

There are trade-offs involved in choosing a compression technique for storing and transmitting data

Consider the following procedure. PROCEDURE find (target, list) { i mc004-1.jpg 1 FOR EACH item IN list { IF (item = target) { DISPLAY (i) }

. Displays the positions of all occurrences of target in list

When web developers specify color values for text or backgrounds, they often represent RGB (red-green- blue) colors using a six-digit hexadecimal (base-16) value, such as #BF5700, in which the first two characters represent the red component of the color, the middle two characters represent the green component, and the final two characters represent the blue component. Each of these color components can be assigned one of 256 different values (decimal: 0 - 255, hexadecimal: 00 - FF), with lower values representing darker shades and higher values representing brighter shades. You want to configure the text on your blog to use a slightly darker shade of purple than the one you have seen used on another website. The purple used on that site has an RGB value of #7F20FF.

#3F107F

any websites can express colors in the form of an rgb( ) triplet or as a six-digit hexadecimal (base 16) value. What hexadecimal value is equivalent to rgb(175, 84, 192)?

#AF54C0

After conducting an online search for photos that you might use for your band's website, you find a particular photo of a funny-looking dog that you like. The photo appears on a professional photographer's website that he uses to display samples of his work. Along with the photo, the photographer has posted the following, "Attribution-No Derivatives Creative Commons License" for the work.

. c. You may use the original photo as the background image for your band's promotional website. d.You may print the photo on t-shirts that your band wears while performing on stage.

Which of the following matches the bitmap image?

00 38 44 3C 04 78 00 00

The program segment below is intended to move a robot in a grid to a gray square. The program segment uses the procedure called GoalReached, which evaluates to true if the robot is in the gray square and evaluates to false otherwise. The robot in each grid is represented by a triangle and is initially facing left. The robot can move into a white or gray square, but cannot move into a black region.

3l (white square) 2up 2r 2up 2r

A gaming console is being programmed to ask questions, such as "Do you love computer science?", of a user when they log into the system. The programmer wants to ensure that the user answers "Yes", so he creates a loop that will re-ask the question if the user answers "No" and continues to repeat the loop until the user answers "Yes." What type of loop would the programmer likely use in this scenario?

A while loop

Central High School has a graphics design course that is developing a historical online archive of the school. The original photos of the school and its history are being digitally scanned and will be placed onto the archival website they are creating. Because of the historical contexts of the school, they wish to have the highest quality pictures available while at the same time allowing for efficiency in searching and downloading. However, due to the proprietary nature of the photos, the school wishes to not have the highest quality images possible available for download. What are some possible options for digital formats for the photos that will be placed on the website?

All of the above

A music artist has just finished creating his most recent single and it is now ready for release. The artist loves when others remix and reuse his harmonies, melodies and lyrics in their own unique ways, so he is going to publish it online using a Creative Commons license. What license should he use if he is asking that his original work is acknowledged and that the person originally remixing his project, along with anyone else, does not make any money from the new w

Attrivition-NonCommercial-Share Alike

order to be inducted into a school's National Honor Society (NHS), they must meet certain criteria for their GPA, serviceHours and grade. The expression below indicates whether a student has been accepted as a member of the NHS. (GPA ? 3.65) AND (serviceHours ? 30) AND (NOT grade = 9)

GPA = 3.65, serviceHours = 30, grade = 12

Stinky Salmon is a new movie rating app that allows users to rate movies in real time in while watching in a theater. The rating scale they have developed for the app are in hierarchical order: 5-Fresh Catch, 4-Day Old, 3-Leftover, 2-Smells Fishy, 1-Pink Slime. Which of the following pseudocode algorithms would be a good representation of the app's intended rating system? (Note: The parameter rating would be the user's input.)

PROCEDURE(rating) { IF(rating > 0 AND rating < 2) { DISPLAY("Pink Slime") } IF(rating > 1 AND rating < 3) { DISPLAY("Smells Fishy") } IF(rating > 2 AND rating < 4) { DISPLAY("Leftover") } IF(rating > 3 AND rating < 5) { DISPLAY("Day Old") } IF(rating > 4 AND rating < 6) { DISPLAY("Fresh Catch") } }

The question below uses a robot in a grid of squares. The robot is represented by a triangle which is initially located in the center square facing towards the top Which of the following code segments would successfully move the robot to the grey square?

REPEAT 2 TIMES { MOVE_FORWARD () REPEAT 2 TIMES { ROTATE_RIGHT () MOVE_FORWARD () } ROTATE_LEFT ()

A graphic designer is hired to create a new logo for their client. This client gave them the following as a guide for what they wanted and is in order of precedence: -logo needs to have clean lines, even when scaled to different sizes -logo must use only a few colors -final logo size must not be large Which of the following types of images should the graphic designer create based on the guideline

SVG

Given below is a segment of pseudocode. Reading the code, determine the expected output on the print line? INPUT(TEMP) { TEMP f 9/5 * (float(TEMP)) + 32 DISPLAY(________

The current temperature is" + TEMP + "degrees Fahrenheit.

Consider the following algorithm for manipulating the individual pixels of a digital RGB image of a panda bear surrounded by dense green jungle foliage. Algorithm: For each pixel, swap the values in the green and blue channels, leaving the red channel alone. Which of the following best describes the resulting image?

The panda's fur will appear black and white, but the foliage will appear to be tinted blue.

Which of the following best describes the resulting image?

The resulting image will be a grayscale version of the original image

n office building has two floors. A computer program is used to control an elevator that travels between the two floows, physical sensors are used to set the following Boolean variables.

b. (onFloor1 AND callTo2) OR (onFloor2 AND callTo1)

When digitizing a recording of a musical performance, which of the following strategies will result in a more accurate digital representation of the original music? Select two answers.

b. Increasing the sampling rate of the music being digitized Increasing the bit depth of the music being digitized

he procedure prime returns a value of "PRIME" if number is prime (divisible by only 1 and itself) and returns "NOT PRIME" otherwise. PROCEDURE prime (number) { divisor mc021-1.jpg number count mc021-2.jpg 0 REPEAT number TIMES { IF (number MOD divisor = 0) { count mc021-3.jpg count + 1 } divisor mc021-4.jpg divisor - 1 } IF (<MISSING CODE>) { RETURN ("PRIME") } ELSE { RETURN ("NOT PRIME") } } Assuming number must be larger than 1, what must go in the <MISSING CODE> section to make this procedure work as expected?

count=2

Which of the following is an advantage that block-based programming languages (i.e. Scratch) have over text-based programming languages (i.e. Processing)?

lock-based programming languages do not require the programmer to worry about syntax, capitalization, or punctuation.

Consider the following code segment which moves the robot in the grid. n mc014-2.jpg 3 REPEAT 3 TIMES { REPEAT n TIMES { MOVE_FORWARD( ) } ROTATE_LEFT( ) n mc014-3.jpg n - 1 } Which of the following shows the location of the robot after running the code segment

Arrow points down, 3rd row and 3rd square

Images used in web page development are often raster images. What is the primary disadvantage of using raster images?

Enlarging a raster image degrades the image

A summer camp offers a morning session and an afternoon session. The list morninglist contains the names of all children attending the morning session, and the list afternoonlist contains the names of all children attending the afternoon session. Only children who attend both sessions eat lunch at the camp. The camp director wants to create a lunchlist, which will contain the names of children attending both sessions. The following code segment is intended to create lunchlist, which is initially empty. It uses the procedure IsFound (list, name), which returns true if child is found in list and returns false otherwise. FOR EACH child IN morninglist { <MISSING CODE> } Which of the following could replace the missing code so that it works intended?

IF (IsFound (afternoonList, child)) { APPEND (lunchList, child)

. Which of the following best describes the result of running the program below? number mc028-1.jpg RANDOM (1, 6) REPEAT UNTIL number > 100 { number mc028-2.jpg number * 2 } IF (number = 128) { DISPLAY (true) } ELSE { DISPLAY (false) }

If number is a 1, 2 or 4, then the program will display true.

A Hollywood sound designer has recorded a lion's roar that she plans to digitally alter and use as the voice of a small alien creature in an upcoming movie. Which of the following techniques would allow her to raise the pitch of the lion's roar so that it sounds like it comes from a much smaller fierce creature?

Increase the frequency so it plays at twice the speed

. Below is a small segment of code that is suppose to switch the values of X and Y in a program. Line 1: X mr049-1.jpg 4 Line 2: Y mr049-2.jpg 2 Line 3: X mr049-3.jpg Y Line 4: A mr049-4.jpg Y Line 5: Y mr049-5.jpg X Line 6: X mr049-6.jpg A Line 7: Y mr049-7.jpg A What two lines of code need to be removed in order for the code to function properly? Select two answers.

Line 3, Line 7

Which of the following is true about lossy and lossless compression

Lossless compression will allow a file to be compressed into a smaller form, but will not sacrifice the information needed to put it back together in its entirety.

he county clerk's office is writing a program to search their database for citizen records based on information about that citizen such as first name, last name, age, etc. Given below is a segment of pseudocode that should find the record of every citizen over the age of 50 in the county. However, there is a mistake in pseudocode. Determine the correct pseudocode to find the records of all citizens over the age of 50.

OR EACH item IN citzlist { WHILE(not end of citzlist) { IF(age > 50) { DISPLAY(name) } } }

A mathematician is trying to write a program to sum any given number of positive integers. On her first attempt, she wants to test the program for summing the numbers 1 through 20 Which of the following segments of pseudocode would accomplish this task?

PROCEDURE sumint { number f 1 count f 1 WHILE(count <= 20) AND (number >= 0) { sum f sum + number count f count + 1 }

. Images composed of a set of digital values called pixels is most commonly called

Raster images

Which of the following audio editing techniques refers to the creation of artificial digital sounds by digitally generating and combining select frequencies of sound waves?

Sampling

Creating a procedural program is preferential when considering the efficiency of an algorithm. This process of abstraction creates a greater level of efficiency. Which of the following is most desirable in abstraction?

Simplicity

A photographer has shot a photo session using RAW format. The client wishes to preview the photo shoot and requests that a series of photos be sent via email. The files are too large for most email servers and must be compressed in order to be emailed. Which of the following is correct about a compression of the files if the client wants to see the best quality photos

The files must be compressed using a lossless compression

o students are trying to combine their decks of Pokémon cards so that they make one large deck of cards that contains exactly one of each unique type of Pokémon card that they own - in alphabetical order. In order to do this, the students start with two lists, deck1 and deck2, which are lists of all Pokémon cards each student owns (duplicates included) and the following available procedures.

combinedDeck mc027-9.jpg RemoveDups(combinedDeck) c. combinedDeck mc027-10.jpg Add(deck1, deck2) combinedDeck mc027-11.jpg RemoveDups(combinedDeck) combinedDeck mc027-12.jpg Alphabetize(combined

. A programmer completes the user manual for a video game she has developed and realizes she has reversed the roles of "goats" and "sheep" throughout the text. Consider the programmer's goal of changing all occurrences of "goats" to "sheep" and all occurrences of "sheep" to "goats". The programmer will use the fact that the word, "foxes" does not appear anywhere in the original text. Which of the following algorithms can be used to accomplish this

es of "sheep" to "foxes" and then change all occurrences of "foxes" to "goats". c. First, change all occurrences of "goats" to "foxes", then change all occurrences of "sheep" to "goats" and then change all occurrences of "foxes" to "sheep"

A teacher uses the following program to adjust student grades on an assignment by adding 5 points to each student's original grade. However, if adding 5 points to a student's original grade causes the grade to exceed 100 points, the student will receive the maximum possible score of 100 points. The students' original grades are stored in the list gradeList, which is indexed from 1 to n. i mr050-1.jpg 1 REPEAT n TIMES { <MISSING CODE> i mr050-2.jpg i + 1 } The teacher has the following procedures available. min (a, b): Returns the lesser of the two values a and b max (a, b): Returns the greater of the two values a and b Which of the following code segments can replace <MISSING CODE> so that the program works as intended? Select two answers.

gradeList [i] mr050-3.jpg min (gradeList[i] + 5, 100) gradeList [i] gradeList[i] + 5 IF (gradeList [i] > 100) { gradeList [i] 100 }

A student is creating a filter that can be applied to an image. Once the filter is applied, the new image completely replaces the original image and any information about the original image is lost. Which of the following filters described below would demonstrate a lossy transformation of the digital image?

he image is converted to grayscale by averaging the RGB values for individual pixels and then applying the averaged numbers as the new RGB colors for the pixels.

A movie studio has acquired the original film recordings from a now defunct studio that has a library of previously unreleased movies. As part of the purchase, the studio plans to re-release the recordings in digital format for distribution on online music services. When the recording is re-mastered, it is saved in MPEG-4 format. What type of file degradation will take place during this recording process

lossy

Which of the following statements about lossless image formats, like PNG, and lossy image formats, like JPEG, is true?

lossy image formats sacrifice detail within an image in order to achieve smaller file sizes.

In order to program a robot to move around within a two-dimensional space, a programmer considers four different designs for defining the robot's behavior. Which of the following sets of procedures would be the best design in terms of the readability, efficiency and flexibility of the resulting program?

move(dir, dist): Moves the robot dist spaces in the dir direction, where dist is a number and dir is NORTH, SOUTH, EAST or WES

The procedure trace(x, y, a, b) is used to describe how a computer should create lines on a grid. The x and y represent the horizontal and vertical positions, respectively, of the start of the line and the a and b represent the horizontal and vertical positions, respectively, of the end of the line. The upper-left corner of the grid is represented as the horizontal and vertical position of 0 and 0 and the bottom right-hand corner of the grid is represented by 400 and 400. Grid lines are pre-drawn every 100 units. Consider the following code. trace(100, 100, 300, 300) trace(300, 100, 100, 100) trace(200, 400, 200, 0)

picture looks like a sideways A

erson is trying to remember a list of 12 different items: snow, strawberry, football, banana, soccer, rain, apple, tennis, sleet, hail, orange, rugby In order to better remember them, he compresses the original list into something shorter that is easier to remember. Which of the following would be a compression that would best help him remember the 12 items?

weather(rssh) fruit(sabo) sport(fstr

What would be the most appropriate name for the following procedure, where number is any number and the procedure CHECK (number) returns true if the number is an integer and false if not?

IS_POS_INT (

The procedure Max(list) is used to find the maximum number in list and display that number. Below is the procedure described above. PROCEDURE Max(list) { maximum mr046-1.jpg 0 FOR EACH number IN list { IF (number > maximum) { maximum mr046-2.jpg number } } DISPLAY (maximum) } Which list assignments will demonstrate that the procedure does NOT work as intended? Select two answers.

b. list mr046-4.jpg [-5, -3, -10, -8, -1], d. list mr046-6.jpg [ ]


Conjuntos de estudio relacionados

Med Serge: cardiovascular, hematologic, and lymphatic system

View Set

Redox Reactions & Net Ionic Equations

View Set

Macro Unit 3 Quizzes (Ch. 11, 12, 17)

View Set