Sunday, October 30, 2011

cs501 assignment no 1 solution fall 2011

Assignment No. 01
Semester Fall 2011
Advance Computer Architecture - CS501

Total Marks: 20

Due Date: 31/10/2011

Objective:
To learn and understand classification of instructions.

Instructions:
Please read the following instructions carefully before solving & submitting assignment:
Assignment should be in your own wordings not copied from net, handouts or books.
It should be clear that your assignment will not get any credit (zero marks) if:

o        The assignment is submitted after due date.
o        The submitted assignment does not open or file is corrupt.
o        The assignment is copied (from other student or copied from handouts or internet).



GOOD LUCK
Question No 1

Marks: 5+5+5+5 = 20 

Write the code to implement the expression A = (B+C) * (D + E) for

1)      3-address instructions
2)      2-address instructions
3)      1-address instructions
4)      0-address instructions

In accordance with programming language practice, computing the expression should not change the values of its operands.

=========================================================================

Solution

1)      3-address instructions

add x, b, c
add y, d, e
mul a, x, y

2)      2-address instructions


 load r, d                                                   
add r, e
 load y, b       
add y, c                                           
 mul y, r                                                   
store a, y

3)      1-address instructions

lda B
adda C
sta x
lda D
adda E
mula x
sta A



4)      0-address instructions

push b                                                   
push c
add
push d                                                   
push e          
add
mul                                                   
pop a




CS402 assignment no. 1 solution fall 2011 soon

Theory of Automata

CS402

ASSIGNMENT NO.1

Total Marks= 20 (4+4+4+4+4)

Assignment Submission Deadline

Your assignment must be uploaded before or on 31-10-2011 [upload your assignment well before due date to avoid any assignment uploading related issues]

Rules for Marking

It should be clear that your assignment will not get any credit if:
  • The assignment is submitted after due date
  • The assignment is copied

Objectives

Objectives of this assignment are to make students able to understand the following concepts,
  • Basic concepts clarification
  • Recursive Definition of a language
  • Regular Expression
  • Finite Automata

Question No.1 Basic Concepts [Sets, Letters, Valid Alphabet, Languages, Strings and Words]

a. Which of the following are strings generated from alphabet Σ = {a, b}
                     i.            abba
                   ii.            baa$a
                  iii.            abc.
                 iv.            ba?
                   v.            b.bba
b. Which of the following are valid words for language of all strings ending with bab defined for alphabet Σ = {a, c ,  bab}
                     i.            acccba
                   ii.            cccbaa
                  iii.            cccbab
                 iv.            babbb
                   v.            baaab


Question No.2 Defining Languages [Using Recursive Definition, Re’s, Fa’s]

Give recursive definitions of following languages defined over alphabet Σ = {a, b}
  1. Having all strings starting with b and having length greater than 2
  2. NOT having ab at any place.

Question No.3 Regular Expressions

Give Regular Expression for each of the following language defined over alphabet Σ = {a, b}
  1. Even Length strings ending with b

  1. Strings with b’s count multiple of three

Question No.4 Models To Recognize Languages (Fa’s)

Give Finite Automata (FA) for each of the following language defined over alphabet Σ = {a, b}
  1. Language having all strings NOT containing aa at any place
  2. Language of all strings NOT STARTING with bb

Question No.5 Models To Recognize Languages (Nfa’s)

Give Non Deterministic Finite Automata (NFA) for each of the following language defined over alphabet Σ = {a, b}
  1. Language of all strings STARTING WITH bba
  2. Language having all strings NOT having even no of a’s and b’s

You can view the demo video in file,http://vulms.vu.edu.pk/Courses/CS402/Downloads/Assignment1.00.zip to see how to make FA in MS Word.

Note:

Please keep in view the following points while attempting any question:
  • Where OR is used in the description of a language it means that expressions on both sides of ‘OR’ are parts of the language.
  • Where NOT is used in the description of the language it means that language includes all strings except described in the ‘NOT’ condition, for example language NOT starting with a, means all strings not having a in the start (you have to evaluate yourself what kinds of strings are these).

