Languages-C & C Plus Plus [3i Infotech Placement]: Sample Questions 342 - 344 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 342

C & C Plus Plus
Edit

Describe in Detail

Essay▾

Differentiate Aggregation and containment?

Explanation

  • Aggregation:-
    • Aggregation is the relationship between the whole and a part. Some properties can be added or subtracted from part without affecting the whole.
    • Best example is Car, which contains the wheels and some extra parts. Even if parts are not there it can still be called a car.
  • Containment:-
    • In containment whole is affected when the part is affected.
    • For example: human body dies if the parts (heart etc) die.

Question 343

C & C Plus Plus
Edit

Write in Short

Short Answer▾

What is the output of the following program?

  1. main ()
  2. {
  3.     inti =5;
  4.     printf ( “%d” ,++ i ++ );
  5. }

Explanation

Compiler error: L value required in function main

In the program

Table Shows the Program
int i = 5;
  • Given the integer variable i = 5
printf ( “% d” , ++ i ++) ;
  • Here ++ I yields an rvalue.
  • For postfix ++ to operate an lvalue (left hand side value or an memory location) is required.

Question 344

C & C Plus Plus
Edit

Write in Short

Short Answer▾

What is function that extracts a sub string from a given string?

Explanation

  • Substring (string, position [, count] )
  • Extract substring starting from start and going for count characters.
  • If count is not specified, the string is clipped from the start till the end

Developed by: