QUESTION 1 Differentiate between the following terms/concepts: 1.1 Data and Info
ID: 3724373 • Letter: Q
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 (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
Explanation / Answer
QUESTION 1 Differentiate between the following terms/concepts:
1.1 Data and Information (4)
Data and Informations are interrelated. Data refers to raw data which may or may not be of any use to the owner. Whereas once the data is processed according to need, it is called Information. I.e. useful data is called information which may or may not be the raw data itself. Usually data are processed to get information.
1.2 Internal data and External data (4)
Internal data refers to the data within the company and in most cases these data are private data and is confined within the company.External data is data that is collected by outside entities from our company's external environment
1.3 Temporary and Permanent data storage (4)
Temporary data storage are not consistent and data are lost under some condition. E.g. RAM where data is lost once the power is interrupted
Permanent data storage are consistent and data are generally not lost under standard usage condition. E.g. HDD where data is can be stored for prolonged period of time
1.4 Arrays and Linked lists (4)
Typically array elements are contiguous and all are of the same data type and length of an array is predefined.
But Linked List elements are generally not contiguous length of an Linked list may increase or decrease according to the the need.
1.5 Stacks and Queues (4)
Stack is LIFO (Last In First Out) data structure, which can be easily implemented using a single pointer called the stack. In stack both deletion (pop) and insertion (push) are carried out at the same end.
Whereas Queues are FIFO (First In First Out) data structure. Implementing a queue requires two ends, namely the front end and the rear end for deletion and insertion respectively.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.