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

C & C Plus Plus
Edit

Write in Short

Short Answer▾

What is the output of the following program?

  1. main ()
  2. {
  3.     unsignedchari =0;
  4.     for (; i>= 0; i ++ );
  5.     printf ( “%d” i);
  6. }

Explanation

  • Define the unsigned char
  • Unsigned character represents only + ve value from 0 to 255.
Table Shows the Program
unsigned char i = 0;
  • Define the unsigned character variable i = 0
for (; i >= 0; i ++) ;
  • Here char is declared to be unsigned.
  • So the i ++ can never yield negative value and i > 0 never becomes false
printf ( “% d” i) ;
  • So that it can come out of the for loop.

Question 302

C & C Plus Plus
Edit

Write in Short

Short Answer▾

What are the underlying concepts of object orientation?

Explanation

  • Four concepts for OOAD are.
  • Abstraction -grouping of data and behavior (operations) into a conceptual object.
  • Encapsulation -Implementation mode of data abstraction with encapsulation to accomplish data hiding
  • Polymorphism -Process by which object invokes a method of another object in a common manner (with the same name) without understanding or caring how it is accomplished.
  • Inheritance-Object derived from another object inherits all the properties etc
Given the Image is the Concept of Object Orientation

Developed by: