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


Describe in Detail


Have you ever used Hash table and directory?


Hash Table

  • Yes, we have ever used hash table in java.
  • It is an implementation of the key value pair of the data structure in the java.
  • Offers similar performance as arrays with numerical indices, but flexible in terms of key.


  • The concept of a directory in java can be accomplished using the file class.
  • This class provide listFile method whihc returns list File object for directory.
  • Represents file or subdirectories.

Question 497


Write in Short

Short Answer▾

Which bit wise operator is suitable for turning off a particular bit in a number?


  • The bitwise AND operator.

Function syntax:

BitAND (number1, number2)

  • Number1 is defined as 32-bit signed integer and number2 is also defined as 32-bit signed integer.
  • Bit functions operate on 32-bit signed integers, in the range -2147483648 - 2147483647.

Question 498


Describe in Detail


What is the output of the following program?

  1. #include<stdio.h>
  2. main ()
  3. {
  4.     intx, y =2, z, a;
  5.     if (x =y%2) z =2;
  6.     a =2;
  7.     printf ( “%d %d” z, x);
  8. }


  • In the program
Table Shows the Program
int x, y = 2, z, a;Declare and define the integer variables x, z, a and y = 2
if (x = y % 2) z = 2;
  • The value of y % 2 (remainder) is 0.
  • This is assigned to x.
  • The condition reduces to if (x) or in other words if (0) and z goes in initialized.
printf ( “% d % d” z, x) ;Printf prints the garbage value of z and x as 0
  • Thumb rule: check all control paths to write bug free code.

Developed by: