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

Describe in Detail Essay▾

Difference between realloc () and free?

Edit

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

Describe in Detail Essay▾

  1. main ()
  2. {
  3. int i =3;
  4. switch (i)
  5. {
  6. default:Printf ( “zero” );
  7. case 1:Printf ( “one” );
  8. break;
  9. case 2:Printf ( “two” );
  10. break;
  11. case 3:Printf ( “three” );
  12. break;
  13. }
  14. }
Edit

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

Describe in Detail Essay▾

When does a name clash occur?

Edit

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