Online Exams

cs504 solve mcqz final term paper January 2012 virtual university of pakistan 2012

Str  = 0;// str is string Which rewritten from of above line of code is more in line with the self-documentation philosophy than the code above.
Str = false;
Str = NULL;
Str = ‘\0;
Str = 0.0;

 Struct packed_struct  { unsigned int f1:1;} pack; Here in “packed_struct”:
Value of f1 =1
Size of f1 = 1 bit
Value of f1 should not exceede 1 (Not Sure)
None of given options

In the switch statement, cases should always end with a ——-statment.
Switch
Go
Break
Stop 

Bit fields are a convenient way to express many difficult operations. However, bit fields suffer from one problem.
Lack of Usability
Lack of Security
Lack of Performance
Lack of Portability 

If(!(block < activeBlock)) is equvivalent to.
If ((block < activeBlock))
If ((block == activeBlock))
If ((block >= activeBlock))
None of the given 

Bit fields allow the packing of data in a structure. Using Bit fields we can.
Read 9 bit integers
Avoid memory leakages
Avoid memory overflow
Avoid syntax errors 

The order in which bytes of one word are stored is _________ dependent.
Hardware
Software
Language
Syntax 

In order to write a portable code which of the following guideline will be helpful:
Stick to the standards
Program in the mainstream
Size of data types
All of give options 

Complex expressions.
Make the code easy to modify
Make the code difficult to modify
Make the code easy to understand
Does not effect understandability 

In the switch statement, cases should always end with a ——-statement.
Switch
Go
Break
Stop 

x = 0; // x is floating pt Which rewritten form of above line of code is more in line with the self-documentation philosophy than the code above.
x = false
x = NULL
x = 0.0;
x = ‘\0’

 using proper paranthesis normally makes the code.
easy to read
easy to understand
less ambiguous
All of the given options 

The use of comments should be minimized by making the code self-documenting by appropriate name choices and an explicit logical structure.
True
False 

Bit fields allow the packing of data in a structure. using Bit fields we can:
Read 9 bit integers
Avoid memory leakages
Avoid memory overflow
Avoid syntax errors 

1) x = (a + 2 > 3)? a : a-1 ; 2) if((a + 2)> 3) x = a; else x = a – 1;
Statement (2) is more complex than (1)
Statement (2) is more complex than (1)
Both statements are very complex
None of the given option

80/20 rule states that:
you spend 80 percent of your time in 20 percent of the code
you spend 20 percent of your time in 80 percent of the code
We should try to optimized 80 percent or at least 20 percent of the code
None of the given options.

Be very careful when you use functions with side effects – functions that change the values of the ________.
Objects
Classes
Structures
Variables

Comma ( , ) is very dangerous because.
Compiler does not recognise this symbol
It creates linkage problem
It causes side effects
All of the given options (Not Sure)

The C/C++ language has not specified whether ____ is arithmetic or logical.
Right shift >>
Right shift
&&
||

In order to make a code more portable, Instead of using vendor specific language extensions, use _______ as much as possible.
STL
ANSI
ISO
CMMI

The order in which bytes of one word are stored is _________ dependent.
hardware
software
language
syntax

Be very careful when you use functions with side effects – functions that change the values of the ________.
Objects
Classes
Structures
Variables 

When a small set of functions (which use each other) is so overwhelmingly the bottleneck, there are two alternatives: 
use a better algorithm OR re-write the code
debug the code OR place assertions in code
remove the functions OR add more functions
changed programming language OR compiler at least 

_______ cause major portability issues 
Loops (Not Sure)
Bugs in code
Sizes of data types
Conditional Structures

In the switch statement, cases should always end with a ——-statment. 
Switch
Go
Break 
Stop

Some bit field members are stored: I) left to right II) right to left III) in circular array.
only (I) is true
Only (II) is true
Both (I) and (II) are true
All of the options (I, II and III) are true
x = 0; // x is floating pt Which rewritten form of above line of code is more in line with the self-documentation philosophy than the code above.
x = false
x = NULL
x = 0.0;
x = ‘\0’

Comma ( , ) is very dangerous because
Compiler does not recognise this symbol
It creates linkage problem
It causes side effects
All of the given options(Not sure)

 

using proper paranthesis normally makes the code
easy to read
easy to understand
less ambiguous
All of the given options

The use of comments should be minimized by making the code self-documenting by appropriate name choices and an explicit logical structure.
True
False

 Bit fields allow the packing of data in a structure. using Bit fields we can:
Read 9 bit integers
avoid memory leakages
avoid memory overflow
Avoid syntax errors

Be very careful when you use functions with side effects – functions that change the values of the ________.
Objects
Classes
Structures
Variables

A test case involves
Input/output specification plus a statement of the function under test
Steps to perform the function
Expected results that the software application produces
All of the given options 

The C/C++ language has not specified whether ____ is arithmetic or logical.
Right shift >>
Right shift
&&
||
If an application fulfills its specifications but deviates from users expectations or their desired behavior. This means, software is verified but not ————
Validated
Corrected
Checked
Traced

The raising of the imaginary error flag is simply called raising or ________ an error.
Catching
Casting
Throwing 
None of given options

struct packed_struct { unsigned int f1:1; } pack; Here in “packed_struct”:
value of f1 = 1
size of f1 = 1 bit
value of f1 should not exceede 1
None of given options

