Variables and Assignments

Variables and Assignments

12th Grade

10 Qs

quiz-placeholder

Similar activities

Functions & Scope of variables in C++

Functions & Scope of variables in C++

11th Grade - University

15 Qs

AP CSP Pseudo Code

AP CSP Pseudo Code

10th - 12th Grade

8 Qs

APCSP Pseudocode

APCSP Pseudocode

10th - 12th Grade

8 Qs

AP CSP Algorithms & Programming (College Board Style)

AP CSP Algorithms & Programming (College Board Style)

9th - 12th Grade

15 Qs

Arrays and Lists

Arrays and Lists

6th - 12th Grade

10 Qs

AP Computer Science Principles Unit 3 Review

AP Computer Science Principles Unit 3 Review

9th - 12th Grade

10 Qs

AP CSP Identifying Errors

AP CSP Identifying Errors

9th - 12th Grade

10 Qs

Unit 5 Lists, Loops, & Traversals

Unit 5 Lists, Loops, & Traversals

10th - 12th Grade

12 Qs

Variables and Assignments

Variables and Assignments

Assessment

Quiz

Computers

12th Grade

Hard

Created by

Ms Seccafico

Used 90+ times

FREE Resource

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"

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?