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

Edit

Write in Short

Short Answer▾

What is the output of the following program?

  1. #include<stdio.h>
  2. main ()
  3. {
  4.     registeri =5;
  5.     charj[] =“hello” ;printf ( “%s %d” j, i);
  6. }

Explanation

  • In the program
Table Shows the Program
register i = 5;i value may be stored either in register or in memory
char j [] = “hello” ;j is a character array
printf ( “% s % d” j, i) ;
  • printf ( “% s” , j) ; prints hello 5
  • J is a array containing base address of first element of array.
  • Register i treated simple integer
  • So the answer is hello 5.

Question 59

Edit

Write in Short

Short Answer▾

What are the conditions that have to be met for a condition to be an invariant of the class?

Explanation

  • The condition should hold at the end of every constructor.
  • The condition should hold at the end of every mutator (non-const) operation.

Question 60

Languages
Edit

Describe in Detail

Essay▾

Why there are some null interfaces in java? What does it mean? Give some null interface in JAVA?

Explanation

  • Null interfaces (or marker interfaces) mark the class that implements them.
  • When the JVM looks at a class it allows it to call certain methods based on markers.
  • All classes which inherit a class are able to call its methods.
  • However like virtual classes in C ++ all the functions of marker or null interface have to be implemented.

Some null interface in java:

Null Interface in Java

Developed by: