Saturday 25 August 2012

CS402 Spring 2012 Assignmet_2


Theory of Automata (CS402)
Assignment # 2
Solution

  Total marks = 20
                                                                                       Deadline Date = Expired

Please carefully read the following instructions before attempting the assignment.

Rules for Marking
It should be clear that your assignment would not get any credit if:

  • The assignment is submitted after due date.
  • The submitted assignment does not open or file is corrupt.
  • The assignment is copied.

Note that strict action would be taken if the submitted assignment is copied from any other student. Both students will be punished severely.

1)      You should concern recommended books to clarify your concepts as handouts are not sufficient.
2)      You are supposed to submit your assignment in .doc format. Any other formats like scan images, PDF, Zip, rar, bmp etc will not be accepted.
3)      You are advised to upload your assignment at least two days before Due date.


Important Note: 

Assignment comprises of 20 Marks. Note that no assignment will be accepted after due date via email in any case (whether it is the case of load shedding or emergency electric failure or internet malfunctioning etc.). Hence, refrain from uploading assignment in the last hour of the deadline, and try to upload Solutions at least 02 days before the deadline to avoid inconvenience later on.

For any query please contact: CS402@vu.edu.pk

Question No. 1 [5+5]

Construct deterministic Finite State Automata for each of the following over Σ = {x, y}:

a. Language of all those strings in which second last symbol is ‘y’.
Solution:






















b. Language of all those strings whose length is odd and number of y’s is even.
Solution:
                                                           





















Question No. 2 [5+5]

a. Convert the given transition graph (TG) into generalized transition graph (GTG) and derive its regular expression.                
Solution:

First of all single initial and single final states are required as given below:

After eliminating state 3 the TG will look like:

Now eliminate state 4
Eliminate state 5
Now eliminate state 6

After eliminating states 1 and 2 the GTG will look like:

b. Find out the union of the given two FAs:













Solution:



   New states after reading
Old States



a
b



z1 - = (x1, y1)
(x2, y2) = z2
(x2, y2) = z2
z2= (x2, y2)
(x2, y3) = z3
(x3, y2) = z4
z3+ = (x2, y3)
(x2, y3) = z3
(x3, y3) = z5
z4+ =(x3, y2)
(x3, y3) = z5
(x3, y2) = z4
z5+ = (x3, y3)
(x3, y3) = z5
(x3, y3) = z5


The resultant FA of the union of above two FAs is given below:







CS402 Spring 2012 Assignmet_1


Theory of Automata (CS402)
Assignment # 1(Solution)
  Total marks = 20
                                                                                       Deadline Date = Expired

Please carefully read the following instructions before attempting the assignment.

Rules for Marking
It should be clear that your assignment would not get any credit if:

  • The assignment is submitted after due date.
  • The submitted assignment does not open or file is corrupt.
  • The assignment is copied. Note that strict action would be taken if the submitted assignment is copied from any other student. Both students will be punished severely.

1)      You should concern recommended books to clarify your concepts as handouts are not sufficient.
2)      You are supposed to submit your assignment in .doc format. Any other formats like scan images, PDF, Zip, rar, bmp, docx etc will not be accepted.
3)      You are advised to upload your assignment at least two days before Due date.
4)      This assignment file comprises of Two (3) pages.


Important Note: 

Assignment comprises of 20 Marks. Note that no assignment will be accepted after due date via email in any case (whether it is the case of load shedding or emergency electric failure or internet malfunctioning etc.). Hence, refrain from uploading assignment in the last hour of the deadline, and try to upload Solutions at least 02 days before the deadline to avoid inconvenience later on.

For any query please contact: CS402@vu.edu.pk



Q 1.

