0% found this document useful (0 votes)
3 views1 page

Java Programming

Uploaded by

bridgetmloyi99
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)
3 views1 page

Java Programming

Uploaded by

bridgetmloyi99
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
You are on page 1/ 1

Java Programming Test 1

1.With the aid of a diagram briefly describe the stages of the spiral model
[8 marks]
2.Illustrate the difference between JDK and JRE ​ [6 marks]
3 a.Create a java Class which handles complex numbers the class takes as input 2
numbers and performs the following operations
​ i) Add complex numbers​​ ​ ​ ​ ​ ​ [3 marks]
​ ii) Subtract two complex numbers [3 marks]
​ iii)Compare if two complex numbers are equal [3 marks]
​ vi) The modulus of a complex number 𝑧 = 𝑎 + 𝑏𝑖 is calculated as follows
2 2
𝑎 + 𝑏 write a program which computes the modulus of a given complex
number​ ​ ​ ​ ​ ​ ​ ​ ​ [3 marks]
b) Explain the following Java keywords. For each write a sentence giving an
overview of what the word is about, then either write a second sentence that shows
how it fits in with related concepts or write a small code-fragment to illustrate its
purpose:
i) switch
ii) class
iii) protected
iv) void
v) interface

​ ​ ​ ​ ​ ​ ​ ​ ​ ​ [2 marks each]
4. Illustrate the difference between static variables and instance variables [4 marks]
ii) Given the following classes record Point(double x, double y);
Illustrate how you would create an array of 10 Point objects [4 marks]
iii) Briefly explain the operations taking place on the following statement
Point point=new Point(23,32); [3 marks]

You might also like