The idea behind exception handling is to raise some error flag every time ________.
The code compiles
The code links
Memory is allocated
Something goes wrong

Bit fields allow the packing of data in a structure. using Bit fields we can:
Read 9 bit integers
avoid memory leakages
avoid memory overflow
Avoid syntax errors

The order in which bytes of one word are stored is _________ dependent.
hardware
software
language
syntax

A __________ is a variance from a desired product attribute.
Exception
Error
Mistake
Defect 

The C/C++ language does not define the alignment of items within.
structures
classes
unions
All of the given options 

The raising of the imaginary error flag is simply called raising or ________ an error
Catching
Casting
Throwing 
None of given options

Consider the following statement: int a,b=10; Which of the following is correct:
variable “a” is initialized to 10
Variable “b” is initialized to 10 
Both variables “a” and “b” are initialized to 10
variables can not be initialized this way

Exception handling is a powerful technique that separates error-handling code from ______ code.
Normal
Faulty
Buggy
Complex

Bit fields are a convenient way to express many difficult operations. However, bit fields suffer from one problem.
Lack of usability
Lack of security
Lack of performance
Lack of portability

The complexity of a program may ______ if there are exceptional paths in it
Decrease
Increase
Remain same
All of given options

When an error is thrown the overall system (on the lookout for this error flag) responds by ______ the error.
Ignoring
Casting
Catching
All of the given options(Not Sure)

Comments are not syntax checked
TRUE
FALSE

Modularity is a tool that can help us in increasing the size of individual functions, making them less readable.
True
False

cs101 final term mcqz paper January 2012

FINALTERM EXAMINATION
Spring 2010 Final
CS101- Introduction to Computing (Session – 2)
Question No: 1 ( Marks: 1 ) – Please choose one
Human are better than computers at:
► Efficiency ► Accuracy ► Pattern recognitio ► None of the given choices
Question No: 2 ( Marks: 1 ) – Please choose one
Cray-1 was first commercial _________ computer
► Super ► Mini ► Micro ► Personal
Question No: 3 ( Marks: 1 ) – Please choose one
URL is a/an ________
► Device ► Component ► Address ► Tool
Question No: 4 ( Marks: 1 ) – Please choose one
Mainframe Computers are also called _____
► Enterprise Servers ► Personal Servers ► Enterprise Managers ► Window Servers
Question No: 5 ( Marks: 1 ) – Please choose one
Which of the following is NOT a category of Mobile Computers?
► Laptop ► Palmtop ► Desktop ► Wearable
Question No: 6 ( Marks: 1 ) – Please choose one
Preliminary exploration of possible solutions, technologies, suppliers is called
► Viability ► Feasibility ► Specification ► Integration
Question No: 7 ( Marks: 1 ) – Please choose one
__________ give us the ability to manipulate data through reference instead of actual value.
► Constants ► Variables ► Data Types ► Operators
Question No: 8 ( Marks: 1 ) – Please choose one
Consider the following statement written in JavaScript:
str = ”Hello” + ” World”
What will be the value of str ?
► HelloWorld ► Hello World ► Hello + World ► It will result in error
Question No: 9 ( Marks: 1 ) – Please choose one
A tool that helps you to find the synonyms is called ______________.
► Language ► Paragraph ► Thesaurus ► Symbol
Question No: 10 ( Marks: 1 ) – Please choose one
Communication protocol is a __________that governs the flow of information over a network
► Set of protocols ► Set of rules ► Device ► Set of methods
Question No: 11 ( Marks: 1 ) – Please choose one
If a computer could pass the Turing test then it would be able to:
► think like human beings
► do the things faster
► win a million dollar prize
► store more information
Question No: 12 ( Marks: 1 ) – Please choose one
The first Web browser with a GUI was generally available in:
► 1992 ► 1993 ► 1994 ► 1995
Question No: 13 ( Marks: 1 ) – Please choose one
Web is a unique invention by humans in terms that it is:
► accessible to only the owners who control it
► accessible from particular locations only
► accessible to all humans
► accessible to only the educational institutes
Question No: 14 ( Marks: 1 ) – Please choose one
In this URL http://www.msn.com , _____identifies the domain name
► http ► www ► msn ► com
Question No: 15 ( Marks: 1 ) – Please choose one
______ is simply a fast port that lets you connect computer peripherals and consumer electronics to
your computer without restart.
► Freeware ► Shareware ► Firewire ► Firmware
Question No: 16 ( Marks: 1 ) – Please choose one
Which of the following is NOT supported by PC’s power supply.
► -12 and +12 V DC ► -10 and +10 V DC ► -5 and + 5 V DC ► All are supported
Question No: 17 ( Marks: 1 ) – Please choose one
In which case Cache Memory is used
► To increase RAM speed
► To overcome BUS speed
► To overcome Speed rate between RAM and CPU
► To overcome CPU speed
Question No: 18 ( Marks: 1 ) – Please choose one
To display a single line text area on the web page, we use ___ tag
► TEXT ► TEXTBOX ► INPUT ► INPUTBOX
Question No: 19 ( Marks: 1 ) – Please choose one
If an algorithm is syntactically correct, but semantically incorrect then this situation is
► Very good situation
► Very dangerous situation
► Not very bad
► Neutral situation
Question No: 20 ( Marks: 1 ) – Please choose one
Users communicate with the computer using a consistent user interface provided by the OS.
► True ► False
Question No: 21 ( Marks: 1 ) – Please choose one
Application developers do not need to know much about the HW, especially the microProcessor, while they are
developing their application.
► True ► False
Question No: 22 ( Marks: 1 ) – Please choose one
The first spread sheet program was invented by
► Charles Babbage ► Dan Bricklin ► Paul Graham ► John von Neumann
Question No: 23 ( Marks: 1 ) – Please choose one
Which representation technique of algorithm is more suitable for developer to make actual
code___________.
► pseudo code ► flow chart ► both pseudo code and flow chart ► Heuristics
Question No: 24 ( Marks: 1 ) – Please choose one
_____________ is used to terminate all JavaScript statements.
► Colon ► Semicolon ► Underscore ► Apostrophe
Question No: 25 ( Marks: 1 ) – Please choose one
In java script cookies can be created for future use_____.
► Easily
► No facility at all
► This is not possible without Java language.
► Cookies are files so java script can not handle it.
Question No: 26 ( Marks: 1 ) – Please choose one
When the microprocessor desires to look at a piece of data, it checks in the __________ first.
► RAM ► ROM ► hard disk ► cache
Question No: 1 ( Marks: 1 ) – Please choose one
Using Java Script you can write a character at random location on screen
► By applying randomCh() method
► With the help of String object
► With the help of random character property
► There is no built in approach in Java Script
Question No: 2 ( Marks: 1 ) – Please choose one
If incorrectly we enter the negative age it is check by
► Limit Integrity ► Type Integrity ► Referential Integrity ► Physical Integrity
Question No: 3 ( Marks: 1 ) – Please choose one
The Encryption of data is related to
► Data updates ► Data security ► Data integrity ► Data accessibility
Question No: 4 ( Marks: 1 ) – Please choose one
Which protocol is use to transfer a file over the network ?
► UDP ► FTP ► TCP ► OSI
Question No: 5 ( Marks: 1 ) – Please choose one
One can send an email message to a remote computer using _______ protocol
► HTTP ► SMTP ► FTP ► TELNET
Question No: 6 ( Marks: 1 ) – Please choose one
In a System having many parts to be designed, one should always do the _____ first
► Hard part ► Simple part ► Development part ► Quality part
Question No: 7 ( Marks: 1 ) – Please choose one
Flow control constructs in JavaScript includes:
► If-Else ► Loops and If -Else ► Switch and If-Else ► All of the given choices
Question No: 8 ( Marks: 1 ) – Please choose one
___ provides a simple, consistent way for applications to interact with the HW without having to know all the
details of the HW
► Explorer.exe ► System Files ► Operating System Application Software
Question No: 9 ( Marks: 1 ) – Please choose one
Machine language is also called
► Assembly Language ► Binary Language ► High Level Language ► HTML Language
Question No: 10 ( Marks: 1 ) – Please choose one
_________ is the best known builder for supercomputers.
► Sun ► Cray Research ► Microsoft ► Apple
Question No: 11 ( Marks: 1 ) – Please choose one
The weaknesses of the computer are:
► Pattern recognition & Storage
► Speed & Innovative ideas
► Pattern recognition & Innovative ideas
► Speed & Storage
Question No: 12 ( Marks: 1 ) – Please choose one
Communication protocol is a __________that governs the flow of information over a network
► Set of methods ► Set of protocols ► Set of rules ► Device
Question No: 13 ( Marks: 1 ) – Please choose one
_____________ team is responsible for the maintenance, expansion , improvement of the infrastructure
consisting of workstations, networking equipment, software and network security.
► Support ► Configuration Management ► Quality Assurance ► Developer
Question No: 14 ( Marks: 1 ) – Please choose one
_____________ team consists on the sharpest technical minds in the company.
► Architecture ► Business Development ► Configuration Management ► Developer
Question No: 15 ( Marks: 1 ) – Please choose one
_______________ is responsible for day to day operations.
► CEO ► COO ► CMSO ► Developer
Question No: 16 ( Marks: 1 ) – Please choose one
One of the key responsibilities of the ___________ is client relationship management.
► Project Manager ► Team Lead ► Developer ► Quality Assurance Engineer
Question No: 17 ( Marks: 1 ) – Please choose one
What is the major problem with flash based website?
► Its two heavy ► Cannot be indexed ► Less attractive ► Inaccessible
Question No: 18 ( Marks: 1 ) – Please choose one
Which of the following is NOT an event handler for image object?
► onAbort ► onError ► onLoad ► onUser
Question No: 19 ( Marks: 1 ) – Please choose one
The organizations are learning that business can be done in a more effective manner if emphasis is placed upon
___________.
► Cooperation ► Shared responsibility ► Networking ► All of the given options
Question No: 1 (Marks: 1) – Please choose one
It represents the _____________ flow chart element.
► Flow Line ► Connector ► Off-page connector ► Start or Stop
Question No: 2 (Marks: 1) – Please choose one
What is NOT a key
factor while designing a website?
► Usability ► User-friendly ► Consistency ► Complexity
Question No: 3 (Marks: 1) – Please choose one
__________% of the
users have left websites in frustration due to poor navigation.
► 40 ► 62 ► 83 ► 91
Question No: 4 (Marks: 1) – Please choose one
In JavaScript, a
variable declaration is
► Optional ► Mandatory ► Not allowed ► None of the given
Question No: 5 (Marks: 1) – Please choose one
A protocol used for
receiving email messages is called ____________.
► URL ► Telnet ► POP3 ► SMTP
Question No: 6 (Marks: 1) – Please choose one
Which is correct?
► onUnload ► onUnLoad ► onUNLOAD ► All of the above
Question No: 7 (Marks: 1) – Please choose one
Serial arrangement
in which things follow logical order or a recurrent pattern, such as statements executing one by one, is called
__________.
► Loop ► Sequence ► Condition ► Array
Question No: 8 (Marks: 1) – Please choose one
Variables allow us to
manipulate data through the ___________.
► Actual Value ► Reference ► Length ► Name
Question No: 9 (Marks: 1) – Please choose one
Fuzzy logic is based
on ____________.
► Ground facts ► Experience ► Practice ► Approximation
Question No: 10 (Marks: 1) – Please choose one
Word Processor is a
_________________
► System Software ► Application Software ► Device ► Utility
Question No: 11 (Marks: 1) – Please choose one
In the old days,
databases did NOT support ____________.
► Number ► Boolean ► Video ► Text
Question No: 12 (Marks: 1) – Please choose one
In tabular storage,
fields placed in a particular row are strongly ___________.
► Independent ► Dependent ► Interrelated ► Inconsistent
Question No: 13 (Marks: 1) – Please choose one
Due to working at
home, lack of interaction may result in ___________ professional growth.
► Slower ► Faster ► Higher ► Improved
Question No: 14 (Marks: 1) – Please choose one
Distance learning
has got a boost due to the ___________.
► Easy communication ► Online interactive contents ► Flexibility
► All of the given options
Question No: 15 (Marks: 1) – Please choose one
_____________
technique can be used to create smooth animations or to display one of several images based on the requirement.
► Image downloading ► Image preloading ► Image uploading
► Image postloading
Question No: 16 (Marks: 1) – Please choose one
The ____________
is becoming the preferred organizational structure for more and more organizations with the passage of time.
► Tree structured organizational model
► Network paradigm ► Hierarchical structure ► None of the given options
Question No: 17 (Marks: 1) – Please choose one
The group of
technologies concerned with the capturing, processing and transmission of information in the digital electronic
form is called _____________.
► Telecom Engineering
► Computer Engineering
► Computer Science
► Information Technology
Question No: 18 (Marks: 1) – Please choose one
A large number of
networks interconnected physically are called ______
► LAN ► MAN ► Internet ► Network collection
Question No: 19 (Marks: 1) – Please choose one
TCP stands for
________.
► Transfer Center protocol ► Transmission Control Protocol
► Transmission Center Protocol ► Telephone Center Protocol
Question No: 20 (Marks: 1) – Please choose one
A collection of data
organized in such a way that the computer can quickly search for a desired data item is known as:
► Retrieving ► Database ► Information ► DBMS
Question No: 21 (Marks: 1) – Please choose one
______ is simply a
fast port that lets you connect computer peripherals and consumer electronics to your computer without restart.
► Freeware ► Shareware ► Firewire ► Firmware
Question No: 22 (Marks: 1) – Please choose one
Structures, in which
another list starts before the first list is finished, are called:
► Multiple Lists ► Nested Lists ► Ordered Lists ► Un-ordered Lists
Question No: 23 (Marks: 1) – Please choose one
The key property of
the ‘Array’ object in JavaScript is
► Value ► Length ► Name ► All of the given choices
Question No: 24 (Marks: 1) – Please choose one
Which one is the
example of spreadsheet software?
► MS Word ► MS PowerPoint ► MS Excel ► MS Access
Question No: 25 (Marks: 1) – Please choose one
The Encryption of
data is related to
► Data updates ► Data security ► Data integrity ► Data accessibility
Question No: 26 (Marks: 1) – Please choose one
_____ is the process
of analyzing large databases to identify patterns.
► Data normalization ► Data management ► Data Mining ► None of the given options
Question No: 27 (Marks: 1) – Please choose one
Which is the userfriendly
way of presenting data?
► Query ► Form ► Report ► All of the given options
Question No: 28 (Marks: 1) – Please choose one
JavaScript function
fixed () has equivalent HTML tag-set ____
► <.FIX>……………</FIX> ► <F>………………..</F>
► <PRE>…………. </PRE> ► <H>………………..</H>
Question No: 29 (Marks: 1) – Please choose one
<Form> Tags always
placed between the <BODY> and </BODY> tags of a Web page
► True
► False
Question No: 30 (Marks: 1) – Please choose one
Java script has ——-
———- ability to create and draw graphics.
► Limited ► Versatile ► Medium ► Not at all
Final term paper
1-when actions depends upon the values of multiple variables we ll use —–?
1-if 2-else 3-if—-else 4-none
2-when the exact number of iterations is known use the —-loop ?
1-for 2-if 3-while 4-none
3-when the number of iteration depend upon a condition being met use the —— loop
1-for 2-switch 3-while 4-none
4-the key property of ‘’array ‘’object is ———–?
1-length 2-width 3-single 4-none
5-two of the key ‘’array ‘’methods are reverse ()-sort()
1-true 2-false

