Tuesday 17 May 2011

MIDTERM EXAMINATION CS201- Introduction to Programming Solved MCQs

Question No: 1     
_______________are conventional names of the command line parameters of the ‘main()’ function.
Select correct option:
(a)  ‘argb’ and ‘argv’
(b)  ‘argc’ and ‘argv’
(c)  ‘argc’ and ‘argu’
(d)  None of the given
Question No: 2     
In_________, we try to have a precise problem statement
Select correct option:
(a)  Analysis
(b)  Design
(c)  Coding
(d)  None of the given
Question No: 3   
Pointers are a special type of __________in which a memory address is stored
Select correct option:
(a)  variables
(b)  Location
(c)  Characters
(d)  None of the given
Question No: 4     
At the design phase, we try to break up the problem into___________
Select correct option:
(a)  functional units
(b)  non-functional units
(c)  small units
(d)  None of the given
Question No: 5     
char name [] = “Hello World” ; In the above statement, a memory of _________ characters will be allocated
Select correct option:
(a)  13
(b)  11
(c)  12
(d)  10
Question No: 6
Pointers work by pointing to a particular___________
Select correct option:
(a)  Value
(b)  variable
(c)  data type(doubtful)
(d)  None of the given
Question No: 7


___________ Returns true if c is a digit and false otherwise.
Select correct option:
(a)  int isalpha( int c )
(b)  int isalnum( int c )
(c)  int isxdigit( int c )
(d)  int isdigit( int c )
Question No: 8
The ASCHI code of null character is___________
Select correct option:
(a)  000
(b)  010
(c)  111
(d)  110
Question No: 9
The increment of a pointer depends on its___________.
Select correct option:
(a)  variable
(b)  value
(c)  data type
(d)  None of the given
Question No: 10

At the___________, we try to break up the problem into functional units
Select correct option:
(a)  analysis phase
(b)  design phase
(c)  Implementation phase
(d)  None of the given
Question No: 11
To get the value stored at a memory address, we use the________________
Select correct option:
(a)  referencing operator
(b)  dereferencing operator
(c)  simple operator
(d)  None of the given
Question No: 12
suppose we have int y[10]; To access the 4th element of the array we write_________
Select correct option:
(a)  y[4];
(b)  y[3];
(c)  y[2];
(d)  none of given
Question No: 13
A character is stored in the memory in _________
Select correct option:
(a)  byte
(b)  integer
(c)  string
(d)  None of the given
Question No: 14     
The function of cin is
(a)  To display message
(b)  To read data from keyboard
(c)  To display output on the screen
(d)  To send data to printer
Question No: 15     
In C/C++ language the header file which is used to perform useful task and manipulation of character data is
(a)  cplext.h
(b)  ctype.h
(c)  stdio.h
(d)  delay.h

Question No: 16    

Word processor is
(a)  Operating system
(b)  Application software
(c)  Device driver
(d)  Utility software

Question No: 17     

Each pass through a loop is called a/an
(a)  enumeration
(b)  culmination
(c)  pass through
(d)  Iteration

Question No: 18   

What is the correct syntax to declare an array of size 10 of int data type?  
(a)  int [10] name ;
(b)  name[10] int ;
(c)  int name[10] ;
(d)  int name[] ; 

Question No: 19     

What will be the correct syntax to initialize all elements of two-dimensional array to value 0?
(a)  int arr[2][3] = {0,0} ;
(b)  int arr[2][3] = {{0},{0}} ;
(c)  int arr[2][3] = {0},{0} ;
(d)  int arr[2][3] = {0} ;


Question No: 20     

Which of the following operator is used to access the value of variable pointed to by a pointer?

(a) * operator
(b) -> operator
(c) && operator
(d) & operator
Question No: 21     

Analysis is the -------------- step in designing a program

(a)  Last
(b)  Middle
(c)  Post Design
(d)  First

Question No: 22     

Paying attention to detail in designing a program is _________
(a)  Time consuming
(b)  Redundant
(c)  Necessary
(d)  Somewhat Good
Question No: 23   
What is the output of the following statement?
 int i = 2.5; do { cout i * 2; } while (i > 3 && i < 10);
(a)  510
(b)  5
(c)  48
(d)  error
       
Question No: 24   
Searching is easier when an array is already sorted
(a)  True
(b)  False

Question No: 25   
If an array has 100 elements, what is allowable range of subscripts?
(a)0 - 99
(b)  1 - 99
(c)  0 - 100
(d)  1 - 100
   
Question No: 26   
What will be the value of ‘a’ and ‘b’ after executing the following statements?
a = 3;
b = a++;

(a) 3, 4
(b)4, 4
(c)  3, 3
(d) 4, 3
   
Question No: 27   
What will be the correct syntax to initialize all elements of two-dimensional array to value 0?
(a)  int arr[2][3] = {0,0} ;
(b)  int arr[2][3] = {{0},{0}} ;
(c)  int arr[2][3] = {0},{0} ;
(d)  int arr[2][3] = {0} ;

Question No: 28   
Which of the following function returns the size of a string variable?

(a) strlength()
(b)  stringlen()
(c)  strlen()
(d)  strLength()
   
Question No: 29   
Computer can understand only machine language code.
(a)  True
(b)  False

Question No: 30   
What does 5 ^ 6 , evaluate to in decimal where ‘^’ is Exclusive OR operator?
(a)  True
(b)  False
Detail:-
It mean
5        =          0101
6        =          0110
5 ^ 6  =          0011
If both input is same then the output is 0 and if different then output is 1

Question No: 31   
If the file is not properly closed in the program, the program ____________.

(a)  Terminate normally
(b)  Indicate Runtime error
(c)  Indicate Compile time error
(d)  Crashes
   
Question No: 32   
Which of the following header file include string conversion functions?

(a) string.h
(b) stdlib.h
(c) ctype.h
(d) sconvert.h
Question No: 33
When the if statement consists more than one statement then enclosing these statement in curly braces is,
(a)  Not required
(b)  Good programming
(c)  Relevant
(d)  Must

