Sunteți pe pagina 1din 7

http://groups.google.

com/group/vuZs Solved by vuZs Team

MIDTERM EXAMINATION
Spring 2009
CS201- Introduction to Programming
Shared & Solved by vuZs Team
( vuZsHelp@gmail.com)
http://groups.google.com/group/vuZs

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

In C/C++ the #include is called,

►Header file

►Preprocessor Directive

►Statement

►Function

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

To access the element of two dimensional array we use,


http://groups.google.com/group/vuZs

►Single referencing

►Single dereferencing

►Double dereferencing

►Double referencing

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

Data Size of the file is always___________ the actual size of the file.

►Greater than
http://groups.google.com/group/vuZs Solved by vuZs Team

►Equal to

►Less than or equal to

►None of the above

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

When an identifier is declared with keyword const then,

►Its value can be changed during execution.

►Its value can not be changed

►Its value can be changed with arithmetic operator

►Its value can be overwritten

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

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]
http://groups.google.com/group/vuZs

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

If it is required to copy an array to another array then,

►Both arrays must be of the same size and data type

►Both arrays may be of different size

►Both arrays may be of different data type


http://groups.google.com/group/vuZs Solved by vuZs Team

►Both arrays may be of different size and type

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

In C/C++ all character strings are terminated with,

► Null character

► String

► Zero

► Full stop

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

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
http://groups.google.com/group/vuZs Solved by vuZs Team

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

When a pointer is incremented, it actually jumps the number of memoryaddresses

►According to data type

►1 byte exactly

►1 bit exactly

►A pointer variable can not be incremented

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

Do-while loop executes at least,


http://groups.google.com/group/vuZs

►Zero Time

►One Time

►Two Times

►N Times

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

+= , *= , /= , etc are called,

►Assignment operators

►Logical operator

►Compound assignment operator

►Unary operator

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

Computer can understand only machine language code.

►True
http://groups.google.com/group/vuZs Solved by vuZs Team

►False

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

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

►cout << "Hello" + x + "\n";

►cout << "H" << x << "\n";

►cout << "H", x, "\n";

►cout << ("H" & x & "\n");

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

The compilers and interpreters also belong to the System Software category.

►True

►False
http://groups.google.com/group/vuZs

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

Editors are used to compile the code.

►True

►False

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

The variables having a name, type and size are just like empty boxes.

►True

►False

Question No: 17 ( Marks: 1 )


http://groups.google.com/group/vuZs Solved by vuZs Team

What will be the result of the statement


rand ( ) % 50

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

Question No: 18 ( Marks: 1 )

What is the ASCII code of null character

Answer: The ASCII code of null character is all zeros.

Question No: 19 ( Marks: 2 )

What is a truth Table?

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. In logic design, there are certain
techniques that are known as minimization techniques. These are used to make a big circuit with the use of
minimum chips. These minimization techniques deal with Boolean algebra i.e. logic. These techniques are
also used in programming. So we should keep breadth in our vision while maintaining a horizontal
integration. We should always think outside the box. There is a way of thinking for us as programmers.
We always look at problems, slice and dice them and come up with solutions. Programming as a skill is
infact important. It helps us think, from a logical perspective. How can we do it is something else. We can
get it from the reference books of the language or from online help in the compiler. This part that how can
we do is always changing. New languages will be evolved for our help. On the other hand, what is to be
done depends on our logical skills and fundamental knowledge. We have to develop this thing.

Question No: 20 ( Marks: 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 ( Marks: 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.
http://groups.google.com/group/vuZs Solved by vuZs Team

Question No: 22 ( Marks: 10 )

Write a program which contains a user defined f takes 3 integer arguments hours, minutes and seconds and ret

ConvertInSeconds that

Input variables hours , minutes and seconds in main program and call the
fun ConvertInSeconds and display the number of seconds returned by function.

Hint:
1 hour =60 minutes
1 minute =60 seconds

# include <iostream.h>
int ConvertInSeconds(int hours, int mins, int secs);
main()
{
int stopit;
int hours, mins, secs = 0 ;
cout << "Please Entere the Hours : " ;
cin>> hours ;
cout << "Please Entere the Minutes : " ;
cin>> mins ;
cout << "Please Entere the seconds : " ;
cin>> secs ;
cout << "\n Total Seconds = " << ConvertInSeconds(hours, mins, secs);
cin>> stopit; //pause screen to show output
}
int ConvertInSeconds(int hours, int mins, int secs)
{
return ( (hours*60*60)+(mins*60)+(secs));
}
http://groups.google.com/group/vuZs

S-ar putea să vă placă și