Bolta Pakistan 17th August 2011

Bolta Pakistan 17th August 2011

Click Here to Watch/Download Part 1

Click Here to Watch/Download Part 2

Click Here to Watch/Download Part 3

CS201 Final Term Paper July 2011

Question No: 1 ( Marks: 2 )
Write a declaration statement for an array of 10 elements of type float. Include an initialization statement of the first four elements to 1.0, 2.0, 3.0 and 4.0.
Answer:
float floatArry[10] = {1.0,2.0,3.0,4.0};
Question No: 2 ( Marks: 2 )
Write the general syntax for the declaration of pre-increment and post-increment member operator function.
Answer:
Classname operator ++(); ---- pre increment

Classname operator ++(int) ---- post increment
Question No: 3 ( Marks: 2 )
Give the general syntax of class template.
Answer:
template
class myclass { ---} ;

Question No: 4 ( Marks: 2 

What is a truth Table?

Answer:

There are some areas where the decision structures become very complicated. Sometimes, we find it difficult to evaluate a complicated logical expression. Sometimes the logic becomes extremely complicated so that even writing it as a simple syntax statement in any language. It becomes complicated to determine what will be evaluated in what way. We know the concept of truth table. The truth tables are very important. These are still a tool available for analyzing logical expressions. We will read logic design in future, which is actually to do with chips and gates. How we put these things together.
Question No: 5 ( Marks: 2 )

What will be the output of following code, if user input a number 123?

int input ;

cin >> oct >> input;

cout hex input ;

Answer:

53

Rational: it will take 123 as octal and print it in hex form which is 53.

Question No: 6 ( Marks: 2 )

What is principle of friendship in the context of functions and classes?

Answer:

Class can declare a friend function and someone from outside the class cannot declare itself friend of a class.

A friend function can access the private variables of class just like a member function
Question No: 7 ( Marks: 2 )

How many arguments a Unary Operator take? Can we make a binary operator as unary operator?

Answer:

Unary operator takes only one argument like i++ or i— (Post increment or post decrement operators for integers) or ++i,--i (Pre increment or pre decrement operators for integers) ,we can not make Unary operator as binary or binary as Unary operator.

Question No: 8 ( Marks: 2 )

Which arithmetic operators cannot have a floating point operand?

Answer:

Modulus operator:

This operator can only be used with integer operands ONLY

Question No: 9 ( Marks: 2 )

What are manipulators? Give one example.

Answer:

The manipulators are like something that can be inserted into stream, effecting a change in the behavior. For example, if we have a floating point number, say pi (л), and have written it as float pi = 3.1415926 ; Now there is need of printing the value of pi up to two decimal places i.e. 3.14. This is a formatting functionality. For this, we have a manipulator that tells about width and number of decimal points of a number being printed.

Question No: 10 ( Marks: 2 )

Write down piece of code that will declare a matrix of 3x3. And initialize all its locations with 0;

Answer:

int matrix [3] [3] ;

include

main () {

int matrix [3][3];

int inivalue = 0;

for (int a=0;a<3;a++)

{ for (int b = 0;b<3;b++)

{ matrix[a]= inivalue;

cout/p>

}

Question No: 11 ( Marks: 2 )
What is the difference between switch statement and if statement.

Answer:

The “If” statement is used to select among two alternatives. It uses a Boolean expression to decide which alternative should be executed. The switch statement is used to select among multiple alternatives. It uses an int expression to determine which alternative should be executed.

Question No: 12 ( Marks: 2 ) 

How can we initialize data members of contained object at construction time?

Answer:

Initializer list is used to initialize the contained objects at the construction time.

Question No: 13 ( Marks: 2 )

Can we overload new and delete operators?

Answer:

Yes, it is possible to overload new and delete operators to customize memory management. These operators can be overloaded in global (non-member) scope and in class scope as member operators.

Question No: 14 ( Marks: 2 )

Suppose there is a template function ‘func’ having argument of type U and return type T. What will be the C++ syntax to call this function, passing a variable ‘x’ of type double and returning an int type?

Answer:

template

T func (T a, U b) {

return (a

}

calling

int i;

double x;

x = func

Question No: 15 ( Marks: 2 )

Which variable will be used in inner code block if we have the same names of variable at outer code block and inner code block?

Answer:

Simply: variable of the inner code is use in the inner code block.

Question No: 16 ( Marks: 2 )

What is the benefit of reference and where can we use it?

Answer:

In references we give the memory address of the object, due to references we pass values without making the copy. Hence, when we have many values & we want efficiency we use references to avoid copy.

Question No: 17 ( Marks: 2 )

Write the C++ code for the declaration of overloaded stream insertion and stream extraction operator for the object d of type Date.

Answer:

Date operator >> (date & d1){

cout<”-”<”-”/p>

}

Question No: 18 ( Marks: 2 )

What is difference between endl and \n? 

Answer:

Endl is manipulator and it inserts new line character and flushes the stream.

\n is control character which is used to insert line break.

Question No: 19 ( Marks: 2 )

What does code optimization mean?

Answer:

It is process by which we make our code in such a way that it improves the speed of program. By use of optimization we refine program codes in such a way that it run faster and consume less memory. We do it in such a way that output quality is not compromised.

Question No: 20 ( Marks: 3 )

How is the following cout statement interpreted by compiler?

cout a b c ;

Answer:
It will give a compiler error because a,b,c are not declared.

Question No: 21 ( Marks: 3 )

Suppose an object of class A is declared as data member of class B.

(i) The constructor of which class will be called first? 

Answer: A

(ii) The destructor of which class will be called first?

Answer: B

Question No: 22 ( Marks: 3 )

What will be the output of following functions if we call these functions three times?

1)

void func1(){

int x = 0;

x++;

cout x endl;

}

Answer

1

1

1

2)

void func2(){

static int x = 0 ;

x++;

cout x endl ;

} 

Answer:

1

2

3

Question No: 23 ( Marks: 3 )

If is not available in the system then what does calloc/malloc and new operator return?

Answer:

calloc/malloc and new operator return returns a null pointer to indicate that no memory is available

Question No: 24 ( Marks: 3 )

What is the keyword ‘this’ and what are the uses of ‘this’ pointer?

Answer:

'this' is use to refer the current class member without using the name of the class.

Question No: 25 ( Marks: 3 )

Which one (copy constructor or assignment operator) will be called in each of the following code segment?

1) Matrix m1 (m2);

2) Matrix m1, m2;

m1 = m2;

3) Matrix m1 = m2;

Answer:

1) Matrix m1 (m2); copy constructor

2) Matrix m1, m2; 

m1 = m2; assignment operator

3) Matrix m1 = m2; assignment operator

Question No: 26 ( Marks: 3 )

What will be the output of following function if we call this function by passing int 5?

template T reciprocal(T x) {return (1/x); }

Answer:

0

The output will zero as 1/5 and its .05 but conversion to int make it zero

Above is prototype of template class so assume passing an int and returning an int

Question No: 27 ( Marks: 3 )

Identify the errors in the following member operator function and also correct them.

math * operator(math m);

math * operator (math m)

{

math temp;

temp.number= number * number;

return number;

}

Answer:

The errors are in the arguments of the member operation function and also in the body of operator member function.

Correct function should be

math *operator (math *m)

{

math temp;

temp = m;

temp.number= number * number;

return temp.number;

}

Question No: 28 ( Marks: 3 )

What are the limitations of the friendship relation between classes?

Answer:

friendship relation between classes is a one way relation that is if one class declare friend another class then the another class is the friend of first class but not the first class if the friend of another class.

Question No: 29 ( Marks: 3 )

Define static variable. Also explain life time of static variable?

Answer:

When you declare a static variable (native data type or object) inside a function, it is created and initialized only once during the lifetime of the program.

