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

Edit

Describe in Detail

Essay▾

What is the output of the program given below

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

Explanation

  • In the program define the signed char
  • Signed char represents integers from -128 to 127.
Table Shows the Program
signed char i = 0;
  • Define the signed character variable i = 0
for (; i >= 0; i ++) ;
  • The semicolon at the end of the for loop.
  • The initial value of the i is set 0.
  • The inner loop executes to increment the value from 0 to 127 (the positive range of char) and then it rotates to the negative value of -128.
  • The condition in the for loop fails and so comes out of the for loop.
printf ( “% d” i) ;
  • It prints the current value of I that is -128.
The Signed and Unsigned Char Type

Question 277

Write in Short

Short Answer▾

How many memory locations can be addressed by a microprocessor with dress lines?

Explanation

  • No of memory locations that can be addressed is to the power of no of address lines.
  • Thus.

Question 278

Languages

Appeared in Year: 2004

Question

MCQ▾

What happens if Database Updation code is written in ejb Passivate () method and if this method is called?

Choices

Choice (4)

a.

Successfully executes the Database Updation code

b.

Compilation error occurs indicating that Database Updation code should not be written in ejbPassivate ()

c.

Ejb Store () method is called

d.

Exception is thrown

Answer

c.

Explanation

  • Ejb Passivate method is called when it is necessary to synchronize the bean data with the database.
  • This will most likely trigger an UPDATE to occur.
  • The ejb Store is triggered when the bean is no longer being used by a client and the container decides to move the ready instance back into the pooled state. nullejbLoad method: ejb Store method:
  • Database Updation code is written in ejb Passivate () method and this method is called in ejb Store () .
    • Vendor implementations may differ slightly as to when the ejb Store () method is called, but this is not the bean developer՚s concern.
    • The ejb Store () method will be called after one or more business methods have been invoked or at the end of a transaction.

Developed by: