Sunteți pe pagina 1din 3

QA.

1. write a class with name account.

2. declare a class property int balance

3. write a class function "summery" that returns the value of balance.

4. write a class task "deposite" that takes a deposite amount as the input argument & add it to the
"balance" class property.

5. declare an object from the handle inside the initial block.

7. access the proprerties ,task,&function of teh class using the object created.

QB.

1. write a class with name packet.

2. declare the class properties

bit[3:0] data;

bit[15:0] addr;

bit[15:0] mem;

3. declare two handels of the class p1 &p2.

4. create ans object from the handle p1 inside the initial begin

5. assign values to the class properties using the object p1.

6. do the assignment p2=p1.

7. display the values of the class properties through p2 objects.

Q3.

1. declare a class mem_asso.

2. inside the class declare an associative array as int disk_mem[string].

3. write the task write(input bit wr,input string addr,inpt int data).

4. write the task read(input bit rd,input string addr).

5. iterate through the array using first &next built-in functions in the task check() in the extended class
mem_asso_v1.
6. call the tasks inside initial-begin-end block.

Q4.

1. class accont_c

2. creat child class with new task

"withdraw " which will reduce the amount in balance.

3. write a function "summmary_withdraw " which will return the balance after withdrawal

4. inside the initial block call the function "summary_withdraw" to see the new balance.

Q5.

1. a class parity_calc has a field parity of size 8bits.

2. a class "packet" has an object of class "parity_calc" &a "header" & "data" field.

3. declare two handle of class "packet" p1 7p2.

4. create object p1.

5. do a shallow copy p2=new p1.

6. now change the value of header of p2 & see that the value header in p1 is not changed.

7. now do a deep copy p2=p1.copy

8. change the value of header.

POLYMORPHISM:
Q1.
1. Creat class packet with field “payload”. Inside tsk send() calculate even parity & display
it.
2. In task send() of the extended class badpacket1, calculate the odd parity /bad parity
&display it.
3. Creat parent &child class objects from the handels declared.
4. Call the send task of base &extended class objects &observe the result.
5. Assign extended class object to base class object.
6. Class send task with base class object &observe the result.
QUEUE:

Q1.

1. Create a packet class that has addr[8bits],data[8bits] & parity [8bit] as class properties. Declare a
queue that can store the packets.

2. Create check_addr function which will lock for one addr match,no addr match & multiple addr match.

3. Inside the initial begin and block add multiple packets to the queue.

4. Call the function in the initial block & chek the o/p.

S-ar putea să vă placă și