Question No: 30 ( Marks: 5 )

What is difference between Unary and binary operators and how they can be overloaded?

Answer:

Unary operator takes one argument.

a ++ is an example of unary operator

Binary take two operators

+,-,* are example of binary operators

Overloaded binary operator may return any type

Here is general syntax of overloading

Return-type operator symbol (parameters);

Operator is keyword

Question No: 31 ( Marks: 5 )

What steps we must follow to design good program?

Answer 1:

Hence to design a program properly, we must:

Analyze a problem statement, typically expressed as a word problem.
Express its essence, abstractly and with examples.
Formulate statements and comments in a precise language.
Evaluate and revise the activities in light of checks and tests and
Pay attention to detail.

Answer 2:

Details: we must check very details of any program. It is very important aspect of any program. We must pay complete attention to calculation.

We must give attention to logic and its flow should be smooth.

Reusable: We must write program in such a way that we can reuse them in other program. Like we define function in such a way that in future if we need any similar kind of function is requires in that case we can easily modify or reuse it.

Comments: we write the details of important steps in the form of comments. We should use comments in such a way if any body else wanted to reuse or debug or codes he can easily understand it.

Code readability: We should use Tab and spaces so codes are easily readable.

User interface: we make interface user friendly. Use polite prompts for user while take input.

Question No: 32 ( Marks: 5 )

Write a program which defines five variables which store the salaries of five employees, using setw and setfill manipulators to display all these salaries in a column.

Note: Display all data with in a particular width and the empty space should be filled with character x

Output should be displayed as given below:

xxxxxx1000

xxxxxx1500

xxxxx20000

xxxxx30000

xxxxx60000

Answer:

#include

#include

main(){

int sal1 =1000;

int sal2 =1500;

int sal3 =20000;

int sal4 =30000;

int sal5 =60000;

cout setfill ('x') setw (10);

cout sal1/p>

cout setfill ('x') setw (10);

cout sal2/p>

cout setfill ('x') setw (10);

cout sal3/p>

cout setfill ('x') setw (10);

cout sal4/p>

cout setfill ('x') setw (10);

cout sal5/p>

int i=0; 

cin>>i; // to stop the screen to show the output

}

Question No: 33 ( Marks: 5 )

Suppose we have the following class.

class Matrix

{

private:

int Elements[3][3];

};

Write the operator function of stream extraction operator (>>) for this class.

Answer:

Element operator >> (Element &element){

cout/p>

cout/p>

cout/p>

}

Question No: 34 ( Marks: 5 )

What is meant by user interface and class interface in C++ ? And what role a class interfaces can play in user interface [Marks 5]

Answer:

Question No: 35 ( Marks: 5 )

Write the general syntax of a class that has one function as a friend of a class along with definition of friend function.

Answer:

