3i Infotech Placement: Sample Questions 21 - 22 of 1245

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

Question 21

Edit

Describe in Detail

Essay▾

What is lightweight component?

Explanation

Understanding of Lightweight Components
  • Swing components depend less on the target platform and use less of the native GUI resource.
  • The swing components that do not rely on native GUI are referred to as lightweight components- no native screen resource of their own, so ‘lighter’ .
  • Lightweight components rely on the screen resource from an ancestor in the containment hierarchy, possibly the underlying frame object.
  • They subclass java. awt. component directly implementing the look and feel of the component in java.
  • They efficiently utilize system resource, can be transparent and not be rectangular.
  • LightweightPanel class that subclasses Container can also be used.

Question 22

Edit

Describe in Detail

Essay▾

What is the output of the following program?

  1. #defineprod (a, b) a ⚹b
  2. main ()
  3. {
  4.     intx =3, y =4;
  5.     printf ( “%d” prod (x +2, y − 1) );
  6. }

Explanation

In the program

Table Shows the Program
prod (a, b) a ⚹ bDefine the globally declared macro
int x = 3, y = 4;Define the integer variable x and y with values 3 and 4
printf ( “% d” prod (x + 2, y − 1) ) ;The macro expands and evaluates as:

x + 2 ⚹ y-1

x + (2 ⚹ y) -1

3 + (2 ⚹ 4) -1

3 + 8 - 1

11 - 1

10

Developed by: