Question1
Solution
a)
i)
True
Explanation
Both the structures and class have the data members and the member function used to map on real world edit,
• structure functionality has same of the class Men the difference is members are to be private by default value
ii)
True
Explanation
• delete[]is one of the operation in C++
• It is used to de-allocate the memory variable
• create a pointer to the class object type then need to delete the memory allocated the set of objects Example-
#include<iostream>
using namespace std;
struct object
{
Object () {
cout<<"object constructed\n";
}
~object() {
cout<<"object destroyed\n";
}
};
int main() {
object * Ptr;
Ptr= new Object[2];
delete [] ptr;
iii)
True
Explanation
Could not be make the reference to the unallocated memory because
do the program will throw an error or crash or it will produce
undefined behavior
iv)
False
Explanation
• Virtual keyword can be used for overriding the function in a derived class then it is unnecessary
• Overrides of the virtual functions always to be
virtual
Fundamental Programming Question 1 (a) Consider each of the following questions carefully. You are required to...
Answer all questions
1- in circular singly linked list, previous pointer of the first node points to which node A. First node B. Itself C. null D. Last node 2- Which of the following is NOT an applications of linked lists? A. Implementation of stacks and queues B. Dynamic memory allocation C. Manipulation of polynomials D. Keeping people at home during epidemics like corona virus 3- In a circular singly linked list? A. Components are all linked together in some...
True/False Question 1. A Linked List will have no limited size. You may add or insert as many elements as needed. True False 2. Linked List search is a linear search. Therefore it will be slow. True False 3. A JPanel can contain zero or more JPanels. True False 4. Users can interact with JLabel component. True False 5. This code is to add a panel to the south region of a JFrame JPanel panel = new JPanel (); frame.add...
Please answer the following questions
1. What keyword is used to make a child class use a parent class? a.) is a b.) extends c.) has a d.) inherits 2. Suppose you have the given code below. Scanner keyboard = new Scanner(System.in); What would be the correct way to scan in an integer value from the keyboard. a.) scan.nextInt() b.) scan.nextDouble() c.) scan.nextLine() d.) keyboard.nextInt() 3. True or False. Arrays use sequential blocks of memory while linked lists do not...
Creating linked list data structure Overview The purpose of this assignment is for you to write a data structure called a Linked List, which utilizes templates (similar to Java’s generics), in order to store any type of data. In addition, the nature of a Linked List will give you some experience dealing with non-contiguous memory organization. This will also give you more experience using pointers and memory management. Pointers, memory allocation, and understand how data is stored in memory will...
SHORT ANSWER QUESTIONS Part 1 Classes Abstraction: What is Abstraction in terms of representation? Specifically what choices does one make when creating a class that is an example of Abstraction? Encapsulation: What is encapsulation? What is information hiding? What does a public interface to a class consist of (not in the sense of actual java interfaces but what the client uses to manipulate objects of the class) What is an object of a class? What is the constructor? How do...
Instructions Part 1 - Implementation of a Doubly Linked List Attached you will find the code for an implementation of a Singly Linked List. There are 3 files: Driver.java -- testing the List functions in a main() method. LinkNode.java -- Class definition for a Node, which is the underlying entity that stores the items for the linked list. SinglyLinkedList.java -- Class definition for the Singly Linked List. All the heavy lifting happens here. Task 1 - Review & Testing: Create...
Instructions Part 1 - Implementation of a Doubly Linked List Attached you will find the code for an implementation of a Singly Linked List. There are 3 files: Driver.java -- testing the List functions in a main() method. LinkNode.java -- Class definition for a Node, which is the underlying entity that stores the items for the linked list. SinglyLinkedList.java -- Class definition for the Singly Linked List. All the heavy lifting happens here. Task 1 - Review & Testing: Create...
Question 5. [11 marks] IChapter 2] Consider the following studies: Study 1: A study was conducted to see if music can influence people's ability to remember. Memory was tested by giving people a series of pictures to look at for 10 minutes and then asking them to answer a series of questions about the pictures. A memory score was computed based on their answers. 120 people were recruited and randomly allocated to one of 4 groups: the first group did...
Question 2 (10) TRUE FALSE QUESTIONS Consider the following list of statements. Each statement is either true or false. You must read each statement carefully and then select the option that you believe is correct as your answer. In your answer book, write down only the question number and next to the number either True or False 2.6. Monopolistic competition is a market structure characterised by the fact that there is often collusion between the sellers. 2.7. Half-price specials are...
Question 2 [10] TRUE/FALSE QUESTIONS Consider the following list of statements. Each statement is either true or false. You must read each statement carefully and then select the option that you believe is correct as your answer. In your answer book, write down only the question number and next to the number either True or False. Example: If you believe sub-question 2.11 is true, then write down: 2.11. True. 2.1. 2.2. 2.3. Peter is a plumber. He employs three workers...