Languages [3i Infotech Placement]: Sample Questions 145 - 146 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 145

Edit

Describe in Detail

Essay▾

What is the output of the following program?

  1. main ()
  2. {
  3.     inta[ ] ={ 10, 20, 30, 40, 50}, j, ⚹p;
  4.     for (j =0; j<5; j ++ )
  5.     {
  6.         printf (%d, ⚹a);
  7.         a ++;
  8.     }
  9.     p =a;
  10.     for (j =0; j<5; j ++ )
  11.     {
  12.         printf (%d, ⚹p);
  13.         p ++;
  14.     }
  15. }

Explanation

Compiler error: Lvalue required.

In a program

Table Shows the Program
int a [] = {10, 20, 30,40, 50} , j, ⚹ p;Define the integer array a [] , j variable and also int pointer p.
for (j = 0; j < 5; j ++)

{

printf (% d, ⚹ a) ;

a ++ ;

}

Applies the for loop

Error is in line with statement a ++ .

The operand must be an Lvalue and may be of any of scalar type for the any operator- array name only when subscribed is an Lvalue.

(An lvalue is an object that persists beyond a single expression- an object that has a name. Lvalue includes all variables, including non modifiable (const) variables)

Simply array name is a non-modifiable Lvalue

Define the Lvalue of Expression

Question 146

Languages
Edit

Write in Short

Short Answer▾

What is the base class for all swing components?

Explanation

  • Swing components are derived from abstract javax. swing. Jcomponet class.
  • Which has following hierarchy:

java. lang. Object

java. awt. component

java. awt. container

javax. swing. jcomponent

It replaces selection of AWT GUI components.

Developed by: