CodeHs Semester Test

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

What is the proper format for a single line comment in Karel?

// This is a comment

If black is 0 and white is 1, which of the following binary codes creates the smiley face pixel image below?

00100100 00000000 01000010 00111100 00000000

Say Karel is on a location with one tennis ball. After the following code runs, how many tennis balls will there be at that location? for (var i = 0; i < 3; i++) { if (ballsPresent()) { takeBall(); } else { putBall(); putBall(); } }

1

What is the result of the following HTML code: <ol> <li>Bread</li> <li>Milk</li> <li>Eggs</li> </ol>

1. Bread 2. Milk 3. Eggs

Consider the following numbers: The decimal value 1010 The binary value 10012 Hexadecimal value C16 Which of the following lists the numbers in order from least to greatest?

10012, 1010, C16

What is the decimal value of 11012?

1310

How many different digits are used in the Hexadecimal number system?

16

How many different values can be represented using 4 bits?

16 different values

An online store uses 8-bit binary values to identify each unique item for sale. The store plans to increase number of items it sells and is considering changing to 9-bit binary values. Which of the following best describes the result of using 9-bit values instead of 8-bit values?

2 times as many items can be uniquely identified

A news website uses 32-bit integers to count the number of times an article has been viewed. The website is becoming more popular, and expects some of the articles to exceed the number of views that can be represented with 32 bits. In anticipation of this, the website is planning to change to 64-bit integers for the view counter. Which of the following best describes the result of using 64-bit integers instead of 32-bit integers?

232 times as many values can be represented

Suppose the ESPN website uses 8-bit unsigned integers to store how many points a team has scored in an NBA game.For example:0000 0010 represents 2 points0000 1000 represents 8 points What is the highest possible score the ESPN website could display?

25510

How many total times will Karel move in this program? function start() { move(); for (var i = 0; i < 5; i++) { move(); putBall(); } }

6

Which of the following is the proper format for an HTML tag?

<h1>Content Affected by Tag</h1>

An image is hosted at https://upload.wikimedia.org/wikipedia/commons/6/62/Big_and_little_dog.jpg Which of the following is the proper HTML code to display this image on your webpage?

<img src="https://upload.wikimedia.org/wikipedia/commons/6/62/Big_and_little_dog.jpg">

Suppose you are making a music streaming website and you want to make a page that displays a user's music library. Which of the following is the proper HTML code to create the following table: Title Artist Length CD Jam Rooney Pitchford 3:55 Memory Tom Misch 5:41

<table border="1"> <tr> <th>Title</th> <th>Artist</th> <th>Length</th> </tr> <tr> <td>CD Jam</td> <td>Rooney Pitchford</td> <td>3:55</td> </tr> <tr> <td>Memory</td> <td>Tom Misch</td> <td>5:41</td> </tr> </table>

What is wrong with this for loop? for (var i = 0, i < 10, i + 1) { move(); } A. The for loop uses commas instead of semicolons B. It should say i++ instead of i + 1

A and B

Which of the following statements is the simplest and most accurate definition of a computer?

A computer is something that performs calculations by following and executing specific instructions to solve a problem.

Which of the following choices correctly orders the early types of computers from earliest to most recent?

Abacus, Analytical Engine, ENIAC, IBM Laptop

Why do we use functions in Karel programs?

All of the above; Break down our program into smaller parts Avoid repeating code Make our program more readable

Why does a programmer indent their code?

All of the above; Helps show the structure of the code. Easier for other people to understand. A key part of good programming style!

A computer program uses 3 bits to represent integers. When the program adds the decimal (base 10) numbers 6 and 2, the result is 0. Which of the following is the best explanation for this result?

An overflow error occurred.

Suppose you have written a web page using HTML and CSS and it is hosted at the URL yourdomain.com/home.html Which of the following statements is true about which devices can view your website?

Any browser on any device will be able to view your webpage, because all browsers and devices on the Internet agree to use the same protocols for sending, receiving, and viewing webpages.

Which number system is used to store information digitally in a computer?

Binary (base 2)

Which of the following choices lists the three main components of a computer's hardware?

CPU, Memory, Motherboard

In this code, how many times is the dance function called and how many times is it defined? function start() { move(); dance(); move(); move(); turnLeft(); dance(); dance(); } function dance() { turnLeft(); move(); turnLeft(); turnLeft(); move(); turnLeft(); }

Called 3 times, defined 1 time

What does CPU stand for?

Central Processing Unit

How can we teach Karel new commands?

Define a new function

Say you want to write a program to have Karel put down 300 tennis balls. Which control structure would you use?

For loop

Which of the following pixels has a color value of #00ff00 (expressed in hexadecimal)

Green Pixle

What is generated from the following HTML code: <h1>Hello</h1> <h3>Hello</h3> <h6>Hello</h6>

Hello (Biggest) Hello (Medium) Hello (Small)

Which of the following could be TRUE for artificial Intelligence? I. It's the capability of a machine to imitate intelligent human behaviorII. It can easily be used to mimic human emotionsIII. It's a branch of computer science dealing with the simulation of intelligent behaviors in computersIV. It can be easily used to detect irony or sarcasm in a storyV. It can be easily used to read body language

I and III

Which of the following statements are true about styling your web pages with CSS: I. Styling with CSS is more scalable than using style= on each HTML tag that you want to styleII. You can create styles with CSS that are not possible using style= on an HTML tag

I only

Which of the following items is an example of a user application? I. BrowserII. Text editorIII. GamesIV. File Explorer

I, II, III, IV

