Tell what will be displayed by each of code segment


For questions 1 & 2
Assume the following declarations (which are used to process singly-linked lists as described in this section):
class Node
{
public:
int data;
Node * next;
};
Node *p1, *p2, *p3;
Assume also that the following statements have been executed:
p1 = new(nothrow) Node;
p2 = new(nothrow) Node;
p3 = new(nothrow) Node;

4. Tell what will be displayed by each of the following code segments or explain why an error occurs.
Question # 1.
p1 -> data = 123;
p2 -> data = 456;
p1 -> next= p2;
p2 -> next= 0;
cout << p1 -> data << " " << p1 ->next->data << endl;

Question # 2
p1 -> data = 123;
p2 -> data = 456;
p1 -> next= p2;
p2 -> next= 0;
cout << p2 -> data << " " << p2 ->next->data << endl;

3. Distinguish between abstract date types (ADTs) and implementations of ADTs.
4. Describe briefly how arrays are implemented by using C++ static arrays? 

5. How string streams can be used for in-memory I/O? 
6. How do you build a static-away-based implementation of stacks? 
7. How do you build a static-away-based implementation of queues?

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: Tell what will be displayed by each of code segment
Reference No:- TGS0138619

Expected delivery within 24 Hours