# Virtual University VU CS201 – Introduction To Programming Final Term Past Solved Unsolved Spring Fall 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 All Year Past Papers

Click Any Link To View Finalterm Papers

# Virtual University CS201 – INTRODUCTION TO PROGRAMMING MIDTERM EXAMINATION (Session – 1 ) SPRING 2007

MIDTERM EXAMINATION

SPRING 2007

CS201 – INTRODUCTION TO PROGRAMMING

(Session – 1 )

Marks: 50

Time: 90min

StudentID/LoginID:

Student Name:

Center Name/Code:

Exam Date:

______________________________

______________________________

______________________________

Saturday, May 12, 2007

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 Dev-C++/C ++

syntax.

e. Choose the most appropriate choice (among the given) while answering

the MCQs.

You

are

not

allowed

to

use

any

compiler

or

IDE.

**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

Marks

Question

Marks

1

11

2

12

3

13

4

14

5 6 7 8 9 10 Total

Question No: 1

( Marks: 1 )

– Please choose one

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

► Last

► Middle

► Post Design

► First

Question No: 2

( Marks: 1 )

– Please choose one

The remainder (%) operator is,

An arithmetic operator

► A logical operator

► A relational operator

► A division operator

Question No: 3

( Marks: 1 )

– Please choose one

When a call to function statement is encountered,

► The control is transfer to its Prototype

► The control is transfer to its definition

► The compiler stop execution of whole program

► The program hangs

Question No: 4

( Marks: 1 )

– Please choose one

In C/C++ language when an array is passed to a function then by default its passing

Mechanism is,

► Call by value

► It depends on type of array

► Call by Reference

► It depends on the return type of function.

Question No: 5

( Marks: 1 )

– Please choose one

Computer can do,

► More than what we tell it

► Less then what we tell it

► Like human being

► Exactly what we tell it

Question No: 6

( Marks: 1 )

– Please choose one

int x = 2 * 3 + 4 * 5;

What value will x contain in the sample code above?

► 22

► 26

► 46

► 50

Question No: 7

( Marks: 1 )

– Please choose one

In flow chart process is represented by

► Rectangle

► Arrow symbol

► Oval

► Circle

Question No: 8

( Marks: 1 )

– Please choose one

Which one of the following will declare a pointer to an integer at address 0x22ff74 in memory?

► int *x;

*x = 0x22ff74;

► int *x = &0x22ff74;

► int *x = *0x22ff74;

► int *x( &0x22ff740 );

Question No: 9

( Marks: 1 )

– Please choose one

When we are using const keyword with a variable x then initializing it at the time of declaration is

► Must

► Optional

► Not necessary

► A syntax error

Question No: 10

( Marks: 1 )

– Please choose one

int numarray[4][4] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};

What value does numarray [0][3] in the sample code above contain?

► 3

► 5

► 7

► 4

Question No: 11

( Marks: 5 )

Write Header files for the functions,

i.

ii.

iii.

iv.

v.

sqrt();

getline();

printf();

exit();

rand();

Question No: 12

( Marks: 5 )

Write down the output of the following code?

int array[7], sum = 0;

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

{

array[i] = i;

sum+= array[i];

}

cout<< “ Sum = “ <<sum;

Question No: 13

( Marks: 15 )

Write a program which consists of three variables Area, Per, Base, this program should find

and display the area of triangle using the formula,

Area = (Base * Per)/2 ;

Take the value of variables Per and Base from the user.

Question No: 14

( Marks: 15 )

Write a function BalerAvg which calculate and display the average of a player (Baler), call this

function in main program (function). Take input of runs given and ball delivered from the user in

main funciton.

The average may be calculated by the formula,

Average = (Total Runs given * 60) / (Total number of balls delivered);

## Virtual University CS201 – INTRODUCTION TO PROGRAMMING MIDTERM EXAMINATION (Session – 1 ) SPRING 2007

Education In Pakistan © 2016