Spring 2010 CS201-Introduction To Programming: Then Draw A Line To Its Right
Spring 2010 CS201-Introduction To Programming: Then Draw A Line To Its Right
Spring 2010 CS201-Introduction To Programming: Then Draw A Line To Its Right
com
MIDTERM EXAMINATION
Spring 2010
CS201- Introduction to Programming
C language is developed by
► Bill Gates
► Robert Lafore
► Dennis Ritchie
►0
► -32
► 65531
► -4.0
► Circle
► Arrow
► Diamond
Then draw a line to its right
www.vuplanet.com
► Must
► Optional
► syntax error
► Necessary
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 pag no 68
► Sequential File
► Data File
www.vuplanet.com
► Record File
Member function tellg() returns the current location of the _____________ pointer.
► tellptr()
► write()
► seekg()
► get()
s
Dealing with structures and functions passing by reference is the most economical method
.
► True
► False
► Null character
www.vuplanet.com
► String
► Zero
► Full stop
.
Word processor is .
► Operating system
► Application software
► Device driver
► Utility software
► area
► _area
► 10area
► area2
► for
► while
► do-while
► True
► False
► * operator
► -> operator
► && operator
► & operator
► True
► False
Let suppose .
Union 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?
12
for loop runs till the condition end and while loop runs until condition is not completed
struct Customer
{
int custnum;
int salary;
float commission;
Customer.salary = cust1;
cust1=2000;
};
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
When a pointer is incremented then how many bytes will it move to change its address?
If there are 2n elements in an array then what would be the number of iterations required to
search a number using binary search and linear search?
Perform left shift operation on a binary number 0101 and write the result in binary and decimal.
5
func(arr, 5) ;
What is random access file and how data can be read and write into random access file?
Now we will discuss how to access files randomly, forward and backward. Before moving
forward or backward within a file, one important factor is the current position inside the file.
Therefore, we must understand that there is a concept of file position (or position inside a
file) i.e. a pointer into the file. While reading from and writing into a file, we should be very
clear from where (which location inside the file) our process of reading or writing will start.
To determine this file pointer position inside a file, we have two functions tellg() and tellp().
Position in a File Let’s say we have opened a file stream myfile for reading (getting),
myfile.tellg () gives us the current get position of the file pointer. It returns a whole number
of type long, which is the position of the next character to be read from that file. Similarly,
tellp () function is used to determine the next position to write a character while writing into
a file. It also returns a long number. For example, given an fstream object aFile:
Streampos original = aFile.tellp(); //save current position aFile.seekp(0, ios::end);
//reposition to end of file aFile << x; //write a value to file aFile.seekp(original); //return to
original position So tellg () and tellp () are the two very useful functions while reading from
or writing into the files at some certain positions.
www.vuplanet.com
MIDTERM EXAMINATION
Spring 2010
CS201- Introduction to Programming
C language is developed by
► Bill Gates
► Robert Lafore
► Dennis Ritchie
►0
► -32
► 65531
► -4.0