Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Exam (elaborations)

MCQ AP PRACTICE EXAM 1A COMPUTER SCIENCE A

Rating
-
Sold
-
Pages
12
Grade
A+
Uploaded on
09-01-2025
Written in
2024/2025

MCQ AP PRACTICE EXAM 1A COMPUTER SCIENCE A

Institution
MCQ AP
Course
MCQ AP

Content preview

MCQ AP PRACTICE EXAM 1A COMPUTER SCIENCE A

Consider the following code segment.
int a = 3 + 2 * 3;
int b = 4 + ;
int c = 7 % 4 + 3;
double d = a + b + c;
What is the value of d after the code segment is executed? - Answers- C) 20.0

Consider the following code segment. Assume num is a properly declared and initialized
int variable.
if (num > 0)
{
if (num % 2 == 0)
{
System.out.println("A");
}
else
{
System.out.println("B");
}
}
Which of the following best describes the result of executing the code segment? -
Answers- D) When num is a positive even integer, "A" is printed; when num is a positive
odd integer, "B" is printed; otherwise, nothing is printed.

Consider the following implementation of getHours.
public static double getHours(int marker1, int marker2)
{
/* missing statement */
return hours;
}
Which of the following statements can replace /* missing statement */ so getHours
works as intended? - Answers- C) double hours = Math.abs(marker1 - marker2) / 60.0;

Consider the following class definition.
public class Bird
{
private String species;
private String color;
private boolean canFly;

public Bird(String str, String col, boolean cf)
{
species = str;

, color = col;
canFly = cf;
}
}
Which of the following constructors, if added to the Bird class, will cause a compilation
error? - Answers- E) public Bird(String col, String str, boolean cf)
{
species = str;
color = col;
canFly = cf;
}

Which of the following expressions evaluate to 3.5 ?
I. (double) + 3
II. (double) () + 3
III. (double) ( + 3) - Answers- A) I only

Consider the following code segment.
int num = /* initial value not shown */;
boolean b1 = true;
if (num > 0)
{
if (num >= 100)
{
b1 = false;
}
}
else
{
if (num >= -100)
{
b1 = false;
}
}
Which of the following statements assigns the same value to b2 as the code segment
assigns to b1 for all values of num ? - Answers- E) boolean b2 = (num < -100) || (num >
0 && num < 100);

Consider the following class definition.
public class Points
{
private double num1;
private double num2;

public Points(int n1, int n2) // Line 6
{

Written for

Institution
MCQ AP
Course
MCQ AP

Document information

Uploaded on
January 9, 2025
Number of pages
12
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

$12.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
GEEKA YALA UNIVERSITY
Follow You need to be logged in order to follow users or courses
Sold
2109
Member since
4 year
Number of followers
1446
Documents
54144
Last sold
1 day ago

3.8

358 reviews

5
177
4
61
3
48
2
17
1
55

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions