Showing posts with label Solutions. Show all posts

CS201 Assignment no 3 Fall 2012 Full Solution


#include<iostream.h>
#include<conio.h>
using namespace std;
class Vehicle{
public:

void display();
void setcompany(string a);
void setmodel(string a);
void setenginecapacity(int a);
void setyear(int a);

void getinput();
string getcompany();
string getmodel();
int getenginecapacity();
int getyear();

Vehicle();

Vehicle(string,string,int,int);

~Vehicle();
private:
string company;
string model;
int year;
int enginecapacity;
string company2;
string model2;
int year2;
int enginecapacity2;    
int number,S,C;
};
Vehicle::Vehicle()
{
company=S;
model=C;
year=2011;
enginecapacity=1500;
}
void Vehicle::getinput()
{

cout<<"Enter the number of vehicle :";
cin>>number;
cout<<"Vehicle1"<<endl;
cout<<"Enter the name of vehicle maker company :";
cin>>company;
cout<<"Enter the vehicle model :";
cin>>model;
cout<<"Enter year of registration :";
cin>>year;
cout<<"Enter the engine capacity of the vehicle :";
cin>>enginecapacity;
cout<<endl;

cout<<"Vehicle2"<<endl;
cout<<"Enter the name of vehicle maker company :";
cin>>company2;
cout<<"Enter the vehicle model :";
cin>>model2;
cout<<"Enter year of registration :";
cin>>year2;
cout<<"Enter the engine capacity of the vehicle :";
cin>>enginecapacity2;
cout<<endl;
}




Vehicle::~Vehicle()
{
cout<<"object deleted"<<endl;          
}

void Vehicle::display()
{

cout<<"vehicle 1"<<endl<<"Enter the vehicle maker company :"<<getcompany()<<endl<<"Enter the vehicle model :"<<getmodel()<<endl<<"Enter year of registration :"<<getyear()<<endl<<"Enter the engine capacity of the vehicle :"<<getenginecapacity();
cout<<endl;

cout<<"vehicle 2"<<endl<<"Enter the vehicle maker company :"<<company2<<endl<<"Enter the vehicle model :"<<model2<<endl<<"Enter year of registration :"<<year2<<endl<<"Enter the engine capacity of the vehicle :"<<enginecapacity2;
cout<<endl;
}


void Vehicle::setcompany(string k)
{
company=k;                      
}
void Vehicle::setmodel(string a)
{
model=a;                    
}
void Vehicle::setyear(int a)
{
year=a;                    
}
void Vehicle::setenginecapacity(int a)
{
enginecapacity=a;    
}
string Vehicle::getcompany()
{
return company;  
}
int Vehicle::getenginecapacity()
{
return enginecapacity;  
}
string Vehicle::getmodel()
{
return model;  
}
int Vehicle::getyear()
{
return year;  
}



int main()
{
    Vehicle raousman1;

    raousman1.getinput();
    raousman1.display();
    raousman1.~Vehicle();
   
getch();
}

Tag : ,

MTH202 Assignment no 3 Fall 2012 Full Solution



Q#01: Use mathematical induction to prove that for every integer with . (Note that this inequality is false for and .) Marks = 6
BASIC STEP:
p(4) = 2^n 
2^4 =16 < 24 = 4!

INDUCTIVE STEP:

For this step we assume that p(k) is true for posiive integer k with k>=4
Assume:
2^k < k!
2^k+1 < (k+1)!
2^k+1 = 2.2^k

< 2.k!

< (k+1)k!

= (k+1)!

So p(k+1) is true when p(k) is true.

Q#02: Find the GCD of and using Division Algorithm. Marks = 4
Let a= 4566891 and b=182 . Also, let's introduce the variable "r" for the remainder
Let's evaluate a/b . It turns out that a/b = 25092 remainder 147. What we're are interested in is the remainder.
So let . Now assign the value of "b" to "a" and the value of "r" to "b".
So now a=182 ,b=147 and r=147

