3i Infotech Placement: Sample Questions 636 - 638 of 1245

Glide to success with Doorsteptutor material for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 636

Question

MCQ▾

A Vector is declared as follows. What happens if the code tried to add 6th element to this Vector new vector

Choices

Choice (4)

a.

Array Index Out Of Bounds Exception

b.

The element will be successfully added

c.

The Vector allocates space to accommodate up to elements

d.

Question does not provide sufficient data or is vague

Answer

b.

Explanation

  • The 1st argument in the constructor is the initial size of Vector.
  • The 2nd argument in the constructor is the growth in size.
  • This Vector is created with elements and when an extra element 6th is added, the vector automatically grows in size by

Question 637

Edit

Write in Short

Short Answer▾

Name the operators that cannot be overloaded.

Explanation

  • Scope Resolution operator (::)
  • Pointer to member operator (. ⚹)
  • Member Access or Dot operator (.)
  • Ternary or Conditional operator (? :)
  • Object size operator (sizeof)
  • Object type operator (typeid)

Question 638

Edit

Describe in Detail

Essay▾
  1. main ()
  2. {
  3.     externinti;
  4.     i =20;
  5.     printf ( “%d” sizeof (i) );
  6. }

Explanation

  • In a program,
    Table Showing the Program
    extern int i;Extern declaration specifies that the variable i is defined somewhere else.
    i = 20;

    printf ( “% d” sizeof (i) ) ;

    The compiler passes the external variable to be resolved by the linker.

    So compiler doesn՚t find an error.

  • During linking the linker searches for the definition of i.
  • Since it is not found the linker flags an error

Developed by: