CS201  MIDTERM  MCQS  MEGA  FILE   MIDTERM  PREPARATION  100%  CORRECT BY  knowledge 




QUESTION:

The  value  of  a  pointer  can  be

= value  of  variable

 

QUESTION:

Following  is  the   declaration  of  a  ---------------- array  int  arr

[2][2][2]

= 3 dimensional

 

QUESTION:

What  will  be  output  for  ( int   I = 2  I < 10 . i++ )

{

 If ( I == 5 )

Continue

Cout  << I << ‘’ .’’ ;

}

= 2,3,4,6,7,8,9

 

QUESTION:

The  ------------------  is  an  unconditional  branch  of  execution 

 = goto  statement

 

 

QUESTION:

----------------  characters  is  used  to  indicate  the  end   of  a  string

=  null 

 

QUESTION:

 In  two  dimensional  array  we  use  -------------  for  loops   to  populate  the  array

= 2

 

QUESTION:

Function  prototype  is  written  as 

= before  call  of  function

 

QUESTION:

We  can  define  a  matrix  as ------------  array

=  multi  dimensional

 

QUESTION:

How  many  times  do  while   execute 

Int  k  = 10 

Do

{ cout <<  ‘’statement’’ << end;

k-=2}  while ( k >  0 ) ;

= 6

 

QUESTION:

When   we  call  a  function   its  control

= transfers  to  its  definition  

 

QUESTION:

 ----------------  keyboard   is used  to  return  some  value  from  a  function

= return

 

QUESTION:

Char  name   =  ‘’hello  world ‘’

In   the  above  statement   a  memory  of  ---------------------  characters  will  be  allocated  

= 12

 

QUESTION:

The  name   of  array  is  a  constant  pointer  which  contains   the   memoray  address  of 

=  first  element   of  array 

 

QUESTION:

Following   is  an  array  of  ---------------- rows  and  ---------------  columns  int  num  [3[4]

=3,4

 

QUESTION:

For  the  following  given  function prototype  int  add  ( int)

  Which  one  of  the  function  calls  is  ‘’ call  by  reference ‘’

= add  (&x);

 

QUESTION:

From  the  following  which  one  is  the  correct  syntax  of  an  array  declaration  array  size  is  5  and  it  is  of  float  data  type

=  float name[5]

 

QUESTION:

A  function  is  a  block  of  statement  that  can  be  defined  once  and  used  ---------  in the  program

= as  many  times  user  wants

 

QUESTION:

Data  means 

= the  value  of  whatever  the  data  points  to

 

QUESTION:

From   the  following   which  one  is  the  range  of  random  number  generator  function  rand  ()

=  0 -  32767

 

QUESTION:

When  we  call  a  function  its  control

=  transfer

 

 

QUESTION:

Suppose  we  have  int  y 10] ;

To  access  the  4th  element  of  the  array  we  write ----------------

= Y [ 3 ]

 

QUESTION:

The  string  is  the  array  is  the  terminated  by  a  ------------------------- 

= null

 

QUESTION:

Individual  characters  in   a  string   stored  in  an  array  can  be  accessed  directly 

Using   array  -------------------

=  subscrip

 

QUESTION:

Function  prototype  is  written  ------------------

= before  call  of  that  function 

 

QUESTION:

What   will  be  the  output  of  the  following  code

String  name  [ 4 ]  =  {  ‘’  ali ‘’ ‘’bilal’’  ‘’omer’’  ayesha’’  }  cout << name  [ 0  ]

= omer

 

QUESTION:

For  breaking   complex   problems  into  smaller  pieces  we  use 

=  function 

 

QUESTION:

what  will  be  correct  syntax 

‘’  ptr  is  a  constant  pointer  to  an  integer  ‘‘

=  int  ‘’ const  ptr  ;

 

QUESTION:

---------  is  a  substitute  of  multiple  if  statement 

= if  else  if  statement

 

QUESTION:

When  the  break  statement  is  encountered  in  a  loops  body  it  transfers  the   control  ------------------  from   the  current  loop

= outside

 

QUESTION:

When    an   identifier  is  declared   with  keyword  const  then 

= its  value  cannot  be  changed

 

QUESTION:

If    x = 11     and     x% = 3  then  value  of  x  will  be  ----------

= 3

 

QUESTION:

How  can  we  declare  an  array  of  characteristics   whose   size   is  12  with   array  name   ‘’  country ‘’

= char  country  [11]

 

QUESTION:

 ASCII    CODE  OF  NULL  CHARACTERS  IS 

= 000

 

QUESTION:

To  manipulate  n-dimensional  array --------   nested  loops  are  required 

= n

 

QUESTION:

What  will  be  the  size  of  following  array  29

= 30

 

QUESTION:

For  breaking  complex  problems  into  smaller  pieces  we  us e  ---------------

= functions 

 

QUESTION:

In  analysis  try  to  have  a  -----------------

= precise  problems  statement

 

QUESTION:

X   is  an  integer  variable  what  does  x++  means 

= add  1  in  a  value 

 

QUESTION:

All   elements  of  an  array  must  be  of  -------------  data  types [s]

= same 

 

QUESTION:

-----------------  will  be  used   for  enclosing  function  statements   into  a  block

= { }

QUESTION:

All  the  ------ we  try      to     break   up   the   problems   into   functional      units 

=  design  phase 

 

QUESTION:

Pointers   are  a   special  type  of  ---------------  in  which   memory  address  is   stored

=  variable

 

QUESTION:

WHAT  is  the  correct  syntax  to  declare  any  15   elements  of  type  float

= float  array {14}

 

QUESTION:

From  the  following  which  one  is  the  correct  syntax  of  an  array  size  is  5  and  it  is  of  float  data  type

= float  name   [  5  ]

 

QUESTION:

Which   of  the  following  c++  statement  is  used  to  take  input  from   the  user

=  cin

 

 

QUESTION:

Which   of  the   following   is   an  example  of  logical   operator

= ||  ,  &&

 

 

QUESTION:

The   coding  of  a  program   is  translated    into  machine  language  by  --------------

=  compiler

 

 

QUESTION:

In  c/c++   which   of   the  following  data   type     is  used  to  store  real  numbers

= float

 

QUESTION:

Base  address  is  the  memory   address  ------------  element  of  an  array

= 1st

 

 

QUESTION:

Eof   is  used   to  check  for  the  ---------------  of  file   when   a  file  is  being  read

=  end

 

QUESTION:

While  handling  files  one  can  have  -------------  options

= all  of  top

 

QUESTION:

------------------  returns   true   if   c  is  a  letter   and   false   other  wise

=  int  isalpha ( int c  )

 

QUESTION:

What   will  be   the  size  of  the  following  array  int  arr  [ 29 ]

=  30

 

QUESTION:

Individual characters in a string stored in an array can be accessed directly using array __________.

= subscript subscript

 

 

QUESTION:

By default, the starting index of an array in C++ is __________ .

= 0

 

QUESTION:

dereferencing operator is represented by------------------

= *

 

QUESTION:

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

= float name[5];

 

QUESTION:

__________ is the pointer which determines the position in a file from where the next read operation occurs

= Tell