Now we must ask ourselves: "Does b=0?". Since b=147 (which is NOT zero), we must start all over and keep going until "b" equals zero.

Let's evaluate a/b . It turns out that a/b= 182/147 = 1 remainder 35. What we're are interested in is the remainder.
So let . Now assign the value of "b" to "a" and the value of "r" to "b".
So now a=147 ,b=35 , and r=35

Now we must ask ourselves: "Does b=0?". Since b=35 (which is NOT zero), we must start all over and keep going until "b" equals to zero

Let's evaluate a/b . It turns out that a/b= 147/35 = 4 remainder 7. What we're are interested in is the remainder.
So let . Now assign the value of "b" to "a" and the value of "r" to "b".
So now a=35 ,b=7 , and r=7

Now we must ask ourselves: "Does b=0?". Since b=7 (which is NOT zero), we must start all over and keep going until "b" equals zero.

Let's evaluate a/b . It turns out that a/b = 35/7 = 5 remainder 0. What we're are interested in is the remainder.
So let . Now assign the value of "b" to "a" and the value of "r" to "b".
So now a=7 ,b=0 , and r=0
Since the value of b is now zero, we can stop the process.
Now the value of "a" in the last row is the GCD of the numbers "a" and "b" 
So this means that GCD(4566891,182)=7.


Q#03: Define a sequence by the formula , for all integers . Show that this sequence satisfies the recurrence relation , with and for all integers . Marks = 5



Tag : ,

PHY101 Assignment no 3 Fall 2012 Full Solution


Question No 1

(a)What is the electric field at the location of the test charge shown below? And what is the 
direction of electric field? Marks = 5

(b) What are the magnitude and direction of the electric field at point A shown below? Marks = 6

Question No 2


Find the force on the electron in figure shown below and also determine the acceleration of 
electron? Mention the direction of force and acceleration as well.
Note that mass of electron is 9.1×10-31kg, and the value of charge on electron is (-1.6×10-19 C)
Marks = 7

Question No 3


Is it true to say that electric field lines are the same as electric field vectors. If yes give an 
example if not explain it. Marks = 6

Question No 4


Suppose you increased the amount of the charge of a test charge, and the force exerted on it

changed. This means the field you were assessing must have changed. Marks = 5

Question No 5


(a) It takes 10.0 J of work by the right-hand wand to separate the charges as shown in figure.

What is the change in potential energy? Marks = 3


(b) Is it true to say that electric potential energy and electric potential are the same?

Either yes or no explain in each case. Marks = 3



Solutions

Q1.a
E=F/q
use this formula to find Electric field.
Q.1.b
E=K.q/r2 (r square)
use this formula to find magnitude.
Q.3
Answer:-
Yes It is true to say that electric field lines are the same as electric field vectors
field line is a locus that is defined by a vector field and a starting location within the field.A vector field defines a direction at all points in space; a field line for that vector field may be constructed by tracing a path in the direction of the vector field. More precisely, the tangent line to the path at each point is required to be parallel to the vector field at that point.
A complete description of the geometry of all the field lines of a vector field is sufficient to completely specify the direction of the vector field everywhere. In order to also depict the magnitude, a selection of field lines is drawn such that the density of field lines (number of field lines per unit perpendicular area) at any location is proportional to the magnitude of the vector field at that point.

Q.4
by the relation E=F/q it is very clear that if amount of charge or force is changed E will be changed.
 Q.5.b (wikipedia)
Electric potential energy, or electrostatic potential energy, is a potential energy (measured in joules) that results from conservative Coulomb forcesand is associated with the configuration of a particular set of point charges within a defined system.
The electric potential at a point is equal to the electric potential energy (measured in joules) of any charged particle at that location divided by thecharge (measured in coulombs) of the particle. Since the charge of the test particle has been divided out, the electric potential is a "property" related only to the electric field itself and not the test particle. The electric potential can be calculated at a point in either a static (time-invariant) electric field or in a dynamic (varying with time) electric field at a specific time, and has the units of joules per coulomb, or volts.
Tag : ,

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