# Vu CS201 Introduction To Programming Mid Term Examination Spring 2009 Solved/Unsolved

www.Educational.pk

CS201 Introduction to Programming

Mid Term Examination – Spring 2006

Time Allowed: 90 Minutes

attempting any of the questions:

1. Attempt all questions. Marks are written adjacent to each

question.

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.

Question No. 1 Marks : 10

Write the function definitions for the following:

www.Educational.pk

a) A function test() that would take three integer values x , yand z (as

parameters), find the largest and return the result to the calling function.

b) A function sum() that would take the one integer array myArray[ ] of size 10

(as parameter), calculate the sum of the elements of myArray[ ] and display

the result.

Note : The function sum() returns no value.

Question No. 2 Marks : 6

Write a program that will create and display the following series:

65, 44, 27, 14, 5, 0, -1, 2, 9, 20.

Hint:

The series is created by the formula 2x 2 – 3x

for x=-5 to 4

The variable x is of type integer.

Question No. 3 Marks : 2

The value of 2*15/3*7+3*2 is

146

76

8 70

Question No. 4 Marks : 2

Carefully analyze the following lines of code and chose the correct option.

ch1=”a”;

ch2=’a’;

ch1 and ch2 are strings

ch1 is string and ch2 is character

ch2 is string and ch1 is character

ch1 and ch2 are characters

Question No. 5 Marks : 2

The size of a double variable is

2 bytes

4 bytes

8 bytes

10 bytes

www.Educational.pk

Question No. 6 Marks : 2

An array is also called

an array variable

array declaration

struct

constant pointer

Question No. 7 Marks : 10

What will be the output of the following programs?

a) Program1

#include <iostream>

int main()

{

unsigned short x = 1;

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

{

cout << x << endl;

x = x << 1;

}

return 0;

}

b) Program2

#include <iostream.h>

int main()

{

unsigned short x = 1024;

while(x>=1)

{

cout <<x << endl;

x =x >> 1;

}

return 0;

}

www.Educational.pk

Question No. 8 Marks : 6

Calculate the following expressions for

x=3 and y=2

1) ++x++*++y

2) 3*++x+–y

3) ++x*4*++y

# Vu CS201 Introduction To Programming Mid Term Examination Solved/Unsolved Spring 2009

www.Educational.pk

MIDTERM EXAMINATION

Spring 2009

CS201- Introduction to Programming

Ref No: 440120

Time: 60 min

Marks: 38

Student Info

Student ID:

Center: OPKST

Exam Date:

For Teacher’s Use Only

Q No. 1 2 3 4 5 6 7 8 Total

Marks

Q No. 9 10 11 12 13 14 15 16

Marks

Q No. 17 18 19 20 21 22

Marks

www.Educational.pk

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

The function of cin is

To display message

► To read data from keyboard

To display output on the screen

To send data to printer

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

In C/C++ language the header file which is used to perform useful task and manipulation

of character data is

cplext.h

► ctype.h

stdio.h

delay.h

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

How many parameter(s) function getline() takes?

0

1

2

www.Educational.pk

3

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

Word processor is

Operating system

► Application software

Device driver

Utility software

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

For which values of the integer _value will the following code becomes an infinite

loop?

int number=1;

while (true) {

cout << number;

if (number == 3) break;

number += integer_value; }

any number other than 1 or 2

► only 0

only 1

only 2

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

www.Educational.pk

Each pass through a loop is called a/an

enumeration

Iteration

culmination

pass through

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

the return 0; statement

► the first statement after the loop

the statements following the continue statement

the next iteration of the loop

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

What is the correct syntax to declare an array of size 10 of int data type?

int [10] name ;

name[10] int ;

► int name[10] ;

int name[] ;

www.Educational.pk

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

Consider the following code segment. What will the following code segment display?

int main(){

int age[10] = {0};

cout << age ;

}

Values of all elements of array

Value of first element of array

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

What will be the correct syntax to initialize all elements of two-dimensional array to

value 0?

► int arr[2][3] = {0,0} ;

int arr[2][3] = {{0},{0}} ;

int arr[2][3] = {0},{0} ;

www.Educational.pk

int arr[2][3] = {0} ;

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

How many bytes will the pointer intPtr of type int move in the following statement?

intPtr += 3 ;

► 3 bytes

6 bytes

12 bytes

24 bytes

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

If there are 2(n+1) elements in an array then what would be the number of iterations

required to search a number using binary search algorithm?

► n elements

(n+1) elements

2(n+1) elements

2(n+1) elements

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

www.Educational.pk

Which of the following operator is used to access the value of variable pointed to by a

pointer?

* operator

-> operator

&& operator

► & operator

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

The ________ statement interrupts the flow of control.

switch

continue

goto

► break

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

Analysis is the ————– step in designing a program

Last

Middle

Post Design

► First

www.Educational.pk

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

Paying attention to detail in designing a program is _________

Time consuming

Redundant

► Necessary

Somewhat Good

Question No: 17 ( Marks: 1 )

Which programming tool is helpful in tracing the logical errors?

Question No: 18 ( Marks: 1 )

Give the syntax of opening file ‘myFile.txt’ with ‘app’ mode using ofstream variable

out’.

Question No: 19 ( Marks: 2 )

What is the difference between switch statement and if statement.

Question No: 20 ( Marks: 3 )

www.Educational.pk

Identify the errors in the following code segment and give the reason of errors.

main(){

int x = 10

const int *ptr = &x ;

*ptr = 5 ;

}

Question No: 21 ( Marks: 5 )

If int array[10]; is an integer array then write the statements which will store values at

Fifth and Ninth location of this array,

Question No: 22 ( Marks: 10 )

Write a function BatsmanAvg which calculate the average of a player (Batsman),

Call this function in main program (Function). Take the input of Total Runs made

and Total number of matches played from the user in main function

## ACC501 Business Finance Mid Term Examination – Spring 2005

Mid Term Examination – Spring 2006
Time Allowed: 90 Minutes
question:
• All questions are compulsory.
• This exam consists of 10 Multiple Choice Questions (MCQ’s), 5 Fill in the Blanks, 5Short
Questions and 1 Descriptive Question.
• You should try to complete MCQ’s in 10 – 15 minutes in order to avail 75 – 80 minutes for
the descriptive questions.
• For each MCQ, read the choices available carefully and select the choice which you
consider is the most suitable, by clicking on the appropriate circle.
• Do not click the “Finish button” while solving your paper. Once you clicked the “Finish”
button, you will not be able to access your paper again. Click it only at the end after
attempting the whole paper, which will be an indication that you have submitted your
complete paper.
• You are required to show all the working of short questions as well as descriptive question
• The use of calculator and financial tables is allowed.
• A clock has been given in the exam software. Software will automatically be closed after
90 minutes.
• It is your responsibility to manage time and responses to test questions effectively.

• Failure to comply with the supervisor’s directions will result in your test being cancelled.
Please comply with supervisor’s directions to avoid any unpleasant event.
Question No. 1 Marks : 1
The _____________________ ratio is the same as the _______________________ ratio
except inventories and “other current assets” are dropped from the numerator.
Question No. 2 Marks : 1
The growth that can be financed without resorting to any external equity financing is
called the _______________
Question No. 3 Marks : 1
Financial institutions facilitate individuals and firms in:
Borrowing
Lending
pooling of risks
all of the given options
Question No. 4 Marks : 1
are issued by state and local governments.
Treasury bonds
Municipal bonds
Corporate bonds
Personal bonds
Question No. 5 Marks : 1
You are expecting to receive Rs.5000 in 3 years. If the interest rate increases, the
present value of that future amount to you would:
Fall
Rise
remain unchanged
Question No. 6 Marks : 1
is not the function of the treasurer:
Preparation of financial statements
Investor relationships
Cash management
Obtaining finances
Question No. 7 Marks : 1
Sara is interested in purchasing Tom’s factory. Since Sara is a poor negotiator, she
hires Maria to negotiate a purchase price. Identify the parties to this transaction from
the given options, according to agency theory:
Sara is the agent.
Maria is the principal.
Tom is the agent and Maria is the principal
Sara is the principal and Maria is the agent.
Question No. 8 Marks : 1
Purchasing new machinery for expanding production capacity by a corporation is
____________________
Question No. 9 Marks : 3
CVP Corporation has a policy of paying a \$10 per share dividend every year. This
policy is to continue indefinitely. What is the value of a share of stock if the required
rate of return is 20%?
Question No. 10 Marks : 1
A constant stream of cash flows for a limited number of years coming at regular
intervals is called a (an) .
Question No. 11 Marks : 1
is not an advantage of separation of ownership and
management of corporations.

Corporations can exist forever.
Facilitate transfer of ownership without affecting the operations of the firm
Hire professional managers
Incur agency costs
Question No. 12 Marks : 10
Mr. Martin has \$20,000 that he can deposit in savings accounts of any of three banks
for a three year period. Bank A compounds on an annual basis; Bank B compounds
interest twice each year; Bank C compounds interest each quarter. All three banks
have a stated annual interest rate of 4%.
Required:
a. What amount would Mr. Martin have at the end of 3rd year in each bank?
(Marks: 08)
b. On the basis of your findings in part a, describe which bank should Mr. Martin
deal with and why? (Marks: 02)
Question No. 13 Marks : 1
A firm is having difficulty in controlling its operating expenses. Which ratio category
in given options will most directly reflect this problem?
Liquidity
Profitability
Market value
Turnover
Question No. 14 Marks : 1
A firm’s investment decision is also called the:
financing decision
capital budgeting decision
liquidity decision
debt financing
Question No. 15 Marks : 3
Why would you prefer corporate form of organization over other forms of business
organizations? Discuss giving at least three arguments.
Question No. 16 Marks : 3
What is an agency relationship? Describe the reason that results in agency problem.
Question No. 17 Marks : 1
Suppose a Corporation has a taxable income of Rs.50000 and the tax amount
calculated is as given below:
Rs.30000 x 5% = Rs.1500
(Rs.40000 – 30000) x 10% = 1000
(Rs.50000 – 40000) x 15% = 1500
Rs.4000
Total tax amount is Rs.4000. Average tax rate is Rs.4000 / 50000 = 8.0%. Marginal tax
rate will be:
39%
34%
15%
25%
Question No. 18 Marks : 3
What do you understand by seniority in a bond indenture?
Question No. 19 Marks : 3
What are the three factors that affect Return on Equity, according to Du Pont Identity?
Question No. 20 Marks : 1
In context of inflation and returns, the relationship between real and nominal returns
is described by:
Fisher Effect
Ricardo Effect
Robbins Effect
Fredrick Effect
Question No. 21 Marks : 1
Debt securities issued by corporations are called .