0% found this document useful (0 votes)
14 views2 pages

Java Data Types Classwork

This document is a Grade 10/11 IT classwork assignment focused on Java primitive data types. It includes theory questions about data types, differences between int and double, and the use of single quotes for characters, as well as code-based questions requiring students to analyze and write Java code. The assignment is structured into parts with a total of 20 marks available.

Uploaded by

n6sbpnzdfz
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)
14 views2 pages

Java Data Types Classwork

This document is a Grade 10/11 IT classwork assignment focused on Java primitive data types. It includes theory questions about data types, differences between int and double, and the use of single quotes for characters, as well as code-based questions requiring students to analyze and write Java code. The assignment is structured into parts with a total of 20 marks available.

Uploaded by

n6sbpnzdfz
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

Grade 10/11 IT Classwork: Java Data Types

Topic: Primitive Data Types

Name: _______________________ Date: _______________________

Part A: Theory Questions

1. What is a data type? (2 marks)

Answer:

_______________________________________________________

_______________________________________________________

2. List any FOUR primitive data types in Java and give an example of each. (8 marks)

Data Type Example Declaration

3. What is the difference between int and double? (2 marks)

Answer:

_______________________________________________________

_______________________________________________________

4. Why must characters be stored using single quotes ' in Java? (1 mark)

Answer:

_______________________________________________________

Part B: Code-based Questions

5. Look at the following code and answer the questions below:

int age = 16;

double height = 1.72;

Page 1
Grade 10/11 IT Classwork: Java Data Types

char gender = 'F';

boolean isStudent = true;

a. What is the value stored in the variable height? (1 mark)

Answer: ___________________________

b. Which variable holds a true/false value? (1 mark)

Answer: ___________________________

c. What will be displayed if we add this line?

[Link](gender);

(1 mark)

Answer: ___________________________

Part C: Write Your Own Code

6. Write Java code that declares and stores the following:

- Your shoe size as a float

- Your favourite letter as a char

- Whether you have a pet as a boolean

(3 marks)

// Your answer here:

Total: 20 marks

Page 2

You might also like