Assignment Uploading Instructions:

  • Upload single word file having solutions for all parts as well as chart images.
  • You can crop and compress images in the word file by double clicking on an image and selecting compress all images option to decrease file size before uploading it.

Appendix:

Definition of Set:
A set can be defined as follows:
“Non repeating collection of elements”
Example Sets:
  1. {car, bus }
  2. {table, chair , stand}
  3. {basket ,eggs}
  4. { ^, #, *, / }

However {car, car, bus} is NOT a set according to its definition.

Wednesday, October 26, 2011

Assignment Solution CS201 1 Fall 2011 Virtual Restaurant

copy the code in Div c++ and run it.
Please makes changes before submit it.




#include<iostream.h>


main()
{
      int price, total=0, tax, cus=0, gtotal=0;
      char chr;
      cout<<"*** Virtual Restaurant ***\n";
   
      do
      {
           cus++;
           cout<<"\nplease Enter the Price of Meal: ";
           cin>>price;
         
           if(price<=1000)
           {
                          tax=0;
           }
           else if(price >1000 && price < 2000)
           {
                         tax = price * 1/100;
           }
           else if (price >2000 )
           {
                          tax = price * 2/100;
           }
         
           cout<<"\n\nPrice of meal: "<<price<<endl;
           cout<<"Sales Tax:     "<<tax<<endl;
           cout<<"-------------------------"<<endl;
           total = price + tax;
           gtotal+=total;
           cout<<"Total Amount:  "<<total<<endl;
         
           if(total < 1000)
           {
                    cout<<"\nThis customer should be served with candies"<<endl;
           }
           else if(total >= 1000 && total < 2000)
           {
                    cout<<"\nThis customer should be served with Sweet Bread"<<endl;
           }
           else if(total >= 2000 && total < 3000)
           {
                    cout<<"\nThis customer should be served with Pudding"<<endl;
           }
           else if(total >= 3000 && total < 4000)
           {
                    cout<<"\nThis customer should be served with Cake"<<endl;
           }
           else
           {
                    cout<<"\nThis customer should be served with Trifle"<<endl;
           }
         
           cout<<"\nDo You Want to Process another Customer?  ";
           cin>>chr;
         
         
      }
      while(chr == 'y' || chr == 'Y');
   
      cout<<"\n\n\nGrand Total:"<<endl;
      cout<<"\nTotal Customers:            "<<cus<<endl;
      cout<<"Total Amount of all bills:  "<<gtotal<<"\n\n"<<endl;
   
      system("pause");
}

Monday, October 10, 2011

Make GLUT project in Dev C++

Run Dev c++. Click File Menu and then on Project.



after this a window in opened.chose GLUT then click ok.


Save this project file. coding is shown in the window. Press F9.



when we press F9. it prompt for saving file. give a name to file and save it.

Program run and following window is appeared. Press + to increase the slices and - for decreasing the number of slices.

Thursday, October 6, 2011

Installing the Glut library ( Opengl ) in Dev C++

Installing the Glut library ( Opengl ) in Dev C++

When we install Bloodshed Dev C++, it has not installed glut library built in. We can install it manually. Glut library is used for opengl programming. It is for graphics designing and rendering especially for 3D graphics.   

Download the Glut package from the following link.






Run the package to install. After running the package following window is appeared.


Click the install button to process. After installation following window is appeared.


Click Finish.

Glut package has been installed.

After this following window is appeared that show the glut icon that has been installed in Dev C++ in package manager.





cs619 Final Project List fall 2011

Project Title
Energy Consumption Calculator for Data Centers
Project Description
Data centers interconnect servers to the clients to provide efficient services to the clients. As the Data centers contain thousands ofServers and other IT equipments cause increasing demand of electricity. This project will be related to electricity consumption calculation for the IT equipments, how much energy can be saved if some equipment is not working and what could be the effects on electricity bills.
Supervisor
Adnan Asif
Application Type
Desktop
Possible Students
1 to 2                                                                   
Required Aptitude
Motivated to work hard to deal with challenging tasks.
Required Background
Good programming skills.
Proposed Tools & Tech
Microsoft .NET, Visual Studio, SQL Server, Java, MySQL
Further Information
For further information/explanation/material  please contact atadnanasif@vu.edu.pk



Project Title
A tool for automated scoring of Scanned MCQ tests
Project Description
The purpose of this project is to automate the MCQ Paper marking process. End product will be able to extract the given answers from the scanned copy of MCQ’s answer sheet will save the data and compile the result.
Supervisor
Sarfraz Ahmad
Application Type
WIN / WEB
Possible Students
1 to 2
Required Aptitude
Motivated to work hard to deal with challenging tasks.
Required Background
Good in programming skills
Proposed Tools & Tech
C++, Java, dot Net Technologies or Matlab
Further Information
For further information/explanation/material  please contact atsawan@vu.edu.pk

============


Project Title
SEO Link Engine
Project Description
SEO = Search Engine Optimization
Countless web sites exist on internet and many of them are managed either by their owners or web masters. Often there is a need to improve web site in search results so that when a user searches for a certain keyword or phrase, a related web site gets in top results. Hence getting user traffic is the most fundamental goal in Search Engine Optimization (SEO) for any web site. Link building and link exchange are very common to start or convert a web site to SEO enabled web site.
Supervisor
Usman Waheed
Application Type
WEB
Possible Students
1 to 2
Required Aptitude
Motivated to work hard to deal with challenging tasks.
Required Background
Good in programming skills
Proposed Tools & Tech
Mircosoft .Net and MS SQL Server; Java/PHP and MySQL
Further Information
For further information/explanation/material  please contact atas5@vu.edu.pk

============



Project Title
Statistical Analyzer for Data Manipulation
Project Description
The project will focus on developing a web application that will manipulate the data provided in the excel sheet. The excel data will be transformed from excel to normalized database. The GUI basedapplication will be able create the various type of graphs such as pie chart, bar graph, etc as per user requirements. The application will also be able to calculate the total figures of various indicators mentioned in different countries and specified time period. 
Supervisor
Adnan Ashraf
Application Type
Web Application
Possible Students
1 to 2                                                                   
Required Aptitude
Motivated to work hard to deal with challenging tasks.
Required Background
Good programming skills and strong database concepts.
Proposed Tools & Tech
Microsoft .NET/Java/Php, Sql Server/MySql, Jquery
Further Information
For further information/explanation/material  please contact atadnan.ashraf@vu.edu.pk



Assignment Solution cs610 Q1. In which situation multiplexing is used? Explain with the help of working structure.

Multiplexing is to combine multiple signals (analog or digital) for transmission over a single line or media. A common type of multiplexing combines several low-speed signals for transmission over a single high-speed connection. Multiplexing can be used to achieve large number of signals simultaneously and to reduce the cost of transmission.
A real world example of multiplexing is the transmission from the computer/instrumentation system of a satellite, space craft or other remote vehicle to a ground-based system.




Q2. XYZ Company has two offices in Multan. Each office has 40 systems. Network administrator want to connect both offices, as for as he has no budget issues. Answer the following questions.

Which cable is suitable for networking? Give reasons

Solution:

Company has no budget issue so fiber optic Due to much lower attenuation and interference, optical fiber has large advantages over existing copper wire in long-distance and high-demand applications.

Which network Topology will be used with in the office and why?

Solution:
Star Topology will be used in office / building network. It is a most usable topology in local area network from all over the world. Star topology can be easily put into practice in offices or in a building. It is easy to configure, and you can easily increase computers in a network without any disturbance. You can easily diagnose the error due to central device. In star network if any cable or node failure then there is no effect on entire network.
Which network Topology will be used for connecting two offices and why?
    
Solution:
Bus Topology will be suitable for networking between these 2 offices / buildings. Bus Topology is used for small and simple network. Bus topology connects all computers in a linear shape with a backbone to connect all computers. it is very easy and understandable. There is no much wires used for connectivity therefore it is less expensive. A user can easily extend a Bus topology because two cables can easily joined with a one long cable.


Which network device will be used to connect two offices?
     
 Solution:
 Switches and / or Routers will be used.

Solved Past Paper CS610 Computer Network Final term 2010

Question No: 1      ( Marks: 1 ) - Please choose one
 

A ---------- relies on the hardware manufacturer to assign a unique physical address to each network interface.



       ► Static addressing scheme

       Configurable addressing scheme


       Dynamic addressing scheme

       None of the given



Question No: 2      ( Marks: 1 ) - Please choose one
 

An interface for thin  Ethernet must have an ____________  connector , and must generate signals according to the_____________ specification.

       ► RJ-45, 10 Base T

       RJ-45, 10 Base 5


       BNC, 10 Base 2


       BNC, 10 Base T



Question No: 3      ( Marks: 1 ) - Please choose one
 

A system with redundant bridges might have a problem with_______ in the system.


       ► Loop

       Filters

       Spanning Trees

       All given choices



Question No: 4      ( Marks: 1 ) - Please choose one
 

A Bridge can ________


       Filter a frame

       Forward a frame

       Extend a LAN

       ► Do all the above



Question No: 5      ( Marks: 1 ) - Please choose one
 

________ is used for typical data applications (where the data rate may be unknown and bursty) and allows use of whatever bandwidth is available at a given time.

       Constant Bit Rate (CBR) service

       Variable Bit Rate (VBR) service

       ► Available Bit Rate (ABR) service

       None of the given



Question No: 6      ( Marks: 1 ) - Please choose one
 

ATM assigns each VC a _____________ identifier that is divided two parts to produce a hierarchy.

       21-bit

       22-bit

       23-bit

       ► 24-bit



Question No: 7      ( Marks: 1 ) - Please choose one
 

________ of TCP/IP layering model, corresponds to basic network hardware.


       ► Physical Layer

       Network Interface Layer

       Internet Layer

       Transport Layer




Question No: 8      ( Marks: 1 ) - Please choose one
 

___________ places the boundary between the second and third octets

       ► Class A

       Class B

       Class C

       Class D



Question No: 9      ( Marks: 1 ) - Please choose one
 

UDP and TCP are both_________ layer protocols


       Physical

       Data link

       Network


       ► Transport



Question No: 10      ( Marks: 1 ) - Please choose one
 

Connection-oriented service, Point-to-point, Complete reliability, Full-duplex communication, Stream interface, Reliable connection startup and Graceful connection shutdown are the services provided by__________

       IP

       None of the given

       ► TCP

       UDP



Question No: 11      ( Marks: 1 ) - Please choose one
 

_______ protocols of TCP/IP layering model specify how to ensure reliable transfer.

       Physical Layer

       Network Interface Layer

       Internet Layer

       ► Transport Layer




Question No: 12      ( Marks: 1 ) - Please choose one
 

________identifies which application program on receiving computer should receive the data

       Logical address
Source port
Logical address
None of the given


       Source port

       ► Destination Port

       None of the given



Question No: 13      ( Marks: 1 ) - Please choose one
 

________ identifies the application program that sent the data.

        Destination Port


       ► Source port

       Logical address

       None of the given



Question No: 14      ( Marks: 1 ) - Please choose one
 

Which of the following are interior routing protocols?


       ► RIP

       OSPF

       BGP

       RIP and OSPF




Question No: 15      ( Marks: 1 ) - Please choose one
 

The Border Gateway Protocol (BGP) uses_________ for all communication


       UDP

       ► TCP

       Both UDP and TCP


       None of the given



Question No: 16      ( Marks: 1 ) - Please choose one
 

__________measures distance in network hops, where each network between the source and destination counts as single hop.

       BGP

       OSPF

       ► RIP

       None of the given




Question No: 17      ( Marks: 1 ) - Please choose one
 

OSPF is based on--------


       Distance vector routing

       ► Link state routing

       Path vector routing

       Distance vector routing and Link state routing




Question No: 18      ( Marks: 1 ) - Please choose one
 

_________ performs local multicast and uses IP-in-IP encapsulation to send multicast datagrams from one site on the Internet to another.

       ► Distance Vector Multicast Routing Protocol (DVMRP)

       Core Based Trees (CBT)


       Protocol Independent Multicast_ Sparse Mode (PIM-SM)

       Protocol Independent Multicast _ Dense Mode (PIM-DM)




Question No: 19      ( Marks: 1 ) - Please choose one
 

The length of time required to send a variable length packet is variable and does not require a complicated interrupt scheme to detect completion of transmission.

       True

       False



Question No: 20      ( Marks: 1 ) - Please choose one
 

NEXT HEADER field in the base header defines type of header and it appears at end of fixed-size base header.

       True

       False



Question No: 21      ( Marks: 1 ) - Please choose one
 

Although message exchange can be used to bind addresses, sending a request for each binding is hopelessly inefficient.

       True

       False



Question No: 22      ( Marks: 1 ) - Please choose one
 

Address mask defines how many bits of address are in suffix?

       True

       False



Question No: 23      ( Marks: 1 ) - Please choose one
 

A computer attached to a given network can only communicate with other computers attached to the same network. Is this a problem with multiple networks?


       True

       False



Question No: 24      ( Marks: 1 ) - Please choose one
 

In the 1970s large organizations began to acquire multiple networks. Each network in the organization formed island. Employees needed to choose a computer appropriate for each task. So they needed multiple screens, keyboards and computers.


       False

       True



Question No: 25      ( Marks: 1 ) - Please choose one
 

The term self-identifying is used for Classful IP addresses because the class of the address can be computed from the address__________.  

       itself

       prefix

       suffix

       mask



Question No: 26      ( Marks: 1 ) - Please choose one
 

In which method of Address Resolution Protocol the protocol address independent of hardware address?
Were "T" stands for Table lookup, "C" for Closed-form Computation and "D" for Data Exchange?

       T, C

       D

       C

       T, D



Question No: 27      ( Marks: 1 ) - Please choose one
 

In which method of Address Resolution Protocol the protocol address is determined by hardware address?
Were "T" stands for Table lookup, "C" for Closed-form Computation and "D" for Data Exchange?

       T

       D

       C

       T, C



Question No: 28      ( Marks: 1 ) - Please choose one
 

Reconstruction of original datagram is called reassembly.

       True

       False



Question No: 29      ( Marks: 1 ) - Please choose one
 

A computer needs a complete stack of protocols to run either a client or a server.

       True

       False



Question No: 30      ( Marks: 1 ) - Please choose one
 

TCP uses _______ mechanism to control the flow of data.

       door

       window

       acknowledgment

       retransmission



Question No: 31      ( Marks: 2 )
 

To solve the problem the routers and networks in the Internet are divided into groups. How large do you think are these groups?



Question No: 32      ( Marks: 2 )
 

Traceroute continues to increment the Time To Live until the value is large enough for the datagram to reach its final destination. What happens when the TTL is sufficiently large for the datagram to reach its destination?




Question No: 33      ( Marks: 2 )
 

How can TCP monitor internet delays?


Question No: 34      ( Marks: 2 )
 

Which wireless standard is used in WIFI technology?



Question No: 35      ( Marks: 3 )
 

How does IP software reassemble fragments that arrive out of order?



Question No: 36      ( Marks: 3 )
 

What kind of information is in a routing table?



Question No: 37      ( Marks: 3 )
 

Define frames without type field?



Question No: 38      ( Marks: 3 )
 

What is the meaning of Facilities For Transit Routing as a characteristic of the Border Gateway Protocol?


Question No: 39      ( Marks: 5 )
 

What are the charachteristics of the Border Gateway Protocol?


Question No: 40      ( Marks: 5 )
 

Describe how NAT can be usefull for residence with cable modem or DSL?