Question No: 34
The while loop becomes infinite,
(a)  When the condition is always false
(b) When the condition is less than zero
(c)  When the condition is always true
(d)  When the condition contains a  logical operator

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

(a)  double atof(const char *nptr)
(b)  int atoi(const char *nptr)
(c)  char *strcpy ( char *s1, const char *s2)
(d)  1 and 2 only

Question No: 36
If we want to store a string “abc” in an array str then the size of this array must be at least, 
(a)  2
(b)  3
(c)  4
(d)  5

Question No: 37
No executable code will be generated if error is found during translation of the program using interpreter.

(a)  True
(b)  False

Question No: 38
Word processor is

(a)  Operating system
(b)  Application software
(c)  Device driver
(d)  Utility software

Question No: 39
Which of the following is the correct syntax to print multiple values or variables in a single command using cout?
(a)  cout << "Hello" + x + "\n";
(b)  cout << "H" << x << "\n";
(c)  cout << "H", x, "\n";
(d)  cout << ("H" & x & "\n");

Question No: 40
Which of the following is correct way to initialize a variable x of int type with value 10?

(a)  int x ; x = 10 ;
(b)  int x = 10 ;
(c)  int x, x = 10;
(d)  x = 10 ;
Question No: 41
If there is more than one statement in the block of a for loop, which of the following must be placed at the beginning and the ending of the loop block?
(a)  parentheses ( )
(b)  braces { }
(c)  brackets [ ]
(d)  arrows < >

Question No: 42
Name of an array is a constant pointer.

(a)  True
(b)  False

Question No: 43

How many bytes will the pointer intPtr of type int move in the following statement?
intPtr += 3 ;

(a)  3 bytes
(b)  6 bytes
(c)  12 bytes
(d)  24 bytes

Question No: 44
What will be the value of ‘a’ and ‘b’ after executing the following statements?
a = 3;
b = a++;

(a)  3, 4
(b)  4, 4
(c)  3, 3
(d)  4, 3

Question No: 45
Loader loads the executable code from hard disk to main memory.
(a)  True
(b)  False

Question No: 46
Which of the following is used with bit manipulation?

(a)  Signed integer
(b)  Un-signed integer
(c)  Signed double
(d)  Un-signed double

Question No: 47
Which of the follwoing values C++ use to represent true and false?
(a)  1 and 0
(b)  1 and -1
(c)  11 and 00
(d)  Any numerical value

Question No: 48
The argument of the isdigit() function is ___________________
(a)  a character,
(b)  a C-string,
(c)  a C++ string class variable
(d)  None of the given options.


Question No: 49     

A precise sequence of steps to solve a problem is called
(a)  Statement
(b)  Program
(c)  Utility
(d)  Routine
Question No: 50     
The Compiler of C language is written in
(a)  Java Language
(b)  UNIX
(c)  FORTRON Language
(d)  C Language
Question No: 51     
Initialization of variable at the time of definition is,

(a)  Must
(b)  Necessary
(c)  Good Programming
(d)  None of the given options
Question No: 52     
In if structure the block of statements is executed only,
(a)  When the condition is false
(b)  When it contain arithmetic operators
(c)  When it contain logical operators
(d)  When the condition is true
Question No: 53     
Which of the following function(s) is/are included in stdlib.h header file?
(a)  double atof(const char *nptr)
(b)  int atoi(const char *nptr)
(c)  char *strcpy ( char *s1, const char *s2)
(d)  1 and 2 only

Question No: 54   
Dealing with structures and functions passing  by reference is the most economical method
(a)  True
(b)  False
Question No: 55     
Pointer is a variable which store,
(a)  Data
(b)  Memory Address
(c)  Data Type
(d)  Values
Question No: 56     
Preprocessor program perform its function before ______ phase takes place.
(a)  Editing
(b)  Linking
(c)  Compiling
(d)  Loading
Question No: 57     
Which of the following can not be a variable name?
(a)  area
(b)  _area
(c)  10area
(d)  area2
Question No: 58     
Which looping process is best, when the number of iterations is known?

(a)  for
(b)  while
(c)  do-while
(d)  all looping processes require that the iterations be known

Question No: 59    
Which character is inserted at the end of string to indicate the end of string?
(a)  new line
(b)  tab
(c)  null
(d)  carriage return
Question No: 60     
Which of the following header file defines the rand() function?
(a)  iostream.h
(b)  conio.h
(c)  stdlib.h
(d)  stdio.h

Question No: 61    
What's wrong with this for loop?
  for (int k = 2, k <=12, k++)
(a)  the increment should always be ++k
(b)  the variable must always be the letter i when using a for loop
(c)  there should be a semicolon at the end of the statement
(d)  the commas should be semicolons
Question No: 62    
For which array, the size of the array should be one more than the number of elements in an array?
(a)  int
(b)  double
(c)  float 
(d)  char
Question No: 63
In C/C++ the string constant is enclosed 
(a)    In curly braces
(b)   In small braces
(c)    In single quotes
(d)   In double quotes
Question No: 64
In flow chart, the symbol used for decision making is,
a)      Rectangle
b)      Circle
c)      Arrow
d)     Diamond
Question No: 65
The data type before a function name represents its,
(a)   Return Type
(b)   Function data
(c)    Function arguments
(d)   Function name
Question No: 66
The operator used to take the address of a variable is,
(a)    &&
(b)   ++
(c)   
(d)   &
Question No: 67
The header file which is used for input and output is
(a)    maths.h
(b)   string.h
(c)    iostream.h
(d)   ctype.h
Question No: 68
When we are using command line argument(s), the default argument in C/C++ is/are ____________ .
a)      argc
b)      argd
c)      argv
d)     argc and argv
Question No: 69
In C++, Integer calculation occurs in _____ bytes.
a)      1 byte
b)     2 bytes
c)      4 bytes
d)     8 bytes
Question No: 70
In the declaration of two dimensional array,
(a)   First index represents row and second represents column
(b)   First index represents column and second represents row
(c)    Both indexes represent rows
(d)   Both indexes represent column
Question No: 71
The address operator (&) can be used with,
a)      Statement
b)      Expression
c)      Variable
d)     Constant
Question No: 72
______ translates high level language program into machine language code
(a)    Debugger
(b)   Editor
(c)    Compiler
(d)   Linker
Question No: 73
Which of the following data type(s) can operate on modulus operator ‘%’?
a)      float, int
b)      float, double
c)      int
d)     char
Question No: 74
What will be the result of the expression z = x % y, if x = 19 and y = 4?
a)      3
b)      4
c)      15
d)     19
Question No: 75
Which character is inserted at the end of string to indicate the end of string?
a)      new line
b)      tab
c)      null
d)     carriage return
Question No: 76
What will be the value of i and j in the following code segment?
int i, j ;
int x[5] = {2, 3, 4, 8, 9} ;
int *ptr =&x[2];
i = (*ptr)++ ;
j = *ptr++ ;

a)      i = 5, j = 5
b)      i = 5, j = 8
c)      i = 4, j = 8
d)     i = 5, j = 9

Question No: 77
Syntax of union is identical to  ______
a)      Structure
b)      Class
c)      Function
d)     None of the given options
Question No: 78
What is function of cout ?
(a)    To send data to printer
(b)   To read data from keyboard
(c)    To display message
(d)   To display output on the  screen
Question No: 79
In Flow chart process is represented by
(a)   Rectangle
(b)   Arrow symbol
(c)    Oval
Question No: 80
&& is -------------------- operator.
(a)    An arithmetic
(b)   Logical
(c)    Relational
(d)   Unary
Question No: 81
An over Flow condition occurs when we try to assign a value to a variable which is,
(a)   Less than its maximum size
(b)   Greater than its maximum size
(c)    With in its range
(d)   Equal to its size
Question No: 82
For dereferencing an array element using pointer, we use the operator
(a)  &
(b)  *
(c)  /
(d)  +
Question No: 83
In the declaration of two dimensional array,
(a)  First index represents row and second represents column
(b)  First index represents column and second represents row
(c)  Both indexes represent rows
(d)  Both indexes represent column
Question No: 84
Which of the following data type(s) can operate on modulus operator ‘%’?
(a)  float, int
(b)  float, double
(c)  int
(d)  char
Question No: 85
Which of the following is the correct way to declare a variable x of integer type?
(a)    x int ;
(b)   integer x ;
(c)    int x;
(d)   x integer
Question No: 86
Which of the following can not be a variable name?
(a)    area
(b)   _area
(c)    10area
(d)   area2
Question No: 87
Which of the function call is call by value for the following function prototype?
float area (int);
(a)    area(&num) ;
(b)   area(num) ;
(c)    area(int num) ;
(d)   area(*num) ;
Question No: 88
Recursive functions are used when there is a repetitive pattern.
(a)   True
(b)   False
Question No: 89
What will be the range of numbers generated by function rand () % 9?
(a)    0 to 9
(b)   1 to 9
(c)    0 to 8
(d)   1 to 8
Question No: 90
What will be the correct syntax to declare two-dimensional array of float data type?
(a)    float arr{2}{2} ;
(b)   float arr[2][2] ;
(c)    float arr[2,2] ;
(d)   float[2][2] arr ; 
Question No: 91
When a function finishes its execution then,
(a)    The control return to its Prototype
(b)   The control returns to its definition
(c)    Control returns to statement following function call
(d)   The compiler stop execution of whole program
Question No: 92
Consider the following statements to initialize a two-dimensional array.
(a)  int arr[2][3] =  {4, 8, 9, 2, 1, 6} ;
(b)  int arr[3][2] = {4, 8, 9, 2, 1, 6} ;
(c)  int arr[][2] = {{4,8},{9, 2},{1, 6}} ;

Question No: 93
Editors are used to compile the code.
(a)    True
(b)   False
Question No: 94
What is function of cout ?
(a)    To send data to printer
(b)   To read data from keyboard
(c)    To display message
(d)   To display output on the  screen
Question No: 95
< ,  <= , > , >=  are called --------------------------- operators.
(a)    Logical
(b)   Arithmetic
(c)    Relational
(d)   Conational
Question No: 96
In while loop the loop counter must be initialized,
(a)    With in the loop
(b)   Before entering the loop
(c)    At the end of the loop
(d)   None of the given options
Question No: 97
Data Size of the file is always _________ the actual size of the file.
(a)   Greater than
(b)   Equal to
(c)    Less than or equal to
(d)   None of the above
Question No: 98
The precedence of * is higher than dot operator  (.)operator
(a)  True
(b)  False
Question No: 99
Let ptr1 and ptr2 are pointer variables that points to integer data type then which one of the following arithmetic is allowed,
(a)  ptr1 + ptr2
(b)  ptr1 - ptr2
(c)  ptr1 * ptr2
(d)  ptr1 / ptr2
Question No: 100
Word processor is
(a)  Operating system
(b)  Application software
(c)  Device driver
(d)  Utility software
Question No: 101
What will be the range of numbers generated by function rand () % 9?
(a)  0 to 9
(b)  1 to 9
(c)  0 to 8
(d)  1 to 8
Question No: 102
What will be the correct syntax to assign an array named arr of 5 elements to a pointer ptr?
(a)  *ptr = arr ; 
(b)  ptr = arr ;
(c)  *ptr = arr[5] ;
(d)  ptr = arr[5] ; 
Question No: 103
What will be the output of the following code segment?

char *x = ”programming” ;
cout <<  *(x+2) << *(x+3) << *(x+5) << *(x+8) ;
(a)    prgm
(b)   rorm
(c)    ogai
(d)   ramg
Question No: 104
There is a pointer variable named ptr of type int then address of which type of variable the ptr will store in it?
(a)    variable of type char
(b)   variable of type short
(c)    variable of type int
(d)   variable of type double
Question No: 105
Flow charts explain the working of a program in pictorial format.
(a)   True
(b)   False
Question No: 106
The object _______________may be used both for file input and file output
(a)    fstream,
(b)   ifstream,
(c)    ofstream,
(d)   none of the given options.
Question No: 107
Most efficient method of dealing with structure variables is to define the structure globally
(a)   True
(b)   False
Question No: 108
If a variable is passed by value to a function and the function makes some changes to that variable then it
(a)   does not affect the original variable
(b)   affects the original variable
(c)    causes syntax error
(d)   None of the given options
Question No: 109
In C/C++ language the header file which is used to perform useful task and manipulation of character data is
(a)  cplext.h
(b)  ctype.h
(c)  stdio.h
(d)  delay.h
Question No: 110
The header file which is used for input and output is
(a)  maths.h
(b)  string.h
(c)  iostream.h
(d)  ctype.h
Question No: 111
 Suppose int multi[5][10];  when we are using **multi , it means,
(a)    Single dereferencing
(b)   Single referencing
(c)    Double referencing
(d)   Double dereferencing
Question No: 112
To access the data members of structure _______ is used.
(a)   dot operator (.)
(b)   * operator
(c)     operator
(d)   None of given.
Question No: 113
The precedence of * is higher than dot operator  (.)operator
(a)   True
(b)   False
Question No: 114
Which of the following is the starting index of an array in C++?
(a)  0
(b)  1
(c)  -1
(d)  any number
Question No: 115
When a call to function statement is encountered,
(a)  The control transfers to its Prototype
(b)  The control transfers to its definition
(c)  Control returns to statement following function call
(d)  The compiler stops execution of whole program
Question No: 116
A function must always return value.
(a)  True
(b)  False
Question No: 117
If a pointer appears on left hand side of an assignment operator then right side of that assignment operator must be,
(a)  Variable name
(b)  Address of variable
(c)  Variable value
(d)  Constant
Question No: 118
Editors are used to compile the code.
(a)    True
(b)   False
Question No: 119
Which bitwise operator returns false if both bits are 1?
(a)  AND
(b)  XOR
(c)  NOT
(d)  OR
Question No: 120
What does !(7) evaluate to in decimal where ! is a NOT operator?
(a)  7
(b)  8
(c)  9
(d)  10
Question No: 121
Structures cannot be passed as Function Parameters
(a)  True
(b)  False
Question No: 122
When break statement is encountered in a loop body it,
(a)  Transfers the control outside from current loop
(b)  Transfers the control outside from current program
(c)  Enforces the next iteration of loop
(d)  Generates compile time error.
Question No: 123
A union is a user-defined data type that contains only _______from its list of members at a time.

(a)  One object
(b)  Two objects
(c)  Three objects
(d)  None of the given options
Question No: 124
The size of int data type is
(a)    1 bytes
(b)   2 bytes
(c)    3 bytes
(d)   4 bytes
Question No: 125
When the logical operator AND (&&) combine two expressions exp1 and exp2 then the result will be true only,
(a)   When both exp1 and exp2 are true
(b)   When both exp1 and exp2 are false
(c)    When exp1 is true and exp2 is false
(d)   When exp1 is false and exp2 is true
Question No: 126
The correct syntax of do-while loop is,
(a)    (condition ) while; do { statements; };
(b)   { statements; } do-while ();
(c)    while(condition); do { statements; };
(d)   do { statements; } while (condition);
Question No: 127
_______________ provide communication channels between files and program.
(a)  Streams
(b)  Language like C++
(c)  Function seekg()
(d)  None of the above
Question No: 128
All elements of an array must be of,
(a)  different data type
(b)  float data only
(c)  character data only
(d)  same data type
Question No: 129
Function seekg() takes ____________ parameter(s).
(a)  0         
(b)  1
(c)  2
(d)  3
Question No: 130
Structures help to define program-specific ___________ .
(a)   functions
(b)   datatypes
(c)    Arithmetic operations
(d)   None of the given options.
Question No: 131
In the declaration of two dimensional array,
(a)   First index represents row and second represents column
(b)   First index represents column and second represents row
(c)    Both indexes represent rows
(d)   Both indexes represent column
Question No: 132
What will be the result of arithmetic expression 6+27/3*3?
(a)   33
(b)   45
(c)    9
(d)   30
Question No: 133
Which of the function call is call by value for the following function prototype?

float area (int);
(a)    area(&num) ;
(b)   area(num) ;
(c)    area(int num) ;
(d)   area(*num) ;
Question No: 134
How many bytes are occupied by declaring following array of characters?
 char str[] = “programming”;
(a)  10
(b)  11
(c)  12
(d)  13
Question No: 135
What will be the correct syntax to assign an array named arr of 5 elements to a pointer ptr?
(a)  *ptr = arr ;
(b)   ptr = arr ;
(c)  *ptr = arr[5] ;
(d)  ptr = arr[5] ; 
Question No: 136
Let ptr1 and ptr2 are pointer variables then which of the following arithmetic operation is allowed on pointers?
(a)  Addition
(b)  Subtraction
(c)  Multiplication
(d)  All of the above
Question No: 137
The variables having a name, type and size are just like empty boxes.
(a)  True
(b)  False
Question No: 138
When break statement is encountered in a loop body it,
(a)  Transfers the control outside from current loop
(b)  Transfers the control outside from current program
(c)  Enforces the next iteration of loop
(d)  Generates compile time error.
Question No: 139
If two programs a and b are trying to open a file xyz.txt at approximately same time then
(a)  Both programs will generate error
(b)  One of them will succeed in opening that file and other will fail
(c)  Both programs will open the file
(d)  One of the program will re-start
Question No: 140
If Num is an integer variable then Num*= 4; means,
(a)    Multiply Num 4 times
(b)   Multiply 4 with Num and display
(c)    Multiply 4 with Num and assign the result to Num
(d)   Add 4 with Num
Question No: 141
Member function tellg() returns the current location of the ­­_____________ pointer.
(a)   tellptr()
(b)   write()
(c)    seekg()
(d)   get()
Question No: 142
If we want to store a string “abc” in an array str then the size of this array must be at least,
(a)   2
(b)   3
(c)    4
(d)   5
Question No: 143
Pointer is a variable which store,
(a)    Values
(b)   Data
(c)    Memory Address
(d)   Data Type
Question No: 144
C is widely known as development language of _______ operating system.
(a) Linux
(b) Windows
(c) Unix
(d) Mac OS
Question No: 145
C++ is a case-sensitive language
(a)   True
(b)   False
Question No: 146
What is the output of the following code?
for (int a = 1; a <= 1; a++) cout << a++; cout << a;
(a)    22
(b)   12
(c)    23
(d)   13
Question No: 147
A continue statement causes execution to skip to
(a)the return 0; statement
(b) the first statement after the loop
(c) the statements following the continue statement
(d) the next iteration of the loop
Question No: 148
If there is more than one statement in the block of a for loop, which of the following must be placed at the beginning and the ending of the loop block?
(a)  parentheses ( )
(b)  braces { }
(c)  brackets [ ]
(d)  arrows < >
Question No: 149
What will be the correct syntax for the following function call?

