vuZs

Virtual University: Study Resource Bank

You are here: Home Old Papers CS201 - Introduction to Programming Papers CS201- Introduction to Programming Solved Midterm Paper 2009(4)
Like this Page? Press  
 

Solved Exam papers

CS201- Introduction to Programming Solved Midterm Paper 2009(4)

 

CS201- Introduction to Programming Solved Midterm Paper 2009(4)

 Solved by vuZs Team ( Aniqa MAlik)

Question No: 1      ( M - 1 )
In C/C++ the #include is called,
►Header file

Preprocessor Directive pg 269
►Statement

►Function 

Question No: 2      ( M - 1 )
To access the element of two dimensional array we use,
►Single referencing

►Single dereferencing
Double dereferencing  Pg175
►Double referencing 

Question No: 3      ( M - 1 )
Data Size of the file is always___________ the actual size of the file.
►Greater than

►Equal to
►Less than or equal to
►None of the above Pg 216

Similarly in case of files, the space occupied by a file (file size) can be more than the actual data length of the file itself.

Question No: 4      ( M - 1 )
When an identifier is declared with keyword const then,
►Its value can be changed during execution.

Its value can not be changed Pg110
►Its value can be changed with arithmetic operator

►Its value can be overwritten

Question No: 5      ( M - 1 )
In C/C++ if we define an array of size eight (8) i.e. int Arr [8]; then the last element of this array will be stored at,
►Arr[0]

►Arr[8]
Arr[7]
►Arr[-1] 

Question No: 6      ( M - 1 )
If it is required to copy an array to another array then,
Both arrays must be of the same size and data type Pg 105
►Both arrays may be of different size

►Both arrays may be of different data type
►Both arrays may be of different size and type

Question No: 7      ( M - 1 )
In C/C++ all character strings are terminated with,
► Null character Pg 166
► String

► Zero
► Full stop

Question No: 8      ( M - 1 )
Let suppose
struct intorDouble {
int ival; Double charvar;
}; 
main(){
intorDouble VAZ;
int size ;
size = sizeof(VAZ);
}
What will be the value of variable size, if int occupies 4 bytes and double occupies 8 bytes?
► 2

► 4
► 8
► 12

Question No: 9      ( M - 1 )
When a pointer is incremented, it actually jumps the number of memory addresses.
According to data type Pg 160
►1 byte exactly

►1 bit exactly
►A pointer variable can not be incremented

 Question No: 10      ( M - 1 )
Do-while loop executes at least,
►Zero Time

One Time
►Two Times

►N Times
http://books.google.com.pk/books?id=xnEYsMiYgiMC&pg=PA521&lpg=PA521&dq=%22Do-while+loop+executes+at+least+One+Time%22&source=bl&ots=hovQ0faYdl&sig=_z9IXC5Zmxt5JsWJS6aVgrd9YKg&hl=en&sa=X&ei=Yw98UNCOEoiD4gS734HoCg&ved=0CCAQ6AEwAQ#v=onepage&q=%22Do-while%20loop%20executes%20at%20least%20One%20Time%22&f=false

 

 Question No: 11      ( M - 1 )
+= , *= , /= , etc are called,
►Assignment operators

►Logical operator
Compound assignment operator Pg 63
►Unary operator

 Question No: 12      ( M - 1 )
Computer can understand only machine language code.
True Pg 12
►False

Which of the following is the correct syntax to print multiple values or variables in a single command using cout?
►cout <

►cout <
►cout <
►cout <

Question No: 14      ( M - 1 )
The compilers and interpreters also belong to the System Software category.
True Pg 11
►False


Question No: 15      ( M - 1 )                                       
Editors are used to compile the code.

►True
False

 Compilers are used for compilation of source codes, However Editors are used to write the source codes.

Question No: 16      ( M - 1 )
The variables having a name, type and size are just like empty boxes.
True
►False 

Question No: 17      ( M - 1 ) 
What will be the result of the statement
rand ( ) % 50

When 50 divides any number, the remainder will always be less than 50.

Question No: 18      ( M - 1 )
What is the ASCII code of null character?
The ASCII code of null character 00.


Ref” http://www.theasciicode.com.ar/ascii-control-characters/null-character-ascii-code-0.html 

Question No: 19      ( M - 2 )
What is a truth Table?                                  

A truth table is a mathematical table used in logic—specifically in connection with Boolean algebra, Boolean functions, and propositional—to compute the functional values of logical expressions on each of their functional arguments, that is, on each combination of values taken by their logical variables .In particular, truth tables can be used to tell whether a propositional expression is true for all legitimate input values, that is, logically valid.

 Ref: http://en.wikipedia.org/wiki/Logic

 Question No: 20      ( M - 3 )
How learning to design programs is like play soccer?

 Learning to design programs is like learning to play soccer. A player must learn to trap a ball, to dribble with a ball, to pass, and to shoot a ball. Once the player knows those basic skills, the next goals are to learn to play a position, to play certain strategies, to choose among feasible strategies, and, on occasion, to create variations of a strategy because none fits.

Question No: 21      ( M - 5 )
What is the purpose of the default statement?

The default statement is optional. If there is no case which matches the value of the switch statement, then the statements of default are executed.

 Question No: 22      ( M - 10 )
Write a program which contains a user defined f takes 3 integer arguments hours, minutes and seconds and returns the number of seconds. ConvertInSeconds that Input variables hours , minutes and seconds in main program and call the fun ConvertInSecondsand display the number of seconds returned by function.
Hint:
1 hour =60 minutes

1 minute =60 seconds

 

 

 

Add comment


Security code
Refresh

You are here: Home Old Papers CS201 - Introduction to Programming Papers CS201- Introduction to Programming Solved Midterm Paper 2009(4)