QUESTION 2 State whether the following statements are True or False. Write down
ID: 3912503 • Letter: Q
Question
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
Explanation / Answer
Hi,
Thank you for the opportunity to help you with your assignment.
The following are the answers for the questions.
If you have any queries, need changes in the code or need help in following the code, leave me a comment.
I will reply within reasonable time.
If this answer helps you with your assignment, do upvote it.
Your vote will motivate me to work better.
2.1 A single array can hold components of many different data types. False
2.2 The constructor is called when an object is created. True
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. False
2.4 Get and set methods are used to obtain and change the values of an objects attributes. True
2.5 A file is a place to store data we wish to persist after our program has terminated. True
2.6 In Java, the array index starts at 1. False
2.7 Arrays are made up only of integers. False
2.8 The ability of a family of related classes to each implement their own version of a method is an example of polymorphism. True
2.9 Objects enable reuse of software components. True
2.10 A queue is a data structure that uses a LIFO data structure. False (It's FIFO)
2.11 Composition is a relationship between two classes that is based on the aggregation relationship. True
2.12 A direct access file is a type of file in which each data can be accessed sequentially. False (You can seek to read/write from random locations)
2.13 The reserved word this can be used as a name for the calling object. True
2.14 A constructor is a special kind of method used to initialize objects. True
2.15 Constructors have return type void. False (no return type)
2.16 The size of an array in Java is determined when the program is compiled. True
2.17 The following statement creates an array of 20 elements: int[] array = {20}; False (size of 1 with value of 20)
2.18 A database is an efficient way to store, manipulate and retrieve large amounts of data. True
2.19 To create an object of a class type, the word new is used. True
2.20. The push operation removes the element at the top of the stack. False (it adds new element to the top)