0% found this document useful (0 votes)
30 views

WWW - Vutube.Edu - PK: CS201 Mid Term Spring 2010

The document contains a midterm exam for a CS201 class with 6 multiple choice questions. Question 1 asks for the general syntax of a switch statement. Question 2 asks why files should be closed after use. Question 3 asks how many bytes a pointer will move when incremented. Question 4 asks to compare the number of iterations for linear and binary search in an array with 2n elements. Question 5 asks for the function definition to pass an argument by reference without changing values. Question 6 provides code to output the values of x and y after bitwise operations.

Uploaded by

Muhammad Saleem
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

WWW - Vutube.Edu - PK: CS201 Mid Term Spring 2010

The document contains a midterm exam for a CS201 class with 6 multiple choice questions. Question 1 asks for the general syntax of a switch statement. Question 2 asks why files should be closed after use. Question 3 asks how many bytes a pointer will move when incremented. Question 4 asks to compare the number of iterations for linear and binary search in an array with 2n elements. Question 5 asks for the function definition to pass an argument by reference without changing values. Question 6 provides code to output the values of x and y after bitwise operations.

Uploaded by

Muhammad Saleem
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

WWW.VUTUBE.EDU.

PK
CS201 Mid Term Spring 2010

Q1: Write down the general syntax of switch statement. 2 Marks

Q2: Why we close a file after use? 2 Marks

Q3: When a pointer is incremented then how many bytes will it move to change its address?
2 Marks

Q4: If there are 2n element in an array then what would be the number of iterations required to
search a number using binary and linear search? 3 Marks

Q5: write down the functions definition if we want to pass the argument to a function by
reference without changing the values stored at address. 5 Marks

Q6: What will be the output of the following code segment 5 Marks

, int x= 6;
int y;
x = x << 1;
y = x >> 1;
cout << “x = ” << x << “\n”;
cout << “y = ” << y;

You might also like