Anda di halaman 1dari 4

FOR MORE PAPERS | LOGON TO WWW.VUSSS.

COM
MID TERM

CS201- Introduction to Programming


What will be the correct syntax of the following statement?
ptr is a constant pointer to integer.
 const int *ptr ;
 const *int ptr ;
 int const *ptr ;
 int *const ptr ;

How many dimensions does n-dimensional array has?


 n dimensions
 2n dimensions
 (n+1) dimensions
 (n-1) dimensions

The memory address of the first element of an array is called


 floor address
 foundation address
 first address
 base address

'while' loop becomes infinite when __________ .


 the condition is always false
 the condition is less than zero
 the condition is always true
 the condition contains a logical operator

We want to access array in random order which of the following


approach is better?
 Pointers
 Array index
 Both pointers and array index are better
 Matrix

In C/C++, the #include is called______________.


 Header file
 Preprocessor Directive
 Statement
 Function

Assignment operator is used for ___________.


 Calculation
 Reading

FOR MORE PAPERS | LOGON TO WWW.VUSSS.COM


Page 1 of 4
FOR MORE PAPERS | LOGON TO WWW.VUSSS.COM
MID TERM

 assigning values to variables


 equality checking

Programming a computer simply means telling it __________.


 why to do
 when to do
 what to do
 how to do

Using a segment of source code again by adding new functionalities


with slight or no modification is termed as ____________.
 code efficiency
 code reusability
 code modification
 code compatibility

From the options given, you need to choose the option which is true
for the given code.
for (int i = 1; i > 0; i++) {
/* loop code */
}
the logical operator && cannot be used in a test condition
the while loop is an exit-condition loop
the test condition is always false
the test condition is always true
C is a/an ______ language.
 low level
 object based
 object oriented
 function oriented

___________ operator is used to pass the address of a variable to


the called function.
 *
 **
 &
 &&

In C/C++, there are _________ levels of scope for identfiers.


 2
 4
 3
 1

FOR MORE PAPERS | LOGON TO WWW.VUSSS.COM


Page 2 of 4
FOR MORE PAPERS | LOGON TO WWW.VUSSS.COM
MID TERM

What will be the correct syntax for initialization of a pointer ptr with
string "programming"?
 char *ptr = ‘programming’ ;
 *ptr = “programming” ;
 char ptr = ’programming’ ;
 char *ptr = “programming” ;

C is widely known as development language of _______ operating


system.
 Windows
 Unix
 Mac OS
 Linux

In C/C++, the header file used for string manipulation is


__________.
 stdlib.h
 string.h
 strings.h
 stype.h

In C/C++, when two programs a and b are trying to open a file


xyz.txt at same time then ___________.
 Both programs will generate error
 Only one of them will succeed in opening that file and other will fail
 Both programs will open the file
 One of the program will re-start

__________ is used to check for the end of file when a file is being
read.
 Eof
 Endline
 Fend
 Endf

The function write() takes ___________________as parameter(s).


 String of pointer type
 String of variable lengths, no. of bytes to be read and flags
 Pointer array of characters and a delimiter
 String and no. of bytes to be written

FOR MORE PAPERS | LOGON TO WWW.VUSSS.COM


Page 3 of 4
FOR MORE PAPERS | LOGON TO WWW.VUSSS.COM
MID TERM

A ________ name includes a primary name and an optional period


with an extension.
 File
 Disk
 Data
 Database

Question No: 21 ( Marks: 2 )


Write the code to access the element at third row and second column of a 2D
array uses pointer named arrayptr .

Question No: 22 ( Marks: 2 )


Identify each of these functions as character conversion functions or
manipulation functions.

1. int isprint( int c )


2. int tolower( int c )

Question No: 23 ( Marks: 3 )


Determine the output of the given code segment.

#include <iostream.h>

main()
{
char *name[] = {"Ali", "Ahmad", "Riaz"};
int x;
int y;

x = sizeof(name);
y = sizeof(*name);

cout<<x<<endl<<y;

return 0;
}

Question No: 24 ( Marks: 3 )


Explicitly opening and closing a file by using open() and close() functions
provide us an advantage in term of memory utilization. Mention that
advantage.

FOR MORE PAPERS | LOGON TO WWW.VUSSS.COM


Page 4 of 4