Question: QUESTION 1 Differentiate between the following terms/concepts: 1.1 Data and Information (4) 1.2 Internal data and External data (4) 1.3 Temporary and Permanent data storage
QUESTION 1 Differentiate between the following terms/concepts:
1.1 Data and Information (4)
1.2 Internal data and External data (4)
1.3 Temporary and Permanent data storage (4)
1.4 Arrays and Linked lists (4)
1.5 Stacks and Queues (4)
QUESTION 2
State whether the following statements are True or False. Write down the question number and the word True or False next to it. E.g. 2.21 True
2.1 A single array can hold components of many different data types.
2.2 The constructor is called when an object is created.
2.3 Given the declaration, int[] list = new int[50]; the statement, System.out.println(list); outputs all 50 components of the array list, one component per line. 2.4 Get and set methods are used to obtain and change the values of an objects attributes. 2.5 A file is a place to store data we wish to persist after our program has terminated. 2.6 In Java, the array index starts at 1.
2.7 Arrays are made up only of integers.
2.8 The ability of a family of related classes to each implement their own version of a method is an example of polymorphism.
2.9 Objects enable reuse of software components. 2.10 A queue is a data structure that uses a LIFO data structure.
2.11 Composition is a relationship between two classes that is based on the aggregation relationship.
2.12 A direct access file is a type of file in which each data can be accessed sequentially.
2.13 The reserved word this can be used as a name for the calling object.
2.14 A constructor is a special kind of method used to initialize objects.
2.15 Constructors have return type void. 2.16 The size of an array in Java is determined when the program is compiled.
2.17 The following statement creates an array of 20 elements: int[] array = {20};
2.18 A database is an efficient way to store, manipulate and retrieve large amounts of data. 2.19 To create an object of a class type, the word new is used.
2.20 The push operation removes the element at the top of the stack.
QUESTION 3
3.1 Discuss temporary and permanent data, highlighting the advantages and disadvantages of each. (10)
3.2 Besides variables, name other ways to store information in temporary storage. (5)
3.3 Explain the concept data abstraction. (5)
QUESTION 4
4.1 Write a complete Java program called Queue1 for the following plan: (10) Plan: 1. Create a queue q1 2. Add(3*4) 3. Add(7+8) 4. Remove() 5. Add(6*7) 6. Print Peek() 7. Remove() 8. Add((*3) 9. Print queue
4.2 Write a complete Java program called Display that includes a String array called names[]. The array names[] must store 5 names and this should be output using a loop structure. (10)
QUESTION 5
Create a Java class called Pen with the following variables: String type, String make and int size. The class should have a default constructor and an overloaded constructor which accepts the three parameters: type, make and size. Create a class called UsePen with a main method(). In the main method do the following: Create an instance of class Pen p1 using the default constructor and populate the three variables with a type, make and size. Create an instance of class Pen p2 using the overloaded constructor, passing it three parameters for type, ,make and size. Show output for all constructors
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
