Search Header Logo

Variables and Assignments

Authored by Ms Seccafico

Computers

12th Grade

Used 91+ times

Variables and Assignments
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

The variable age is to be used to represent a person’s age, in years. Which of the following is the most appropriate data type for age ?

Boolean

number

string

list

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

The variable is Open is to be used to indicate whether or not a store is currently open. Which of the following is the most appropriate data type for isOpen ?

Boolean

number

string

list

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Media Image

Consider the following code segment.


What is the value of r as a result of executing the code segment?

10

20

30

40

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Media Image

Consider the following code segment.


What are the values of first and second as a result of executing the code segment?

The value of first is true, and the value of second is true.

The value of first is true, and the value of second is false.

The value of first is false, and the value of second is true.

The value of first is false, and the value of second is false.

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which of the following is a benefit of using a list as a data abstraction in a program?

Lists often allow their size to be easily updated to hold as many data values as needed.

Lists convert all elements to strings so that they can be inspected character-by-character.

Lists prevent duplicate data values from appearing in the list.

Lists are used to store all input data so that there is a running record of all user input.

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

A programmer has a need to round many numeric values to the nearest integer. Which of the following best explains the benefit of using a list as a data abstraction in this situation?

Keeping the numeric values in a list makes it easier to round a number to the nearest integer.

Keeping the numeric values in a list makes it easier to apply the same computation to every data element.

Keeping the numeric values in a list makes it easier to prevent a program from unintentionally changing the value of a variable.

Keeping the numeric values in a list makes it easier to prevent a program from attempting to access an index beyond the length of the list.

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Assume that both lists and strings are indexed starting with index 1.

The list wordList has the following contents.

["abc", "def", "ghi", "jkl"]


Let myWord be the element at index 3 of wordList. Let myChar be the character at index 2 of myWord. What is the value of myChar ?

"e"

"f"

"h"

"i"

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?