0% found this document useful (0 votes)
5 views3 pages

Java Worksheet Summer 1

This document is a Java worksheet designed for computer applications, consisting of multiple-choice questions, token identification, code tracing, and data types matching. It assesses understanding of Object-Oriented Programming concepts, Java syntax, and basic programming logic. The worksheet is structured into four sections with specific tasks and questions related to Java programming.

Uploaded by

RUMANA HAIDER
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views3 pages

Java Worksheet Summer 1

This document is a Java worksheet designed for computer applications, consisting of multiple-choice questions, token identification, code tracing, and data types matching. It assesses understanding of Object-Oriented Programming concepts, Java syntax, and basic programming logic. The worksheet is structured into four sections with specific tasks and questions related to Java programming.

Uploaded by

RUMANA HAIDER
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Java Worksheet 1: Theory & Logic

Subject: Computer Applications (Java)

Time Allowed: 45 Mins

Section A: Multiple Choice Questions


Q1. Ramesh is using his TV remote to change the channel according to his choice. Which
feature of OOPs is demonstrated in this context?

●​ a) Polymorphism​

●​ b) Inheritance​

●​ c) Encapsulation​

●​ d) Abstraction​

Answer: __________

Q2. Rakhi is using her smartphone for calling her friend. At night there was a power failure, so
she used it as a flashlight/torch. Which feature of OOPs depicts this situation?

●​ a) Polymorphism​

●​ b) Inheritance​

●​ c) Encapsulation​

●​ d) Abstraction​

Answer: __________
Section B: Token Identification
Q3. Study the following instruction in Java and mark the type of token in it:

int a=7,b=8;

Identify and sort the components of the statement above into their respective token
categories:

●​ Keywords: ________________​

●​ Identifiers: ________________​

●​ Operators: ________________​

●​ Constants: ________________​

●​ Punctuators: ________________​

Section C: Code Tracing


Q4. Analyze the following code logic meant to swap two numbers:

class Swap {​
public static void main(int a, int b) {​
a = a + b; ​
b = a - b; ​
a = a - b; ​

[Link](a); ​
[Link](b); ​
}​
}​

Your Tasks: If the initial values passed into the program are a = 12 and b = 5. Trace the
execution step-by-step and write the final answers:

1.​ What will be the final value printed for a? ________________​

2.​ What will be the final value printed for b? ________________​

Section D: Data Types Matching


Q5. Match the given values with their correct Java Data Type:

Value Data Type

i) true a) int

ii) 7 b) boolean

iii) 7.2 c) double

Answers:

●​ i matches with ____________


●​ ii matches with ____________
●​ iii matches with ____________

You might also like