Languages-C & C Plus Plus [3i Infotech Placement]: Sample Questions 266 - 268 of 354

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

Question 266

C & C Plus Plus
Edit

Describe in Detail

Essay▾

Difference between realloc () and free?

Explanation

Difference between Realloc () and Free
reallocfree
Used to reset allocated memory size.Used to destroy allocated memory size.
Used when memory already created is sufficient.The memory was already created.
Invalid pointer parameter will produce unexpected results.The pointer parameter created using calloc () or realloc () routines and should not deallocated with free.

Question 267

C & C Plus Plus
Edit

Describe in Detail

Essay▾
  1. main ()
  2. {
  3.     inti =3;
  4.     switch (i)
  5.     {
  6.         default:Printf ( “zero” );
  7.         case1:Printf ( “one” );
  8.         break;
  9.         case2:Printf ( “two” );
  10.         break;
  11.         case3:Printf ( “three” );
  12.         break;
  13.     }
  14. }

Explanation

In a program

Table Shows the Program
int i = 3Integer variable i = 3
switch (i)

{

default: Printf ( “zero” ) ;

case 1: Printf ( “one” ) ;

break;

case 2: Printf ( “two” ) ;

break;

case 3: Printf ( “three” ) ;

break;

}

The switch corresponding case 3 (since i = 3) is selected

And as there is a break statement after it.

It comes out of the loop

And answer is three

Question 268

C & C Plus Plus
Edit

Describe in Detail

Essay▾

When does a name clash occur?

Explanation

  • A name clash occurs when a name “a” is defined in more than one place.
  • For example, two different class libraries could give two different classes the same name.
  • Program using many class libraries at the same time might be unable to compile or link because of name clashes.
Avoiding Name Clashes

Developed by: