
CSC60A: Outcome 2/ WQ
Authored by Ayesha Abdullah
Computers
11th Grade
Used 6+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
8 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
The code segment below is intended to calculate the circumference c of a circle with the diameter d of 1.5. The circumference of a circle is equal to its diameter timespi.
/* missing declarations */
c = pi * d;
Which of the following variable declarations are most appropriate to replace /* missing declarations */ in this code segment?
int pi = 3.14159;
int d = 1.5;
final int c;
final int pi = 3.14159;
int d = 1.5;
int c;
final double pi = 3.14159;
double d = 1.5;
double c;
double pi = 3.14159;
double d = 1.5;
final double c = 0.0;
final double pi = 3.14159;
final double d = 1.5;
final double c = 0.0;
2.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
Consider the following code segment.
int x = 5;
int y = 6;
/* missing code */
z = (x + y) / 2;
Which of the following can be used to replace /* missing code */ so that the code segment will compile?
I. int z = 0;
II. int z;
III. boolean z = false;
I only
II only
I and II only
II and III only
I, II and III
3.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
A code segment (not shown) is intended to determine the number of players whose average score in a game exceeds 0.5. A player’s average score is stored in avgScore, and the number of players who meet the criterion is stored in the variable count.
Which of the following pairs of declarations is most appropriate for the code segment described?
double avgScore;
boolean count;
double avgScore;
double count;
double avgScore;
int count;
int avgScore;
boolean count;
int avgScore;
int count;
4.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What type should you use to represent the number of people in a household?
int
String
Double
Boolean
Float
5.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What type should you use to represent the first name of a person?
int
String
Double
Boolean
Float
6.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What type should you use to record if it is raining or not?
int
String
Double
Boolean
Float
7.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What type should you use for a shoe size like 8.5?
int
String
Double
Boolean
Float
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?