Question

Fundamental Programming Question 1 (a) Consider each of the following questions carefully. You are required to give the answe

0 0
Add a comment Improve this question Transcribed image text
Answer #1

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

Add a comment
Know the answer?
Add Answer to:
Fundamental Programming Question 1 (a) Consider each of the following questions carefully. You are required to...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Answer all questions 1- in circular singly linked list, previous pointer of the first node points...

    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...

  • Please answer the following questions 1. What keyword is used to make a child class use...

    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...

  • True/False Question 1. A Linked List will have no limited size. You may add or insert...

    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...

  • 1) Describe in your own words the fundamental concept behind declarative programming paradigm 2) Explain what...

    1) Describe in your own words the fundamental concept behind declarative programming paradigm 2) Explain what is happening below. Why are these results looking like this? Describe why it is happening in your own words. >(-10.2 10) 0.1999999999999993 >(-1.2 1) 0.1999999999999996 >(-1.4 1) 0.3999999999999999 >(-2.2 1) 1 .2000000000000002 3)Below is a scheme function. for your answer, write a comment for this piece of code in valid scheme syntax (define( factorial n) if(=n 0) 1 (*n(factorial(-n 1))))) The elements to include...

  • Web programming questions (please help if you can) (Java) 1. In which of the following types...

    Web programming questions (please help if you can) (Java) 1. In which of the following types of JSP elements, the implicit objects cannot be used? (a) scriplets (b) declarations (c) expressions 2. All the JSP implicit objects are created automatically by the server without any request from the programmers. (a) true (b) false 3. Which of the following scopes is used for the members declared inside the JSP declarations? (a) class (b) method 4. When is the code inside a...

  • SHORT ANSWER QUESTIONS Part 1 Classes Abstraction: What is Abstraction in terms of representation? Specifically what...

    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...

  • Question 5. [11 marks] IChapter 2] Consider the following studies: Study 1: A study was conducted...

    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 5. 111 marks] (Chapter 2] Consider the following studies Study 1: A study was conducted...

    Question 5. 111 marks] (Chapter 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 computed based on their answers. 120 people were recruited and randomly allocated to one of 4 groups: the first group did the...

  • Question 1 The following function header represents which programming language? double calc_weekly_pay( double hours_worked, double pay_rate)...

    Question 1 The following function header represents which programming language? double calc_weekly_pay( double hours_worked, double pay_rate) Question 1 options: Python A C-based language FORTRAN COBOL Question 2 One of my favorite quotes from Jeanette Wind is "Computational thinking is using abstraction and decomposition when attacking a large complex task or designing a large complex system." This supports using _____________ when developing programs. Question 2 options: Repetition structures Assignment statements Selection structures Functions Question 3 The following assignment statement exhibits which...

  • Question 1 2 pts The preprocessor executes after the compiler. False True Question 2 2 pts...

    Question 1 2 pts The preprocessor executes after the compiler. False True Question 2 2 pts What code is human-readable and follows the standards of a programming language? Secret code Source code Key code None of these Machine code Question 3 2 pts What is the symbol that marks the beginning of a one line comment? Question 1 2 pts The preprocessor executes after the compiler. True False Question 5 2 pts A statement that may be used to stop...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT