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)

CP213 Tests 1 - 4 || Already Graded A+.

Rating
-
Sold
-
Pages
9
Grade
A+
Uploaded on
10-06-2026
Written in
2025/2026

CP213 Tests 1 - 4 || Already Graded A+.

Institution
CP213
Course
CP213

Content preview

CP213 Tests 1 - 4 || Already Graded A+.
Java differentiates between how many types of variables? correct answers 4, instance, static,
local, and parameter variable

When the following code snippet is executed, what will be the output?

public void test() {
long l = 55;
int i = 44;
short s = 33;
byte b = 22;
i = (int) l;
s = (short) i;
b = (byte) s;
System.out.println("l = " + l);
System.out.println("i = " + i);
System.out.println("s = " + s);
System.out.println("b = " + b);
} correct answers l = 55
i = 55
s = 55
b = 55

If the following code snippet is executed, what will be the output?

public void test3()
{
int i = 50000;
short s = i;
} correct answers The program does not compile

When the following code snippet is executed, what will be the output?

public void test() {
int input = 7;
int output = ++input + ++input + ++input;
System.out.println(output);
} correct answers 27 (8 + 9 + 10)

When the following code snippet is executed, what will be the output?

public static void test5() {
int i = 4;
int j = 21;
int k = ++i * 7 + 2 - j--;

, System.out.println("k = " + k);
} correct answers k = 16 (5 * 7 + 2 - 21)

When the following code snippet is executed, what will be the output?

public void test2() {
int a = 1;
int b = 2;
int c;
int d;
c = ++b;
d = a++;
c++;
System.out.println("a = " + a);
System.out.print("b = " + b);
System.out.println("c = " + c);
System.out.print("d = " + d);
} correct answers a = 2
b =3c = 4
d=1

In java static variables is used to correct answers - Refer to common properties to all objects
- Get a persistent value between different method calls
- It gets memory only once in a class area at the time of class loading

When the following code snippet is executed, what will be the output?

public class TestStatic {
int num1 = 6;
static int num2 = 10;
public static void main(String args[]) {
TestStatic s1 = new TestStatic();
TestStatic s2 = new TestStatic();
s1.num1 = 15;
s1.num2 = 17;
s2.num1 = 22;
s2.num2 = 28;
System.out.println(s1.num1 + " " + s1.num2 +
" " + s2.num1 + " " + s2.num2);
}
} correct answers 15 28 22 28

What will the given code result in System.out.printf("\n Java programming is very \"fun\" ");
correct answers Java programming is very "fun"

Written for

Institution
CP213
Course
CP213

Document information

Uploaded on
June 10, 2026
Number of pages
9
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

$11.79
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.
SirAnton NURSING, ECONOMICS, MATHEMATICS, BIOLOGY, AND HISTORY MATERIALS BEST TUTORING, HOMEWORK HELP, EXAMS, TESTS, AND STUDY GUIDE MATERIALS WITH GUARANTEED A+ I am a dedicated medical practitioner with diverse knowledge in matters
Follow You need to be logged in order to follow users or courses
Sold
784
Member since
3 year
Number of followers
438
Documents
38837
Last sold
1 day ago
Reign Supreme Scholarly || Enlightened.

Get your revised study materials available here and elevate your educational outcomes. I have numerous verified learning materials (Research, Exams Questions and answers, Assignments, notes etc) for different courses guaranteed to boost your academic results. I am dedicated to offering you the best and unique learning content. You are encouraged to inquire further assistance from this end whenever need be. Kindly remember to leave your review, understanding your satisfaction is essential . We highly appreciate clients who always come back for more of the study content we offer, you are extremely valued. All the best.

Read more Read less
3.7

116 reviews

5
49
4
20
3
23
2
8
1
16

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