cs201 Midterm Solved Mcqs With Reference
cs201 Midterm Solved Mcqs With Reference
com
MIDTERM EXAMINATION
Spring 2009
CS201- Introduction to Programming
► Statement
► Program
► Utility
► Routine
► Java Language
► UNIX
► FORTRON Language
► C Language
► Must
► Necessary
► Good Programming
► 1 and 2 only
Dealing with structures and functions passing by reference is the most economical method
► True
► False
► Data
► Memory Address
► Data Type
► Values
Preprocessor program perform its function before ______ phase takes place.
► Editing
► Linking
► Compiling
► Loading
► area
► _area
► 10area
► area2
► for
► while
► do-while
Which character is inserted at the end of string to indicate the end of string?
► new line
► tab
► null
► carriage return
► 10
► 11
► 12
► 13
► iostream.h
► conio.h
► stdlib.h
► stdio.h
► the variable must always be the letter i when using a for loop
For which array, the size of the array should be one more than the number of elements in an
array?
► int
► double
► float
► char
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.
Write a C++ program that will determine if a departmental store customer has exceeded the
credit limit on a charge account.
Program should input the following facts in five variables
1. Account number
2. Balance at the beginning of month (Beginning balance)
3. total of all items charged by customer this month (charges)
4. total of all credits (credits)
5. allowed credit limit
MID-TERM 2009
► In curly braces
► In small braces
► In single quotes
► In double quotes
► 1 bytes
► 2 bytes
► 3 bytes
► 4 bytes
► Rectangle
► Arrow symbol
► Oval
► Circle
► No effect on program
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
Which of the following is the correct way to assign an integer value 5 to element of a
matrix say ‘m’ at second row and third column?
► m[2][3] = 5 ;
► m[3][2] = 5 ;
► m[1][2] = 5 ;
► m[2][3] = ‘5’;
How many total elements must be in two-dimensional array of 3 rows and 2 columns?
►4
►5
►6
►7
Which of the following is the correct statement for the following declaration?
Consider the following code segment. What will be the output of this code segment?
►3
►9
► 12
►2
What will be the correct syntax to assign an array named arr of 5 elements to a pointer
ptr?
► *ptr = arr ;
*ptr = arr[5]► ;
low► level
object based►
object► oriented
function oriented►
.exe►
.txt►
.h►
.c►
The variables having a name, type and size are just like empty boxes.
False►
True►
► the variable must always be the letter i when using a for loop
► True
False►
► Structure
► Class
► Function
Suppose ‘z’ is a variable of type int. What will be the result of x = 27/4:
struct Customer
int custnum;
int salary;
float commission;
};
A programmer wants to assign 2000 for the structure member salary in the above
example of structure Customer with structure variable cust1 What line of code should he
write
What is compiler?
Write a void function( ); that takes integer numbers from the user and then displays the
sum of odd and even numbers entered by the user. Your program should terminate if
user enters a negative number