class frinedclass{

public:

friend int compute(exforsys e1)

};

Int compute(exforsys e1)
{
//Friend Function Definition which has access to private data
return int(e1.a+e2.b)-5;
}

Question No: 36 ( Marks: 5 )

What are the advantages and disadvantages of using templates?

Answer:

Many things can be possible without using templates but it does offer several clear advantages not offered by any other techniques:

Advantages:

Templates are easier to write than writing several versions of your similar code for different types. You create only one generic version of your class or function instead of manually creating specializations.
Templates are type-safe. This is because the types that templates act upon are known at compile time, so the compiler can perform type checking before errors occur.
Templates can be easier to understand, since they can provide a straightforward way of abstracting type information.
It helps in utilizing compiler optimizations to the extreme. Then of course there is room for misuse of the templates. On one hand they provide an excellent mechanism to create specific type-safe classes from a generic definition with little overhead.

Disadvantages:

On the other hand, if misused

Templates can make code difficult to read and follow depending upon coding style.
They can present seriously confusing syntactical problems esp. when the code is large and spread over several header and source files.
Then, there are times, when templates can "excellently" produce nearly meaningless compiler errors thus requiring extra care to enforce syntactical and other design constraints. A common mistake is the angle bracket problem.

Question No: 37 ( Marks: 5 )

Suppose a program has a math class having only one data member number.

Write the declaration and definition of operator function to overload + operator for the statements of main function.

math obj1, obj2;

obj2= 10 + obj1 ; 

Answer:

#include

math

{

mth operator + (obj1,int x)

{

number temp;

temp=obj1.number+x;

return temp.number;

}

}

Question No: 38 ( Marks: 5 )

Write a program which defines three variables of type double which store three different values including decimal points, using setprecision manipulators to print all these values with different number of digits after the decimal number.

Answer:

#include

#include

main () {

double a = 12.12345;

double b = 13.123456;

double c = 14.1234567;

cout setprecision (5) a endl;

cout setprecision (2) a endl;

cout setprecision (3) a endl;

}

Question No: 39 ( Marks: 5 )

Let we have a class,

class String

{

private:

char buf[25];

};

Write code for assignment (=) operator function which assign one String object to other object. Your code should also avoid self assignment

Answer:

void String:perator = ( const String &other )

{ int length ;

length = other.length();

delete buf;

buf = new char [length + 1];

strcpy( buf, other.buf ); }

Question No: 40 ( Marks: 5 )

Read the given below code and explain what task is being performed by this function

Matrix :: Matrix ( int row , int col )

{

numRows = row ;

numCols = col ;

elements = new ( double * ) [ numRows ] ;

for ( int i = 0 ; i < numRows ; i ++ )

{

elements [ i ] = new double [ numCols ] ;

for ( int j = 0 ; j < numCols ; j ++ )

elements [ i ] [ j ] = 0.0 ;

}

}

Hint : This function belong to a matrix class, having

Number of Rows = numRows

Number of Columns = numCols

Answer:

In the above mentioned code, first of all programmer call the constructor who have two parameters for the number of rows & columns in the matrix. Then this constructor also dynamically allocates the memory for the elements of the matrix & also initializes the value of the all elements of matrix with 0.0

 

CS201 Final Term Paper July 2011

CS201 Final Term Paper July 2011

Paper Detail
Total 80 Marks

40 Mcqs = 40 Marks
subjective=40 Marks
4 Question = 2Marks
4 Question =3 Marks
4 Question = 4 Marks

Q.41
What does it happen if an object id assign to another object without overloading an assignment operator.2marks

Q.42
Describe the first parameter to stream insurtionand stream extraction>> operator function? 2Marks

Q.43
Write the meaning of given line code where m is object of class matrix

If (&m! = this)

Q.44
Why always array start with index 0(zero) ? 2Marks

Q.45
What will be the output of following function if we call this function by passing int 5? 3 marks
template T reciprocal(T x) {return (1/x); }

Q.46
Identify all the given functions as member function of input stream or output stream
Get, unget, and put, getline, Peek, Putline, 3Marks

Q.47
Write the general syntax for unary member operator 3Marks

Q.48
Write the output of this code 3Marks

