We Provide All study stuff here for free. We Believe in educating the nation

Tag Archives: Virtual University

Please click on the following link for CS301 VU Current Assignment No. 3 Spring 2012 Solution:

CS301 VU Current Assignment No. 3 Spring 2012 Solution

Attention: read it before downloading:

ATTENTION PLS: to download you are requiring a user name and password to login DocStoc. If you don’t have, then you may use our following logins:

If you want to download these above files THEN you must have two registered yourself at “DocStoc.com“, IF you don’t want to register yourself on DocStoc then you may use our ready login/username. The user name and password for “DocStoc.com” is as follows:-

Suppose three movies (Harry Potter, English Vinglish and Tekken) are on display in a cinema. Three different counters are distributing tickets for each movie. To purchase a particular movie ticket, you are required to standing the respective movie counter queue.

Considering the above scenario, write a C++ program which asks a user to choose the movie for which he/she would like to purchase a Ticket. While choosing the movie ticket, user should be asked to enter his/her social group [F for female, M for male and K for kids].

The required program functionalities should be:

> Take input for all the three movies.
> Display the total number of visitors for each movie.
> Display total revenue of cinema and total revenue of each movie (Suppose price of one ticket is 650/-).
> Display the best business earning movie of the cinema.
> Check the popularity of each movie amongst social groups (females, males or kids).

Solution Guidelines:

1) To purchase the movie ticket, viewer must have to stand in the queue. The length of the queue can vary so you have to implement queue as link list.

2) Create a class named Viewer (Node class); this class should create a node for each ticket. This class should define two private data members, social group and Next pointer. A constructor, getter and setter functions for each data member should also be defined in this class.

Note: While getting the value for social group, restrict the user to only enter ‘f’ or ‘F’ for female, ‘m’ or’ M’ for male and ‘k’ or ‘K’ for kids.

3) Create another class named Mov_Que (List class); to create a queue for each movie, this class should define three variables, Front pointer, Rear pointer and counter. The class should also define the following functions:
a) Constructor(): Default constructor of the class.
b) Destructor(): Destructor to destroy the memory gained by the use of new operator.
c) add_Ticket(): This method should enter the new ticket purchased at the rear.
d) Total_Visitors(): This method should return the total number of visitors of movie.
e) Total_Revenue(): This method should return the total revenue of the movie.
f) Popularity(): This method should check the popularity of the movie amongst social group, whether the movie is popular among males, females or kids.

4) In main() function of the program, create three objects of the class Mov_Que which will act like three counters at cinema. These objects should be able to perform all the required functionalities mentioned in the question statement.

5) To get the idea about exact output of program, see Demo.wmv file attached with assignment file.

Readability is increased by adding several different features/ constructs in the language for performing same task.

Select correct option:

TrueFalse Not Sure

Quiz Start Time: 06:46 PM
Time Left 28sec(s)

Question # 4 of 10 ( Start time: 06:49:26 PM ) Total Marks: 1

_____ are a type of Aliasing.

Select correct option:

Pointers
ParametersArrays
Linked List

Quiz Start Time: 06:46 PM
Time Left 74sec(s)

Question # 5 of 10 ( Start time: 06:50:47 PM ) Total Marks: 1

Programming Language is basically a tool for instructing a computer to perform specified set of task.

Select correct option:

True
False

Quiz Start Time: 06:46 PM
Time Left 43sec(s)

Question # 6of 10 ( Start time: 06:51:14 PM) Total Marks: 1

Following are imperative languages EXCEPT

Select correct option:

LISP
C
FORTRAN
PASCAL

Quiz Start Time: 06:46 PM
Time Left 77sec(s)

Question # 7of 10 ( Start time: 06:52:10 PM) Total Marks: 1

The declarative language among the following is

Select correct option:

CPROLOG
PASCAL
C++

Quiz Start Time: 06:46 PM
Time Left 11sec(s)

Question # 8of 10 ( Start time: 06:52:34 PM) Total Marks: 1

Following factorsinfluences a portable language design EXCEPT

Select correct option:

Computer architecture
ReadabilityProgrammer’s time
Windows XP

Quiz Start Time: 06:46 PM
Time Left 23sec(s)

Question # 9 of 10 ( Start time: 06:53:57 PM ) Total Marks: 1