a. Define the language of strings of length 3 over Σ = {#, %, @}.                 Marks 4
Ans.
            L = {###, ##%, ##@, #%#, #@#, #%%, #@%, #@@, #%@, %##, %#%, %#@, %%#, %@#, %@%, %%%, %%@, %@@, @###, @#%, @#@, @%#, @%%, @%@, @@#, @@%, @@@ }       



b. Generate the reverse of language generated in part a.                             Marks 4
Ans.
            Rev (L) = {###, %##, @##, #%#, #@#, %%#, %@#, @@#, @%#, ##%, %#%, @#%, #%%, #@%, %@%, %%%, @%%, @@%,##@, %#@, @#@, #%@, %%@, @%@, #@@, %@@, @@@}



c. Identify if there is any palindrome.                                                                          Marks 2
Ans.
            Palindromes= {###, #%#, #@#, %#%, %@%, %%%, @#@, @%@, @@@}
                                   



                                                                                                                              
Q 2.

Consider the language of strings defined over Σ = {x, z, xy, yz, zx} with the following strings:
i.  xyzxyz
ii. xxyzxy

a. Tokenize the above strings in all possible ways along with finding their lengths.                                                                                                                                          Marks 6

Ans.
i.  xyzxyz

The give string can be tokenized in the following four ways:

Tokenization                 Length

(x)(yz)(x)(yz)                4         
(xy)(zx)(yz)                   3
(x)(yz)(xy)(z)                4
(xy)(z)(x)(yz)                4





ii. xxyzxy

The string can be tokenized in the following two ways:
Tokenization                 Length

(x)(x)(yz)(xy)                  4
(x)(xy)(z)(xy)                 4



b. Explain whether the above alphabet is valid or not along with justification?
Marks 4
Ans.

The given alphabet Σ = {x, xy, yz, zx} is an invalid alphabet because “x” is the prefix of “xy” and “z” is the prefix of “zx” where x and z are already letters of the given alphabet set.  From the definition of invalid alphabet we know that an alphabet set is invalid if there is a letter which is the letter of the alphabet set and is the prefix of another letter.



Saturday 21 July 2012

Assignment_of_CS201

#include<iostream.h>
#include<conio.h>

main()

{
char i;
int a, b;

do
{
system("cls");
cout<<"******Challan Calculator for Traffic Violations******";
cout<<endl;
cout<<endl;
cout<<"Enter '1' for Breaking Signal:";
cout<<endl;
cout<<"Enter '2' for Over Speed:";
cout<<endl;
cout<<"Enter '3' for Wearing not Seat Belt:";
cout<<endl;
cout<<endl;
cout<<"Enter the type of traffic violation 1, 2 or 3:";
cin>>a;
cout<<endl;
switch(a)
{
case 1:
cout<<"Enter the numbers of days passed till challan date:";
cin>>b;
cout<<endl;

if(b<=10)cout<<"The total fine is Rs: "<<500;
else if (b<=30)cout<<"The total fine is Rs: "<<500*2;
else if (b>30)cout<<"The total fine is Rs: "<<(500*2)+(500/2);
break;
case 2:
cout<<"Enter the numbers of days passed till challan date:";
cin>>b;
cout<<endl;

if(b<=10)cout<<"The total fine is Rs: "<<300;
else if (b<=30)cout<<"The total fine is Rs: "<<300*2;
else if (b>30)cout<<"The total fine is Rs: "<<(300*2)+(300/2);

break;
case 3:
cout<<"Enter the numbers of days passed till challan date:";
cin>>b;
cout<<endl;

if(b<=10)cout<<"The total fine is Rs: "<<200;
else if (b<=30)cout<<"The total fine is Rs: "<<200*2;
else if (b>30)cout<<"The total fine is Rs: "<<(200*2)+(200/2);
break;
default:
cout<<endl;
cout<<endl;
cout<<"Please Enter a Valid Type of Traffic Violation:";
cout<<endl;
cout<<endl;
getch();
cout<<endl;
cout<<endl;
system("cls");
main();
break;

}

cout<<endl;
cout<<endl;
cout<<"Do you want another challan calculation? (y/n):";
cin>>i;
}
while(i != 'N' && i != 'n' );

}

Saturday 2 June 2012

Solution_CS601_3

Assignment No. 3 
Semester Spring 2012
Data Communication - CS601



Q. 1. Suppose you have been asked to give a proposal of a Local Area Network for a company which requires easy reconfiguring, efficient in speed and economical in cost network. Considering these three factors, which guided media you will prefer for this type of network? Give three good reasons to support your answer.
(2 Marks for suggestion/name of media and 3 marks for three reasons) [2+3 = 5]

Solution:
              Unshielded Twisted Pair (UTP) Cable.

Q. 2. Analog signals are considered more prone to Noise as compared to digital signals. Suggest a proper method or technique with its complete steps for a telecommunication company which wants to convert its analog signals in digital signal to avoid from noise.
Note: just name the technique and its steps, detail is not required.  [5 Marks]

Solution:
             Pulse Amplitude Modulation
             Pulse Code Modulation

Q. 3. In Data Communication, situations exist where we need to change the Digital Signals into Analog Signals.  Select the technique(s) which is/are used by modems for this purpose. Choose all that apply. [10 Marks]

1.      B8ZS
2.      Quantization Amplitude Modulation
3.      Amplitude Shift Keying
4.      Frequency Shift Keying
5.      Frequency Modulation
6.      Frequency Reducing Key
7.      Frequency Division Multiplexing
8.      Phase Shift Keying
9.      Phase Modulation
10.  Quadrature Amplitude Modulation
11.  Manchester Encoding Scheme
12.  4 PSK

Solution:
             Amplitude Shift Keying.
             Frequency Shift Keying.
             Phase shift Keying.
            Quardrature Amplitude Modulation.

For More info Contact With me.
03155522233