Main()
{
int x,y,z;
x=5;
y=3+x++;

Q.49
What are the advantages and disadvantages of using templates? 5Marks

Q.50
Find the errors in given code and correct them; also write the output of the code-5 Marks

Q.51
Describe the effect of an overflow condition if it occurs within a program 5 Marks

Q.52
Make a program instruction was given in the code 5Marks

CS201 Final Term Paper July 2011

CS201 Final Term Paper July 2011

TOTAL 52 QUESTIONS

12 LONG AND 40 MCQ’S

AND MOSTLY MCQ’S ARE NOT FROM PAST PAPERS, ITS FROM LAST CHAPTERS… L

Q: 41: Write a program with different variables V1 and V2 and print out it (hexadecimal, decimal, octal) form use one manipulator. 5 marks ..

Q:42: What is structure and union structure? 3 marks.

Q:43: What is template and write general syntax of templates. 3marks..

Q:44: How many types of structure? 2 marks

Q:45: Write the rules for using of Dynamic memory allocations… 5marks..

Page 479

Q:46: Describe the first parameter to stream insertionand stream extraction>> operator function? 2marks

Q:47: See the following code segment 

Template <class T>
Class myclass

{

Private :

Tx;

Public

Myclass(ta)

{

X=a;

};

Write the main function which creates two objects of class for int & double types?

Q:48: If the requested memory is not available in the system then what does calloc/malloc and new operator

return? 3marks …
CS201 Final Term Paper July 2011

CS401 Final Term Paper July 2011

Total 53 Questions
40 x MCQs
5 x 2 Marks Questions
5 x 3 Marks Questions
3 x 5 Marks Questions
Subjective Portion is as under:-

Question No: 41 ( Marks: 2 )
What is the purpose of Bind Function?

Question No: 42 ( Marks: 2 )
What is the purpose of List View Control ?

Question No: 43 ( Marks: 2 )
What is a custom resource?

Question No: 44 ( Marks: 2 )
Write following statement in words
Const char *ptr=buff

Question No: 45 ( Marks: 2 )
Differentiate between Simple Windows Programs & Dynamic Link Library program?

Question No: 46 ( Marks: 3 )
what are the three conditions of sending WM_Paint Message?

Question No: 47 ( Marks: 3 )
Define the names of resource-definition statements' categories?

Question No: 48 ( Marks: 3 )
Write down any three parameter of send function?

Question No: 49 ( Marks: 3 )
If a network Engineer wants to send a packet to group of nodes then which IP address class will be used?

Question No: 50 ( Marks: 3 )
Write down message sequence of Shift +S to windows procedure?

Question No: 51 ( Marks: 5 )
What is the equivalence in pointers and arrays in C?

Question No: 52 ( Marks: 5 )
Briefly explain Checkbox?

Question No: 53 ( Marks: 5 )
Write down the basic socket operation

CS401 Final Term Paper July 2011

CS610 Final Term Paper July 2011

Total 53 Questions
40 x MCQs
5 x 2 Marks Questions
5 x 3 Marks Questions
3 x 5 Marks Questions

Subjective Portion is as under:-

Question No: 41 ( Marks: 2 )
What is meant by throughput in networking?
Question No: 42 ( Marks: 2 )
What is Hop Count Metric in context of Routing?
Question No: 43 ( Marks: 2 )
What will be the network bits of following network address?
130.4.102.1/22
Question No: 44 ( Marks: 2 )
How many types of Connection Services are there in TCP/IP VUsolutions?
Question No: 45 ( Marks: 2 )
Why NAT variants are used?
Question No: 46 ( Marks: 3 )
How ICMP can be used to trace route?
Question No: 47 ( Marks: 3 )
In client server architecture, if no signal is there then how anapplication knows when the communication arrives?
Question No: 48 ( Marks: 3 )
How shift operator works in CRC?

Question No: 49 ( Marks: 3 )
If a network Engineer wants to send a packet to group of nodes then which IP address class will be used?
Question No: 50 ( Marks: 3 )
When a packet is lost then what is the procedure adopted in TCP/IP?
Question No: 51 ( Marks: 5 )
What are the characteristics of Border Gateway Protocol?
Question No: 52 ( Marks: 5 )
In UDP context describe end point identification with protocol port numbers?
Question No: 53 ( Marks: 5 )
A question was related to write a Routing Table, in which Subnet Mask and Next Hop was required to filled

CS610 Final Term Paper July 2011

ENG201 Final Term Papers Spring July 2011

TOTAL 52 QUESTIONS
12 LONG AND 40 MCQ'S…

Q:41: What is narration? 2 marks..

Q:42: What questions should be answered in the introduction of a progress report? 2 marks…
PAGE ..101

Q:43: Letters are used for different types of communication. In the light of this statement name only the statements of the business letters. 3 marks….
PAGE .. 64

Q:44: Define the term enumeration. 3 marks..
PAGE.. 148

Q:45: State at least three suggestions which ensure, courtesy to your message. 3 marks..
PAGE .. 38

Q:46: Explain the term biased language. 3 marks..

Q:47: What are the major component of a VUsolutions letter of recommendation? 3 marks…
PAGE .. 68
Q:48: How can we avoid common mistakes while constructing a paragraph? 3 marks..
PAGE..118

Q:49: Write down the reasons of conveying a bad news about orders. 3 marks…
PAGE .. 74

Q:50: What are writing style problem? 5 marks..
PAGE .. 125

Q:51: What is oral communication? Which point should be kept in mind to improve oral communication. 5 marks..
PAGE .. 6

Q:52: Explain the term paragraph with reference to visual aids. How can we transfer information from it? 5 marks …
PAGE… 118
more papers of ENG201

Fin623 Final Term Papers Spring July 2011

Que 57. What is meant by depreciable assets (Marks 3)
58. What is meant by Zero Rated Supply and give an Exsample ?? (Marks3)
59. Tax Treatment by Gratuity approved by followingAuthorities ? (Marks3)
1. Comminsioner of Income Tax
2. Central Board Of Revenue

60. Describe the Legal Status under section (80) of the following :
1. Federal Government Of Pakistan
2. Mr.Shakeel Serving as a director
3. Joint family of Mr. Hari Prasad ,his Son Mr.Johan and Mr. Vijay

61. Describe the Characteristics of Salaries ?? (Marks 5)
62. Tax Treatment of Gratuity not Covered under clause (13) ?? (Marks 5)
63 and 64 ques were numerical.

more papers