float square (int &);
(a)   square (int num);
(b)   square (&num);
(c)    square (num);
(d)   square (*num);
Question No: 150
Which of the following is the correct way to assign an integer value 5 to element of a matrix say ‘m’ at second row and third column?
(a)   m[2][3] = 5 ;
(b)   m[3][2] = 5 ;
(c)    m[1][2] = 5 ;
(d)   m[2][3] = ‘5’;
Question No: 151
How many dimensions does n-dimensional array has?
(a)   n dimensions
(b)   2n dimensions
(c)    (n+1) dimensions
(d)   (n-1) dimensions
Question No: 152
Consider the following code segment. What will be the output of following code?
                                  
int addValue (int *a){
int b = (*a) + 2;
return b ;
}  
main () {
int x =6 ;
cout <<  x << “,” ;
cout << addValue(&x) << “,” ;
cout <<  x ;
}         
(a)   6,8,6
(b)   6,6,8
(c)    6,8,8
(d)   6,6,6
Question No: 153
If most significant bit of un-signed number is 1 then it represents a positive number.
(a)   True
(b)   False
Question No: 154
When we declare a multidimensional array the compiler store the elements of multidimensional array in the form of,
(a)    Contiguous memory location
(b)   Matrix
(c)    Columns
(d)   Rows
Question No: 155
What is function of cout ?
(a)    To send data to printer
(b)   To read data from keyboard
(c)    To display message
(d)   To display output on the  screen
Question No: 156
For one byte there are _____ combinations of values that can be stored in computer.
(A)      26
(B)  27
(C)  28
(D)  24
Question No: 157
_______________ provide communication channels between files and program.
(a)    Streams
(b)   Language like C++
(c)    Function seekg()
(d)   None of the above
Question No: 158
The data type before a function name represents its,
(a)   Return Type
(b)   Function data
(c)    Function arguments
(d)   Function name
Question No: 159
In C/C++ language when an array is passed to a function then by default its passing mechanism is,
(a)  Call by value
(b)  Call by Reference
(c)  It depends on type of array
(d)  It depends on the return type of function.
Question No: 160
Array is a data structure which store
(a)    Memory addresses
(b)   Variables
(c)    Data Type
(d)   Data
Question No: 161
If there is more than one statement in the block of a for loop, which of the following must be placed at the beginning and the ending of the loop block?
(a)  parentheses ( )
(b)  braces { }
(c)  brackets [ ]
(d)  arrows < >
Question No: 162
Array is passed by value to a function by default.
(a)    True
(b)   False
Question No: 163
Which of the following is the correct function call having array named student of 10 elements as a parameter.
(a)  addRecord(student[]) ;
(b)  addRecord(student) ;
(c)  addRecord(student[10]) ;
(d)  addRecord(*student) ;
Question No: 164
What will be the correct syntax for initialization of pointer ptr of type int with variable x?
(a)    int ptr = &x ;
(b)   int ptr = x ;
(c)    int *ptr = &x ;
(d)   int ptr* = &x ;
Question No: 165
What will be the correct syntax for initialization of pointer ptr with string "programming"?
(a)    char ptr = ’programming’ ;
(b)   char *ptr = “programming” ;
(c)    char *ptr = ‘programming’ ;
(d)   *ptr = “programming” ;
Question No: 166
The condition in while loop may contain logical expression but not relational expression.
(a)  True
(b)  False
Question No: 167
We want to access array in random order which approach is better?
(a)   Pointers
(b)   Array index
(c)    Both pointers and array index are better
(d)   None of the given options.
Question No: 168
Single line comments explaining code would be preceded like in the following example.
(a)    /*
(b)   //
(c)    /
(d)   //*
Question No: 169
Function write() takes ________________________ as parameter(s).
(a)    String of pointer type
(b)   String and no. of bytes to be written
(c)    Pointer array of characters and delimiter
(d)   String of variable lengths, no. of bytes to be read and flags
Question No: 170
Structure is a collection of ______________ under a single name.
(a)   Only Functions
(b)   Only Variables
(c)    Both Functions and Variables
(d)   None of the given options
Question No: 171
Compiler is a
(a)   System software
(b)   Application Software
(c)    Driver
(d)   Editor
Question No: 172
In while loop the loop counter must be initialized,
(a)    With in the loop
(b)   Before entering the loop
(c)    At the end of the loop
(d)   None of the given options
Question No: 173
If Num is an integer variable then Num*= 4; means,
(a)    Multiply Num 4 times
(b)   Multiply 4 with Num and display
(c)    Multiply 4 with Num and assign the result to Num
(d)   Add 4 with Num
Question No: 174
In C/C++ ,the arguments are passed by _______ to  a function by default .
(a)    reference
(b)   value
(c)    data
(d)   type
Question No: 175
Disks is divided into ____________ with power of__________.
(a)      Chunks, 2n
(b)  Blocks, n2
(c)  Blocks, 2n
(d)  Chunks, n2
Question No: 176
 C is widely known as development language of _______ operating system.
(a)    Linux
(b)   Windows
(c)    Unix
(d)   Mac OS
Question No: 177
Assignment operator ‘=’ is a 
(a)    Unary operator 
(b)   Binary operator
(c)    Ternary operator
(d)   None of the given options
Question No: 178                       
Consider the following code segment. What will be the output of the following program?

int func(int) ;
int num = 10 ;

int main(){
int num ;
num = 5 ;
cout << num ;
cout << func(num) ;
}
int func(int x){
return num ;
}

(a)   5, 5
(b)   10, 5
(c)    5, 10
(d)   10, 10
Question No: 179
Name of an array is a constant pointer.
(a)   True
(b)   False
Question No: 180
What will be the correct syntax to assign an array named arr of 5 elements to a pointer ptr?
(a)  *ptr = arr ; 
(b)  ptr = arr ;
(c)  *ptr = arr[5] ;
(d)  ptr = arr[5] ; 
Question No: 181
If there are 2(n+1) elements in an array then what would be the number of iterations required to search a number using binary search algorithm?
(a)    n elements
(b)   (n+1) elements
(c)    2(n+1) elements
(d)   2(n+1) elements
Question No: 182
In C/C++, null character is represented as
(a)   \n
(b)   \0
(c)    \t
(d)   \r
Question No: 183
How many nested loop would be required to manipulate n-dimensional array?
(a)    2n
(b)   n
(c)    n +1
(d)   n -1
Question No: 184
What will be the correct syntax to access the value of fourth element of an array using pointer ptr?
(a)  ptr[3]
(b)  (ptr+3)
(c)  *(ptr+3)
(d)  Both 1and 3
Question No: 185
Single line comments explaining code would be preceded like in the following example.
(a)  /*
(b)  //
(c)  /
(d)  //*
Question No: 186
If a variable is passed by value to a function and the function makes some changes to that variable then it
(a)   does not affect the original variable
(b)   affects the original variable
(c)    causes syntax error
(d)   None of the given options
Question No: 187
There are mainly -------------------- types of software
(a)   Two
(b)   Three
(c)    Four
(d)   Five
Question No: 188
< ,  <= , > , >=  are called --------------------------- operators.
(a)    Logical
(b)   Arithmetic
(c)    Relational
(d)   Conational
Question No: 189
In order to get 256 from the number 2568 we divide this number by 10 and take,
(a)    Its remainder
(b)   The number
(c)    Its quotient
(d)   Its divisor
Question No: 190
If int x = 10; then the value of x/= 3; will be,
(a)    10
(b)   3
(c)    13
(d)   1
Question No: 191
How many parameter(s) function getline() takes?
(a)    0
(b)   1
(c)    2
(d)   3
Question No: 192
Suppose int multi[5][10];  when we are using **multi , it means,
(a)    Single dereferencing
(b)   Single referencing
(c)    Double referencing
(d)   Double dereferencing
Question No: 193
To access the data members of structure _______ is used.
(a)   dot operator (.)
(b)   * operator
(c)    operator
(d)   None of given.
Question No: 194
There is NO difference between bitwise AND operator (&)  and Logical AND (&&) operator.
(a)   True
(b)   False
Question No: 195
Which of the following data type(s) can operate on modulus operator ‘%’?
(a)   float, int
(b)   float, double
(c)    int
(d)   char
Question No: 196
What's wrong with this while loop?
  while( (i < 10) && (i > 24))

(a)   the logical operator && cannot be used in a test condition
(b)   the while loop is an exit-condition loop
(c)    the while loop is an exit-condition loop
(d)   the test condition is always true
Question No: 197
The switch structure is a _____________construct
(a)    single-selection
(b)   bi-selection
(c)    multiple-selection
(d)   unconditional
Question No: 198
Keyword ‘array’ must be used to declare an array.
(a)   True
(b)   False
Question No: 199
What will be the correct syntax to declare two-dimensional array of float data type?
(a)    float arr{2}{2} ;
(b)   float arr[2][2] ;
(c)    float arr[2,2] ;
(d)   float[2][2] arr ;
Question No: 200
When an array element is passed to a function then this array element is passed to the function,
(a)   By reference
(b)   By data type
(c)    By value
(d)   By data
Question No: 201
Which of the following operator is used to access the value of variable pointed to by a pointer?
(a)  * operator
(b)  -> operator
(c)  && operator
(d)  & operator
Question No: 202
Paying attention to detail in designing a program is _________
(a)    Time consuming
(b)   Redundant
(c)    Necessary
(d)   Somewhat Good
Question No: 203
The remainder (%) operator is
(a)    A logical operator
(b)   An arithmetic operator
(c)    A relational operator
(d)   A division operator
Question No: 204
If  int sum = 10; then the value of the statement  sum = sum + 3 ; is ,
(a)  7
(b)  Illegal statement
(c)  Garbage value
(d)  13
Question No: 205
Which of the following function(s) is/are included in ctype.h header file?
(a)    isdigit(int c)
(b)   isxdigit(int c )
(c)    tolower(int c)
(d)   All of the above
Question No: 206
In C/C++ which of the following header file is used for string manipulation?
(a)   stdlib.h
(b)   string.h
(c)    strings.h
(d)   stype.h
Question No: 207
_______________ provide communication channels between files and program.
(a)    Streams
(b)   Language like C++
(c)    Function seekg()
(d)   None of the above
Question No: 208
______ translates high level language program into machine language code
(a)    Debugger
(b)   Editor
(c)    Compiler
(d)   Linker
Question No: 209
Which of the following data type(s) can operate on modulus operator ‘%’?
(a)  float, int
(b)  float, double
(c)  int
(d)  char
Question No: 210
C++ is a case-sensitive language
(a)  True
(b)  False
Question No: 211
To include code from the library in the program, such as iostream, a directive would be called up using this command.
(a)  #include “iostream.h”
(b)  include <iostream.h>
(c)  include <iostream.h>
(d)  #include <iostream.h>
Question No: 212
What will be the range of numbers generated by function rand () % 9?
(a)    0 to 9
(b)   1 to 9
(c)    0 to 8
(d)   1 to 8
Question No: 213
An array stores the numbers into consecutive memory locations.
(a)   True
(b)   False
Question No: 214
Which of the following is the correct statement for the following declaration?
const int *ptr.
(a)    ptr is a constant pointer
(b)   ptr is constant integer pointer
(c)    ptr is a constant pointer to int
(d)   ptr is a constant pointer to int
Question No: 215
Which of the following header file defines the rand() function?
(a)    iostream.h
(b)   conio.h
(c)    stdlib.h
(d)   stdio.h
Question No: 216
Consider the following code segment. What will be the output of following code?
                                  
int addValue (int *a){
int b = (*a) + 2;
return b ;
}  
main () {
int x =6 ;
cout <<  x << “,” ;
cout << addValue(&x) << “,” ;
cout <<  x ;
}     
(a)   6,8,6
(b)   6,6,8
(c)    6,8,8
(d)   6,6,6
Question No: 217
Identifier is a name that can be given to variables, labels and functions.
(a)   True
(b)   False
Question No: 218
For which array, the size of the array should be one more than the number of elements in an array?
(a)    Int
(b)   Char
(c)    Double
(d)   float 
Question No: 219
In C/C++ language the header file which is used to perform useful task and manipulation of character data is
(e)  cplext.h
(f)   ctype.h
(g)  stdio.h
(h)  delay.h
Question No: 220
The header file which is used for input and output is
(e)  maths.h
(f)   string.h
(g)  iostream.h
(h)  ctype.h
Question No: 221
 Suppose int multi[5][10];  when we are using **multi , it means,
(e)    Single dereferencing
(f)    Single referencing
(g)   Double referencing
(h)   Double dereferencing
Question No: 222
To access the data members of structure _______ is used.
(e)    dot operator (.)
(f)    * operator
(g)   operator
(h)   None of given.
Question No: 223
The precedence of * is higher than dot operator  (.)operator
(c)    True
(d)   False
Question No: 224
Which of the following is the starting index of an array in C++?
(e)  0
(f)   1
(g)  -1
(h)  any number
Question No: 225
When a call to function statement is encountered,
(e)  The control transfers to its Prototype
(f)   The control transfers to its definition
(g)  Control returns to statement following function call
(h)  The compiler stops execution of whole program
Question No: 226
A function must always return value.
(c)  True
(d)  False
Question No: 227
If an array has 100 elements, what is allowable range of subscripts?
(a)    0 – 99
(b)   1 – 99
(c)    0 – 100
(d)   1 – 100
Question No: 228
If a pointer appears on left hand side of an assignment operator then right side of that assignment operator must be,
(e)  Variable name
(f)   Address of variable
(g)  Variable value
(h)  Constant
Question No: 229
Editors are used to compile the code.
(c)    True
(d)   False
Question No: 230
Which bitwise operator returns false if both bits are 1?
(e)  AND
(f)   XOR
(g)  NOT
(h)  OR
Question No: 231
What does !(7) evaluate to in decimal where ! is a NOT operator?
(e)  7
(f)   8
(g)  9
(h)  10
Question No: 232
Structures cannot be passed as Function Parameters
(c)  True
(d)  False
Question No: 233
When break statement is encountered in a loop body it,
(e)  Transfers the control outside from current loop
(f)   Transfers the control outside from current program
(g)  Enforces the next iteration of loop
(h)  Generates compile time error.
Question No: 234
A union is a user-defined data type that contains only _______from its list of members at a time.

(e)  One object
(f)   Two objects
(g)  Three objects
(h)  None of the given options

Question No: 235
The function of cin is
(a)  To display message
(b)  To read data from keyboard
(c)  To display output on the screen
(d)  To send data to printer
Question No: 236
In C/C++ language the header file which is used to perform useful task and
manipulation of character data is
(a)  cplext.h
(b)  ctype.h
(c)   stdio.h
(d)   delay.h
The functions toupper and islower are part of the character handling library <ctype.h>

Question No: 237
Word processor is
(a)  Operating system
(b)  Application software
(c)  Device driver
(d)   Utility software
Question No: 238
For which values of the integer _value will the following code becomes an infinite
loop?
int number=1;
while (true) {
cout << number;
if (number == 3) break;
number += integer_value; }
(a)  any number other than 1 or 2
(b)  only 0
(c)  only 1
(d)  only 2
Rational:
number += integer_value
above line decide the fate of loop so any thing other then zero leads to value of 3 which
will quite the loop. Only zero is the value which keeps the loop infinite.
                                  http://vustudents.ning.com
Question No: 239
Each pass through a loop is called a/an
(a)  enumeration
(b)   Iteration
(c)  culmination
(d)  pass through
Question No: 240
A continue statement causes execution to skip to
(a)  the return 0; statement
(b)  the first statement after the loop
(c)   the statements following the continue statement
(d)  the next iteration of the loop
continue statement is used, when at a certain stage, you don’t want to execute the
remaining statements inside your loop and want to go to the start of the loop.
Question No: 241
What is the correct syntax to declare an array of size 10 of int data type?
(a)  int [10] name ;
(b)  name[10] int ;
(c)  int name[10] ;
(d)  int name[] ;
Question No: 242
Consider the following code segment. What will the following code segment display?
int main(){
int age[10] = {0};
cout << age ;
}
(a)  Values of all elements of array
(b)  Value of first element of array
(c)  Starting address of array
(d)  Address of last array element
Question No: 243
What will be the correct syntax to initialize all elements of two-dimensional array to
value 0?
(a)  int arr[2][3] = {0,0} ;
(b)  int arr[2][3] = {{0},{0}} ;
(c)  int arr[2][3] = {0},{0} ;
(d)   int arr[2][3] = {0} ;
Question No: 244
How many bytes will the pointer intPtr of type int move in the following statement?
intPtr += 3 ;
(a)  3 bytes
(b)  6 bytes
(c)  12 bytes
(d)  24 bytes
one int is 4 bytes so 4*3 = 12 bytes movement.
Question No: 245
Which of the following operator is used to access the value of variable pointed to by a
pointer?
(a)  * operator
(b)  -> operator
(c)  && operator
(d)  & operator
Question No: 246
The ________ statement interrupts the flow of control.
                                    http://vustudents.ning.com
(a)  switch
(b)  continue
(c)  goto
(d)  break
Question No: 247
Analysis is the -------------- step in designing a program
(a)   Last
(b)  Middle
(c)  Post Design
(d)  First
analysis will be always followed by design and then code.
Question No: 248
Paying attention to detail in designing a program is _________
(a)   Time consuming
(b)   Redundant
(c)   Necessary
(d)   Somewhat Good
In programming, the details matter. This is a very important skill. A good programmer
always analyzes the problem statement very carefully and in detail. You should pay
attention to all the aspects of the problem.
Question No: 249
A precise sequence of steps to solve a problem is called
(a)   Statement
(b)   Program
(c)   Utility
(d)   Routine
Question No: 250
The Compiler of C language is written in
(a)   Java Language
(b)   UNIX
(c)   FORTRON Language
(d)   C Language
The C language is so powerful that the compiler of C and other various operating systems are written in C.
Question No: 251
Initialization of variable at the time of definition is,
(a)   Must
(b)   Necessary
(c)   Good Programming
(d)   None of the given options
Question No: 252
In if structure the block of statements is executed only,
(a)   When the condition is false
(b)   When it contain arithmetic operators
(c)   When it contain logical operators
(d)   When the condition is true
Question No: 253
Which of the following function(s) is/are included in stdlib.h header file?
(a)   double atof(const char *nptr)
(b)   int atoi(const char *nptr)
(c)   char *strcpy ( char *s1, const char *s2)
(d)   1 and 2 only
Question No: 254
Dealing with structures and functions passing by reference is the most economical method
(a)   True
(b)   False
Question No: 255
Pointer is a variable which store,
(a)   Data
(b)   Memory Address
(c)   Data Type
(d)   Values
Question No: 256
Preprocessor program perform its function before ______ phase takes place.
(a)   Editing
(b)   Linking
(c)   Compiling
(d)   Loading
The C preprocessor modifies a source code file before handing it over to the compiler. You're most likely used to using the preprocessor to include files directly into other files,
Question No: 257
Which of the following can not be a variable name?
(a)   area
(b)   _area
(c)   10area
(d)   area2
Question No: 258
Which looping process is best, when the number of iterations is known?
(a)   for
(b)   while
(c)   do-while
(d)   all looping processes require that the iterations be known
Question No: 259
Which character is inserted at the end of string to indicate the end of string?
(a)   new line
(b)   tab
(c)   null
(d)   carriage return
null character inserted at the end of the string by C automatically
Question No: 260
How many bytes are occupied by declaring following array of characters?
char str[] = “programming”;
(a)   10
(b)   11
(c)   12
(d)   13
11 plus one for null char (11+1= 12)
Question No: 261
Which of the following header file defines the rand() function?
(a)   iostream.h
(b)   conio.h
(c)   stdlib.h
(d)   stdio.h
The function is rand() and is in the standard library. To access this function, we need to include <stdlib.h> library in our program. This function will return a random number. The number can be between 0 and 32767.
Question No: 262
Commenting the code _____________________
(a)   Makes a program easy to understand for others.
(b)   Make programs heavy, i.e. more space is needed for executable.
(c)   Makes it difficult to compile
(d)   All of the given options.
Question No: 263
What's wrong with this for loop?
for (int k = 2, k <=12, k++)
(a)   the increment should always be ++k
(b)   the variable must always be the letter i when using a for loop
(c)   there should be a semicolon at the end of the statement
(d)   the commas should be semicolons
Question No: 264
For which array, the size of the array should be one more than the number of elements in an
array?
(a)   int
(b)   double
(c)   float
(d)   char
Question No: 265
There are mainly------------------- types of software
(a)  Two
(b)  Three
(c)  Four
(d)  Five
Software is categorized into two main categories
ü  System Software
ü  Application Software
Question No: 266
In C/C++ the #include is called,
(a)  Header file
(b)  Preprocessor Directive
(c)  Statement
(d)  Function
Question No: 267
&& is------------------ operator.
(a)  An arithmetic
(b)  Logical
(c)  Relational
(d)  Unary
we use logical operators ( && and || ) for AND and OR respectively with relational
operators.
Question No: 268

In flow chart, the symbol used for decision making is,
(a)  Rectangle
(b)  Circle
(c)  Arrow
(d)  Diamond
Question No: 269
The correct syntax of do-while loop is,
(a)  (condition ) while; do { statements; };
(b)  { statements; } do-while ();
(c)  while(condition); do { statements; };
(d)  do { statements; } while (condition);
Question No: 270
C++ views each file as a sequential stream of________________ .
(a)  Bytes
(b)  Bits
(c)  0’s or 1’s
(d)  Words
Question No: 271
If the elements of an array are already sorted then the useful search algorithm is,
(a)  Linear search
(b)  Binary search
(c)  Quick search
(d)  Random search
In binary search algorithm, the ‘divide and conquer’ strategy is applied.
This plies only to sorted arrays in ascending or descending order.
Question No: 272
The address operator (&) can be used with,
(a)  Statement
(b)  Expression
(c)  Variable
(d)  Constant
Question No: 273
When a pointer is incremented, it actually jumps the number of memory addresses
(a)  According to data type
(b)  1 byte exactly
(c)  1 bit exactly
(d)  A pointer variable can not be incremented
Question No: 274
Each pass through a loop is called a/an
(a)  enumeration
(b)  iteration
(c)  culmination
(d)  pass through
Question No: 275
Call by reference mechanism should be used in a program when there is
i. large amount of data to be passed
ii. small amount of data to be passed
iii. need to change the passed data
iv. no need to change the passed data
Choose the appropriate option for the above case.
(a)  (i) and (ii) only
(b)  (i) and (iii) only
(c)  (ii) and (iii) only
(d)  (ii) and (iv) only
Question No: 276
Which of the following is the starting index of an array in C++?
(a)  0
(b)  1
(c)  -1
(d)  any number
Question No: 277
The return type of a function that do not return any value must be __________
(a)  int
(b)  void
(c)  double
(d)  float
Question No: 278
Which of the following is an extension of header file?
(a)  .exe
(b)  .txt
(c)  .h
(d)  .c
Question No: 279
We want to access array in random order which approach is better?
(a)  Pointers
(b)  Array index
(c)  Both pointers and array index are better
(d)  None of the given options.
Question No: 280
When we declare a multidimensional array the compiler store the elements of
multidimensional array in the form of,
(a)  Columns
(b)  Rows
(c)  Contiguous memory location
(d)  Matrix