Showing posts with label Assignments. Show all posts

CS402 Assignment no 6 Fall 2012 Full Solution

 Question No. 1:         
                                                                         
Sà aSSb | aab
            Sà SSS | a | b

Construct a Push Down Automaton (PDA) for above Context Free Grammar (CFG) without conversion into Chomsky Normal Form (CNF).
                                                                                                                        Marks [10]





Question No. 2:

Convert the following Push Down Automaton (PDA) in to conversion form:




Tag : ,

CS501 Assignment no 4 Fall 2012 Full Solution


Question

Assume that three I/O devices are connected to a 32-bit, 20 MIPS CPU. The first device is a hard drive with a maximum transfer rate of 2MB/sec. It has a 32-bit bus. The second device is a floppy drive with a transfer rate of 50KB/sec over a 16-bit bus, and the third device is a keyboard that must be polled forty times per second. Assuming that the polling operation requires 30 instructions for each I/O device, determine the percentage of CPU time required to poll each device.

Note: 1K = 1024


Full Solution
Tag : ,

CS605 Assignment no 6 Fall 2012 Full Solution


Please refer to the case study given in Assignment no. 1

Question#1: [Marks: 12]

List at least two examples, where we can apply Poka-yoke technique (to prevent a mistake/loss) in our application.



Question#2: [Marks: 8]

Consider the following phases of our application development:

1) Requirements
2) Design
3) Coding
4) Testing

Identify at least two Software Configuration Items (SCIs) for each of these phases.



Tag : ,

CS606 Assignment no 4 Fall 2012 Full Solution


Consider the following grammar productions. Suppose you have an attribute E.type which can be set to either INT, BOOL.  Assume that the type of an expression is set to INT if an error is detected and you have a routine msg() similar to printf() that can be used to print error message.

CONST                       {E.type=??}

| ID                               {E.type =getType(ID.name);}

| E1 +E2                       {E.type=??}

| E1< E2                       {E.type=??}

| E1= =E2                     {E.type=??}

| (E1)                            {E.type=??}
You are required to add rules to the attribute grammar to calculate E.type for each grammar production.
Tag : ,

CS201 ASSIGNMENT NO 4 Fall 2012 FULL SOLUTION


Problem Statement:     You are required to write a program for calculating area of Trapezoid. Formula for calculating area of trapezoid is
 
Where a and b are two bases of trapezoid and h corresponds to height.


Detailed Description:

  • Create a class named Trapezoid which contains two bases and height as data members.
  • Implement a default constructor to initialize all data members with zero and a parameterized constructor which takes three arguments to initialize data members of class.
  • Take input from user for base1, base2 and height of 2 objects.
  • Overload + operator for the class Trapezoid in such a way that corresponding elements of both objects of the same class can be added.
  • Also implement a friend function named calculateArea() which takes two objects of the class Trapezoid as arguments, adds both objects using overloaded + operator and calculates the area of resultant Trapezoid object.





Solution:

#include <iostream>
#include <stdlib.h>
#include <conio.h>
#include <stdio.h>
using namespace std;
class trapezoid{
public:
trapezoid();
trapezoid(float,float,float);
trapezoid operator +(trapezoid&);
void getinput();
void set_base1(float);
void set_base2(float);
void set_hight(float);
void display();
friend void calculateArea(trapezoid,trapezoid);

private:
float base1,base2,hight;
};
trapezoid::trapezoid()
{
base1 = 0.0;
base2 = 0.0;
hight = 0;

}
trapezoid::trapezoid(float bs1,float bs2,float ht)
{
base1 = bs1;
base2 = bs2;
hight = ht;

}
void trapezoid::display()
{
cout<<"base 1: "<<base1<<endl;
cout<<"base 2: "<<base2<<endl;
cout<<"hight : "<<hight<<endl;
cout<<"The Eare of the Trapezoid is: "<<(base1+base2)/2*hight<<endl;
}