Too much Orthogonality reduces Readability.

Select correct option:

TrueFalse

Quiz Start Time: 06:46 PM
Time Left 15sec(s)

Question # 10 of 10 ( Start time: 06:55:08 PM ) Total Marks: 1

The variable name haveprofound effect on _______________.

Select correct option:

ReadabilityWritabilityOrthogonality Not Sure
Portability

Quiz Start Time: 06:58 PM
Time Left 68sec(s)

Question # 1of 10 ( Start time: 06:58:08 PM) Total Marks: 1

First electronic computer was _________

Select correct option:

ENIAC
Baggage Analytical Engine
Intel 386
IBM x86

Quiz Start Time: 06:58 PM
Time Left 27sec(s)

Question # 4of 10 ( Start time: 06:58:57 PM) Total Marks: 1

Which of the following is an incorrect option from the following statements regarding ‘objectives of learning new languages ’?

Select correct option:

Help to compare different languages.
Help in transition from one language to other language.Help in understanding the language piracy policy.
Help to choose a language for development of a certain application.

Quiz Start Time: 06:58 PM
Time Left 6sec(s)

Question # 5of 10 ( Start time: 07:00:10 PM) Total Marks: 1

SNOBOL was designed for ___________ purpose.

Select correct option:

String manipulation
AI
Business
Scientific

Quiz Start Time: 06:58 PM
Time Left 53sec(s)

Question # 6 of 10 ( Start time: 07:01:37 PM ) Total Marks: 1

First language that provided the concept of Pointer data type was _______.

Please read the following instructions carefully before attempting any
of the questions:
1. Attempt all questions. Marks are written adjacent to each question.
2. Do not ask any questions about the contents of this examination
from anyone.
a. If you think that there is something wrong with any of the
questions, attempt it to the best of your understanding.
b. If you believe that some essential piece of information is
missing, make an appropriate assumption and use it to solve the
problem.
c. Write all steps, missing steps may lead to deduction of marks.
d. All coding questions should be answered using the C ++ syntax.
You are allowed to use the Dev-C++ compiler to write and test your code. If
you do so please remember to copy and paste your code into the examination
solution area. (Do NOT share your code; your colleague could get higher
marks than you!!)
**WARNING: Please note that Virtual University takes serious note of
unfair means. Anyone found involved in cheating will get an `F` grade
in this course.
For Teacher’s use only
Question 1 2 3 4 5 6 7 8 9 Total

Analyze the following code
class myclass
{
private:
float x,y;
public:
void myclass(float a, float b)
{
x=a;
y=b;
}
void diplay()
{
cout<<endl<<x<<endl<<y;
}
};
What is wrong with the above code?
► The member functions should be private
► constructor must not have a return type
► The constructor should have no body
► There is no error in the given code
Question No: 5
( Marks: 6 )
Analyze the following code and list all the errors and line numbers in the given code.
int i=2;
for(i<=100;i++)
{
if(i%2==0)
{
cout<<i;
cout<<” is even /n’;
}
}
Question No: 6
( Marks: 7 )
Declare a class student having the following data members and member functions in the

class.
stdno(integer)
stdname(character array of size 20)
phone(long integer)
getdata() function that will read data into members data.
Display() function that will display the data on the screen.
Question No: 7
( Marks: 6 )
a. Write the statement that will create an array of 10 objects of the class student and
place the base address of the array in a pointer ptr of the class student given in Question
No. 6.
b. Write the code of the parameterized constructor for the class student given in
Question No. 6.
Question No: 8
( Marks: 15 )
Write a program that will create a class distance. The class distance consist of two data
members feet and inches, both of types float. The class distance consist of two member
functions, getdata() and show(). The function getdata() is used to read data from the
user through keyboard into feet and inches. The show() function is used to display the
values of feet and inches on the screen.
The program will create two objects dest1 and dest2 of the class distance. The program
will read data into dest1 and dest2 using getdata(). The program will create another
object dest3 of the class distance by overloading the minus “-“operator trough
expression dest3=dest1-dest2. The program will then display dist3 on the screen using
show() function. The program also takes care of the fact that distance can not be
negative. If dest2 is larger then dest1 then dest3 should not be created and program
should display the message “Distance can not be negative”.
Question No: 9
( Marks: 8 )
What are the benefits of the templates?