MIDTERM EXAM CS201- Introduction to Programming



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

Which of the following function(s) is/are included in stdlib.h header file?

       ► double atof(const char *nptr)

       ► int atoi(const char *nptr)

       ► char *strcpy ( char *s1, const char *s2)

       ► 1 and 2 only

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

Dealing with structures and functions passing  by reference is the most economical method

       ► True

       ► False

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

Pointer is a variable which store,

       ► Data

      ► Memory Address

       ► Data Type

       ► Values

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

Preprocessor program perform its function before ______ phase takes place.

       ► Editing

       ► Linking

       ► Compiling

       ► Loading

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

Which of the following can not be a variable name?

       ► area

       ► _area

       ► 10area

       ► area2

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

Which looping process is best, when the number of iterations is known?

       ► for

       ► while

       ► do-while

       ► all looping processes require that the iterations be known

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

Which character is inserted at the end of string to indicate the end of string?

       ► new line


       ► tab

       ► null

       ► carriage return

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

How many bytes are occupied by declaring following array of characters?
 char str[] = “programming”;

       ► 10

       ► 11

       ► 12

       ► 13

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

Which of the following header file defines the rand() function?

       ► iostream.h

       ► conio.h

       ► stdlib.h

       ► stdio.h

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

Commenting the code _____________________

       ► Makes a program easy to understand for others.

       ► Make programs heavy, i.e. more space is needed for executable.

       ► Makes it difficult to compile

       ► All of the given options.

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

What's wrong with this for loop?
  for (int k = 2, k <=12, k++)

       ► the increment should always be ++k

       ► the variable must always be the letter i when using a for loop

       ► there should be a semicolon at the end of the statement

       ► the commas should be semicolons

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

For which array, the size of the array should be one more than the number of elements in an array?

       ► int

       ► double

       ► float 

       ► char