void trapezoid::set_base1(float bs1)
{
base1 = bs1;

}
void trapezoid::set_base2(float bs2)
{
base2 = bs2;
}
void trapezoid::set_hight(float ht)
{
hight = ht;
}

trapezoid trapezoid::operator+(trapezoid& trap)
{
trapezoid temp;
temp.base1 = base1 + trap.base1;
temp.base2 = base2 + trap.base2;
temp.hight = hight + trap.hight;
return temp;

}
void trapezoid::getinput()
{
float bs1 = 0.0;
float bs2 = 0.0;
float ht = 0;
cout<<"Please Enter Base 1: ";
cin>>bs1;
cout<<"Please Enter Base 2: ";
cin>>bs2;
cout<<"Please Enter Hight: ";
cin>>ht;
set_base1(bs1);
set_base2(bs2);
set_hight(ht);
}
void calculateArea(trapezoid bs1,trapezoid bs2)
{
trapezoid temp;
temp = bs1 + bs2;
temp.display();

}
int main()
{
trapezoid bs1;
trapezoid bs2;
cout<<"Object {1}"<<endl;
bs1.getinput();
cout<<endl;
cout<<"Object {2}"<<endl;
bs2.getinput();
calculateArea(bs1,bs2);
_getch();

}

Tag : ,

STA301 Assignment no 4 Fall 2012 Full Solution



Assignment No.4 (Course STA301)

 Spring 2012 (Total Marks 15)


Assignment 4 (Lessons 31-36)
Question 1:                                                                                                                Marks: 8
a.       The means and variances of the weekly incomes in rupees of two samples of workers are given in the following table, the samples being randomly drawn from two different factories:
Factory
Sample Size
Mean
Variance
A
160
15.80
64
B
220
10.25
47

Calculate the 96% confidence interval for the real difference in the average incomes of the workers from the two factories

b.      In a random sample of 200 persons having their lunch at the University cafeteria on meatless day it was observed that 30 percent preferred vegetable dishes. Find 95% confidence interval for proportion of people who preferred the vegetable dishes.


- End -



                                                                                    



Q1 Part B
Question 2:                                                                                                                Marks: 7
  1. A research worker wishes to estimate the mean of a population using a sample sufficiently large that the probability will be 0.90 that the sample mean will not differ from the true mean by more than 30 percent of the standard deviation. How large a sample should be taken?
  2. The mean and standard deviation of the population is 30 and 5 respectively. The probability distribution of the parent population is unknown, find the standard deviation of the sampling distribution of when n = 50.



Q2 Part a



Tag : ,

FIN621 Assignment no 2 Fall 2012 Full Solution

Assignment:
Best Tyres Limited (BTL) - a local tyre manufacturing company famous all over Pakistan for
its tyres used in small vehicles. Its major customers include Cars Company Limited, City
Motors Limited, and Tyre Shop. BTL’s head office is situated in the heart of the Good City,
whereas, it’s manufacturing facilities are located near Port City. .

BTL was incorporated in 2007 with an authorized capital of 1 million ordinary shares of Re.
1 each, and 50,000 9% cumulative preferred shares of Rs. 100 each. BTL has issued all of the
preferred shares at par with the callable price of Rs. 110 each, and 600,000 ordinary shares at
premium of Rs. 15 each. Till 2011, BTL has earned an after tax profit of Rs. 6,920,000 in
cumulative. Since its inception, BTL is paying Paisa fifty per ordinary share as dividend on its
ordinary shares. In 2012, however, the company reported a net loss of Rs. 2,400,000 and
paid no dividend. BTL’s accounting year ends on December 31 each year.
Requirement:

1) Determine BTL’s retained earnings as on December 31, 2012 after taking into
account all dividends till the year 2012.
2) Prepare the stockholder’s equity section for the balance sheet as at December 31,
12012.
3) Calculate the book value per share of the company on the same date.


