Languages [3i Infotech Placement]: Sample Questions 473 - 475 of 546

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

Question 473

Write in Short Short Answer▾

What is the output of the following program?

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

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 474

Describe in Detail Essay▾

What modifiers may be used with an inner class that is a member of an outer class?

Edit

Explanation

Understanding of Inner Class and Outer Class
  • Inner classes is a full-fledged member of the enclosing class.
  • Can be marked with any access modifier including abstract or final modifiers.
  • But an inner class cannot contain any static members.

Syntax of Inner Class

Class outer_demo

{

Class nested_demo

{

}

}

Question 475

Write in Short Short Answer▾

What are the underlying concepts of object orientation?

Edit

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