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)

Practice paper for java

Rating
-
Sold
-
Pages
19
Grade
A+
Uploaded on
24-03-2025
Written in
2024/2025

This question paper tests your profound knowledge in java programming and is especially helpful for high school students.

Institution
Course

Content preview

X-CTA-Practice Paper – 2024 – 25
I. Name the Java feature depicted in the following pictures:-
1. 2.




3. 4.




5. 6.




8.

7.




9.




1

,II. Write Java expressions:-
x 3
3
√x+y 4 4 3
1. 2. √x 2 + y2 𝑥
3. 𝑎 + √𝑎2 + 𝑏2 4. 𝜋𝑟 5.(1 + )
|x−y| 3 y
III. Evaluate the given expressions and write the output:-
1. int m=7, n=9;
m+=m-- + ++n + ++m + --n;
System.out.println ("m="+m);
System.out.println ("n="+n);
2. int x=100, y=10;
x/=x-- + y++;
System.out.println ("x="+x+" y="+y);
3. int k= -6, j=2;
int r = ++k + ++j + --k;
System.out.println ("k="+k);
System.out.println ("j="+j);
System.out.println ("r="+r);
4. int s=1, t=5;
t*=--s + --t - ++s;
System.out.println ("s="+s);
System.out.println ("t="+t);
IV. Predict the output:
1. int a=5, b=3, c=7;
System.out.println (a+b*c/a);
System.out.println ((--a + b)==c);
System.out.println ("Output is "+a+b+c);

2. char c=67, x=50; int d=2;
System.out.println (c++);
System.out.println (c+d);
System.out.println ((char)(c+d));
System.out.println (x+=3);
System.out.println (x+d);
System.out.println ("Output is "+c+d);

3. int a=2, b=5;
if(b++%a++==0)
System.out.println (a+b);
if ((a+b)%3==0)
System.out.println (b-a);
else
System.out.println(a*b);




2

, 4. int k=50, j=5;
if(j%k==0)
if(j%5==0)
System.out.println (k/j);
else
System.out.println (k%j);
else
System.out.println (k+j);

5. When(a) ch is 'a' or 'A' (b) ch is 'd' or 'D'
switch (ch)
{
case 'a':
case 'A': System.out.println ("Accounts");
case 'c':
case 'C': System.out.println ("Commerce");
break;
default: System.out.println ("Incorrect Input");
}

6. double amount=5000, dis=0;
dis= (amount<=5000)? (amount*0.5):(amount*0.1);
System.out.println ("dis="+dis);

7. String s; int num=28;
s=(num%7==0)?(num%11==0)?"Divisible":"Divisible by 7, but not by 11":"Not divisible
by 7";
System.out.println (s);

8. Analyze how many times loop runs and what is the output:
int a=10;
while (++a<=20);
System.out.println (a);

9. Analyze how many times loop runs and what is the output:
String s="1a2b3c4d";
int i=0;
do
{
if (Character.isDigit(s.charAt(i)))
System.out.println ((s.charAt(i)-48)*2);
i++;
}while (i<s.length());



3

Written for

Institution
Secondary school
Course
School year
4

Document information

Uploaded on
March 24, 2025
Number of pages
19
Written in
2024/2025
Type
Exam (elaborations)
Contains
Only questions

Subjects

$8.49
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
rissah

Get to know the seller

Seller avatar
rissah
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
1 year
Number of followers
0
Documents
1
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

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