Part A).
Profit After tax Till 20116920000
Less: 9% to Prefered Profit622800
Less: Divident Paid Till 20113148600
Profit @ Start of 20123148600
Less: Loss 20122400000
Retained Earning before payment to prefered Stockholders748600
9% Payment to Prefered Stock Holder67374
Retained Earning681226
1) Determine BTL’s retained earnings as on December 31, 2012 after taking into
account all dividends till the year 2012.
Profit After tax Till 2011 6920000
Less: 9% to Prefered Profit 622800
Less: Divident Paid Till 2011
3148600
Profit @ [COLOR=#0000FF !important]Start
 of 2012 3148600
Less: Loss 2012 2400000
[COLOR=#0000FF !important]Retained Earning[/COLOR] before payment to prefered Stockholders 748600
9% Payment to Prefered Stock Holder 67374
Retained Earning 681226

2. Stock Equity
Issued Capital:
1) Determine BTL’s retained earnings as on December 31, 2012 after taking into 
account all dividends till the year 2012. 

Profit After tax Till 2011 6920000
Less: 9% to Prefered Profit 622800
Less: Divident Paid Till 2011
3148600
Profit @ Start of 2012 3148600
Less: Loss 2012 2400000
Retained Earning before payment to prefered Stockholders 748600
9% Payment to Prefered Stock Holder 67374
Retained Earning 681226

Book value per share
The ratio of stockholder equity to the average number of common shares. Book value per share should not be thought of as an indicator of economic worth, since it reflects accounting valuation (and not necessarily market valuation).

Book Value of Per Share = Total Share Equity / Number of share O/s
= 74,181,226 / 6,50,000 = 114
Preferred Shares
(50,000@100)
Common Shares
(600,000@100)
Preferred Shares(50,000@100)Common Shares
(600,000@100)

Share premium
Loss at the time of redemption

Retained Earning


9000,000
(500,000)
5,000,000 
60,000,000


8,500,000

681,226
3. Book value per share


The ratio of stockholder equity to the average number of [COLOR=#0000FF !important]common shares
. Book value per share should not be thought of as an indicator of economic worth, since it reflects accounting valuation (and not necessarily [COLOR=#0000FF !important]market[/COLOR]valuation).
Book Value of Per Share = Total Share Equity / Number of share O/s
= 74,181,226 / 6,50,000 = 114
Preferred Shares
(50,000@10
74181226
Tag : ,

MGT402 Assignment no 2 Fall 2012 Full Solution

ASSIGNMENT QUESTION:
Alec Ltd. is one of the largest electronic equipment producers in the country. It undertakes the work according to the consumer tastes and preferences. Following data is for the December 2012.
Cost from department - 1 Rs. 10,000
Cost added in department - 2:
Material Rs. 40,000
Labor Rs. 50,400
FOH Rs. 67,200
The quantity schedule shows that 20,000 units were received during the month from the department - 1 and 12,000 units transferred to finished goods storeroom. 8,000 units in process were 100% complete as to material and 60 % complete as to the conversion cost.
By using the above information, you are required to prepare/calculate:
1. Quantity schedule. 02 Marks
2. Cost accumulated in the department. 06 Marks
3. Accounting treatment / Cost apportionment. 09 Marks
4. Equivalent production units for material & conversion cost. 03 Marks
5. Per unit cost. 07 Marks



Solution

1- QUANTITY SHEDULE
Units transferd 12000
in process 8000
2- cost accumulated
deprtmnt 1 10000
material 40000
labor 50400
FOH 67200 167600
3- accounting treatment
12000 x 9.5 114000
units in process
from dep 1 8000 x .5 4000
matrl 8000 x 2 16000
labor 4800 x 3 14400
foh 4800 x 4 19200
4- Equivalent units
material 12000 + 8000 20000
conversion cost 12000 + 4800 16800
unit cost
previous deprtmnt 10000/20000 0.5
material 40000/20000 2
labor 50400/16800 3
foh 67200/16800 4
per unit cost total 9.5





1. 20,000 units
2. Rs. 167,600 (Hint, it must be 100% same as given in question)
3. Cost of units manufactured = 12,000 x 9.5 = 114,000
    Units in process 4,000 + 16,000 + 14,400 + 19,200 = 53,600 . So 114,000+53,600=167,600
    (Hint, it must be same as given in question and calculated in req-2)
4. 20,000, 20,000, 16,800, 16800 Units
5. (10,000/20,000= 0.50), (40,000/20,000=2.00), (50,400/16,800=3.00), (67,200/16,800=4.00)
    sum of all is Rs. 9.50

Tag : ,

MTH603 Assignment no 2 Fall 2012 Full Solution


Question No. 01 Complete Solution
Numerical Analaysis: "Divided Difference Forumula"
Find equation of a "Cubic Curve" that passes through the points (4,-43), (7, 83), (9,327) and (12, 1053) using the "Divided Difference Formula".
Points (4,-43), (7, 83), (9,327) and (12, 1053)
Using divided difference formula
4   -43
           42
7    83           16
           122          1
9    327          24
           242
12   1053
Column 1 and 2 given data
Column 3 obtained by 83-(-43) / 7-4 = 83+43 /3 = 126/3 = 42
                      327-83/9-7 = 244/2 = 122
                      1053-327/12-9 = 726/3 = 242
Column 4 obtained by 122-42/9-4 = 80/5 = 16
                      242-122/12-7 = 120/5 = 24
Column 5 obtained by 24-16/12-4 = 8/8 = 1
Third degree approximation given by

f(x) = f(4) + xf(4,7) + x(x-4)f(4,7,9)+x(x-4)(x-7)f(4,7,9,12)
     = -43 + x 42 + x(x-4) 16 + x(x-4)(x-7)
     = -43 + 42x-64x+16x^2 + x(x^2-11x+28)
     = -43 -22x +16x^2 + x^3-11x^2+28x
     = -43 +6x + 5x^2 +x^3
Third degree approximation is f(x) = x^3+5x^2+6x-43
Cubical curve given above thus ans.
 This is complete solution you can also give ur points on this if u have any doubt


Question No. 02 Complete Solution
Numerical Analaysis: "Lagrange's Formula"
Find interpolation polynomial by "Lagrange’s Formula", with the help of this table:
x 1 2 3 5
f(x) 0 7 26 124
And find the value of f (6).
x 1 2 3 5
f(x) 0 7 26 124
calculating lagranges coefficeitns
L0 = (x-2)(x-3)(x-5)/(1-2)(1-3)(1-5) = (x-2)(x^2-8x+15)/8 = (x^3-10x^2+31x-30)/8
L1 = (x-1)(x-3)(x-5)/(2-1)(2-3)(2-5) = (x-1)(x^2-8x+15)/3 = (x^3-9x^2+23x-15)/3
L2 = (x-1)(x-2)(x-5)/(3-1)(3-2)(3-5) = (x-5)(x^2-3x+2)/-4 = (x^3-8x^2+17x-10)/-4
L3 = (x-2)(x-3)(x-1)/(5-1)(5-2)(5-3) = (x-2)(x^2-4x+3)/24 = (x^3-6x^2+11x-6)/24
lagranges polynomial is = 0*(x^3-10x^2+31x-30)/8 + 7/3 (x^3-9x^2+23x-15)
-26/4 (x^3-8x^2+17x-10) + 124/24 (x^3-6x^2+11x-6)
simplyfying above
poly = x^3 (7/3-26/4+124/24) + x^2(-21+52-31 ) +x (23*7/3-17*26/4+11*124/24)
+ -15*7/3 +10*26/4 -31
= x^3 -1
f(x) is = x^3-1
f(6) = 6^3-1 = 216-1 = 215 thus ans.


Tag : ,

CS101 Assignment no 4 Fall 2012 Full Solution

Assignment Questions
Question: 1 Marks 10 

Suppose given is a worksheet of MS Excel. (Figure 1)

Apply the Most appropriate formulas in MS Excel using the same data given in the below diagram, to find the result (same as shown in the diagram) of the below mentioned requirements and just write down the formulas in the solution file (MS word file).

  1. Total sale
  1. Total sale of Asif
  1. Average sale of Asif
  1. Total Number of Products sold by Asif
  1. Maximum Price

[IMG]file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtmlclip1/01/clip_image003.jpg[/IMG]
(Figure 1)
Notes for question # 1: 

1) While writing formulas; only use the given range in formulas, other range should not be accepted
2) Do not send excel file, send us the word file only
3) Do not paste the excel file in the word file.
4) You are to only write down formulas in the word file.
Question: 2 Marks 5 

The “HaseebSoft” organization launches a project for 1 year. Now the Project Manger wants to build a computer network for the project smooth running of the project. The project details are given below:
Project Duration: 1 year (Extendable)
Required Resources: 12 computers+ 1 printer+1 scanner
Future enhancements: 8 to 10 computers may be added
For such type of scenario, which topology is most suitable for network and why? Justify your answer.
Solution:
Answer:
              The most suitable topology for such a network is “Star Topology”. By this type of topology the computers will be connected with each other using a “central hub” by which we can connect more computers with the network at any time without any breakage or any problem in the network. So, Star Topology is more reliable than that of other like “Ring Topology” because if a computer failed to work or have any problem it will not affect the entire network. So, We can replace computer at any time or can also add computers without any failure of the network. We can also share printer or scanner with entire work.

Explanation:
Comparison of all Topologies.
Ring Topology:
                  If we establish a network using Ring Topology it will stop entire network in case of a single node or computer failure. So, it is not so reliable to use in such an office.
Bus Topology:
                If we install a Bus Topology for such a network it will be more reliable but it will be very slow in performance.
Star Topology:
                If we use a “Star Topology” it will reduce all such problems and the network performance will be faster and reliable and in case of fault of a computer or node the entire network will not affected and we can easily replace or can add more computers in this network using central hub.



Product Price Agent
Washing Machine 15000 Asif
Microwave Own 7000 Asad
Refrigerator 55000 Asif
TV 30000 Asad
Fan 3000 Asif
Iron 2000 Asad
Juicer 5000 Asif
Tea set 4000 Asad
Dinner set 8000 Asad
Tag : ,

MTH501 Assignment no 3 Fall 2012 Full Solution


Question: 1                                                                                                                               Marks: 10

The set is a basis for P2. Find the coordinate vector of
relative to.

Question: 2                                                                                                                               Marks: 10

Let
Find a basis {u1, u2, u3} for R3 such that P is the change-of-coordinates matrix from {u1, u2, u3} to the basis {v1, v2, v3}.




Tag : ,

CS604 Assignment no 5 Fall 2012 Full Solution


uestion 1: [Marks 10]
Let us suppose that there are five processes P1, P2, P3, P4 and P5 and three resources Printer, scanner and
photocopier. Let us suppose that there are 25 instances of resource type Printer, 18 instances of resource type
scanner and 21 instances of resource type photocopier. Let us consider that at time T= 0, system has the
following state.
Max
Printer scanner photocopier
P1  10 8 6
P2  6 5 5
P3  12 3 5
P4  5 5 5
P5  7 6 6
Allocation
Printer scanner photocopier
P1  3 4 3
P2  5 3 3
P3  6 3 5
P4  5 4 4
P5  3 3 5
Available
Printer scanner photocopier
P1  3 1 1
P2
P3
P4
P5
Use safety algorithm (which is invoked by banker’s algorithm) and write down all the intermediate steps to find
out that either the system is in safe state or not.If system is in safe state then write down the safe sequence and if
system is not in safe state then give reason to support your answer.
Note: Write down all the intermediate steps during finding out the safe sequence. If you will not write down the
intermediate steps and if you will just write only the safe sequence then you will get zero marks.
Question 2: [Marks 10]
Let us suppose that there are five processes P1, P2, P3, P4 and P5 and three resources Printer, scanner and
photocopier. Let us suppose that there are 24 instances of resource type Printer, 18 instances of resource type
scanner and 21 instances of resource type photocopier. Let us consider that at time T= 0, system has the
following state.
Max
Printer scanner photocopier
P1  10 8 6
P2  6 5 5
P3  12 3 5
P4  5 5 5
P5  7 6 6
Allocation
Printer scanner photocopier
P1  3 4 3
P2  5 3 3
P3  6 3 5
P4  5 4 4
P5  3 3 5
Available
Printer scanner photocopier
P1  2 1 1
P2
P3
P4
P5
Use safety algorithm (which is invoked by banker’s algorithm) and write down all the intermediate steps to find
out that either the system is in safe state or not.If system is in safe state then write down the safe sequence and if
system is not in safe state then give reason to support your answer.
Solution:
Use Table Format for Submit this Assignment.

 Answer no.1


Allocation
Need

Work
P1
3
4
3
7
4
3
3
1
1
P2
5
3
3
1
2
2
8
5
5
P3
6
3
5
6
0
0



P4
5
4
4
0
1
1



P5
3
3
5
4
3
1



P4



Allocation
Need

Work
P1
3
4
3
7
4
3
3
1
1
P2
5
3
3
1
2
2
8
5
5
P3
6
3
5
6
0
0
11
9
8
P4
5
4
4
0
1
1



P5
3
3
5
4
3
1



P4, P1



Allocation
Need

Work
P1
3
4
3
7
4
3
3
1
1
P2
5
3
3
1
2
2
8
5
5
P3
6
3
5
6
0
0
11
9
8
P4
5
4
4
0
1
1
16
12
11
P5
3
3
5
4
3
1



P4, P1, P2



Allocation
Need

Work
P1
3
4
3
7
4
3
3
1
1
P2
5
3
3
1
2
2
8
5
5
P3
6
3
5
6
0
0
11
9
8
P4
5
4
4
0
1
1
16
12
11
P5
3
3
5
4
3
1
22
15
16
P4, P1, P2, P3, P5

Answer no.2



Allocation
Need

Work
P1
3
4
3
7
4
3
2
1
1
P2
5
3
3
1
2
2
7
5
5
P3
6
3
5
6
0
0



P4
5
4
4
0
1
1



P5
3
3
5
4
3
1



P4



Allocation
Need

Work
P1
3
4
3
7
4
3
2
1
1
P2
5
3
3
1
2
2
7
5
5
P3
6
3
5
6
0
0
12
8
8
P4
5
4
4
0
1
1



P5
3
3
5
4
3
1



P4, P2



Allocation
Need

Work
P1
3
4
3
7
4
3
2
1
1
P2
5
3
3
1
2
2
7
5
5
P3
6
3
5
6
0
0
12
8
8
P4
5
4
4
0
1
1
15
11
12
P5
3
3
5
4
3
1



P4, P2, P5



Allocation
Need

Work
P1
3
4
3
7
4
3
2
1
1
P2
5
3
3
1
2
2
7
5
5
P3
6
3
5
6
0
0
12
8
8
P4
5
4
4
0
1
1
15
11
12
P5
3
3
5
4
3
1
21
14
17
P4, P2, P5, P3, P1


Safety Alogrithm Sequence:
Answer No.1 : P4, P1, P2, P3, P5
 Answer No.2:  P4, P2, P5, P3, P1

Tag : ,

- Copyright © virtual university of pakistan - Skyblue - Powered by Blogger - Designed by Johanes Djogan -