Which of the following is an application of Artificial Intelligence? I. Game AI'sII. Foreign language translationIII. Recognizing handwriting

I, II, and III

In the following code, what would be a good Postcondition to write? /* Precondition: Karel is on a spot with a tennis ball facing East * Postcondition: ... */ function getOnTop() { turnLeft(); move(); turnRight(); }

Karel ends one spot above a tennis ball facing East.

What does the mystery function do? function mystery() { while (noBallsPresent()) { move(); } }

Karel moves until it is on a ball

Which of the following statements is something the operating system of a computer is responsible for doing?

Managing memory allocation for all applications.

Choose the option that correctly identifies this picture: "It's a picture of circuitry."

Motherboard

Which of the following devices is the device that connects all of the physical components of a computer together?

Motherboard

Which of the following choices is a brand-new application of computers, having come about in the past 5 years? I. Analyzing dataII. Solving mathematical equationsIII. Making predictions about future events based on data gathered about past events

None of the answers

Which part of the computer is responsible for managing memory allocation for all applications?

Operating system

CSS rules have a selector that defines which HTML elements the rule applies to. We've learned about the following CSS Selectors: Select by tag name Select by class name Select by id name Which of the following ranks the selectors from highest priority to lowest priority?

Select by id name, select by class name, select by tag name

If Karel starts at Street 1 and Avenue 1, facing East, where will Karel be, and what direction will Karel be facing after running the following code? (Assume the world is 10x10 in size) move(); turnLeft(); putBall(); turnLeft(); turnLeft(); turnLeft(); move(); turnLeft();

Street 1, Avenue 3, Facing North

Karel starts at Street 1 and Avenue 1, facing East. After calling the stairStep function twice, where will Karel be and what direction will Karel be facing? (assume this is a SuperKarel program and the world is 10x10 in size) function stairStep() { move(); turnLeft(); move(); turnRight(); }

Street 3, Avenue 3, Facing East

Which of the following best describes the difference between the domain and path of a URL?

The domain specifies where the browser's request should be sent. The path specifies exactly what file is being requested.

What's wrong with this code? function start() { move(); go(); go(); } function go() { move(); move(); } function go() { move(); move(); }

The go function has been defined twice

What makes the following command an invalid Karel command? turnleft();

The l should be a capital L

Which of the following classifies as metadata about a webpage?

The title of the webpage

Karel starts at Street 1, Avenue 1, facing East in a 5x5 world. What will happen after this code runs? move(); move(); turnRight(); move();

This code won't run because of a syntax error

Karel starts at Street 1, Avenue 1, facing East in a 5x5 world. What will happen after this code runs? move(); putball(); move(); move(); move(); move(); move();

This code won't run because of a syntax error

The RGB encoding scheme encodes a color using 24 bit sequences. The first 8 bits encode the amount of red in the color, the next 8 bits encode the amount of green in the color, and the last 8 bits encode the amount of blue in the color. Which of the following is a true statement about the color encoded by this binary sequence: 1110 1001 0111 1100 0000 1111

This color is mostly red.

What is the purpose of a network device?

To allow computers to connect and communicate with other computers.

What is the purpose of an output device?

To allow the computer to display or communicate the result of a computation

What is the purpose of an input device?

To allow the user to give data or information to the computer.

In the following code below from the Cleanup Karel example, what is the purpose of If Statement #2? // This program has Karel walk down the // row and clean up all of the tennis balls // on the way. function start() { while (frontIsClear()) { // If statement #1 if (ballsPresent()) { takeBall(); } move(); } // If statement #2 if (ballsPresent()) { takeBall(); } }

To pick up the ball that is in the last spot, if there is one

What is the purpose of using a for loop in code?

To repeat something a fixed number of times

What is top down design?

Top down design is a way of designing your program by starting with the biggest problem and breaking it down into smaller and smaller pieces that are easier to solve.

How can we improve the following program? function start() { move(); move(); move(); move(); move(); move(); move(); move(); move(); }

Use a for loop to repeat the move command

Question: 21 What condition should be used in this while loop to get Karel to pick up all the tennis balls on the current location? while (________) { takeBall(); }

ballsPresent()

What is the domain of this URL: www.example.com/home.html

example.com

Which of the following is the correct way to define a turnRight function in Karel?

function turnRight() { turnLeft(); turnLeft(); turnLeft(); }

Suppose you have the following CSS rules: p { color: green; } .fire { color: red; } #title { color: blue; } What font color will the following HTML element have after being styled by the given CSS: <p class="title">My First Paragraph</p>

green

Which of the following is a valid CSS rule?

h1 { color: blue; }

Which of the following commands is a valid Karel command?

move();

ASCII is a character encoding scheme that uses a numeric value to represent each character. A subset of characters (in the "Char" column) and their corresponding ASCII values are shown in the table below: ASCII characters can also be represented by hexadecimal (base 16) numbers. According to the ASCII character encoding, which of the following characters is represented by the hexadecimal (base 16) number 6E16

n

Suppose you have the following CSS rules: p { color: green; } .fire { color: red; } #title { color: blue; } What font color will the following HTML element have after being styled by the given CSS: <h1 class="fire">Welcome!</h1>

red

Which of the following is not a valid condition to go in an if statement for Karel?

turnLeft()

Refer to the ASCII table from Question 7. Which ASCII character is represented by the decimal (base 10) number 120?

x


Conjuntos de estudio relacionados

Micro Econ Chapter 15: Poverty and Income Distribution

View Set

Chapter 1 Fundamentals of Nursing Theory

View Set