Tag: technology

Questions Related to technology

  1. itemMap.remove("orange"); itemMap.put("orange", new Item("Orange") );

  2. ((Item)itemMap.get(“orange”)).name = “Orange”;

  3. itemMap.put("orange", new Item("Orange") );

  4. None of above


Correct Option: B
  1. code attribute cannot be changed as Item class doesn’t have setter method for it.

  2. for (int i = 0; i < itemList.size(); i++) { if(itemList.get(i) != null) { ((Item)itemList.get(i)).code = 50+i; } }

  3. int i = 0; Item im = null; while (i < itemList.size()) { im = (Item)itemList.get(i); if(im != null) { im.code = 50+i; } i++; }

  4. int i = 0; Item im = null; Iterator itr = itemList.iterator(); while (itr.hasNext()) { im =(Item) itr.next(); im.code = 50+i; i++; }


Correct Option: D
  1. Function call:- changeName(im); Function implementation :- { im.name = "Done"; return null; }

  2. Function call:- changeName(im); Function implementation :- { im = new Item("Done"); return null; }

  3. Function call :- im = changeName(im); function implementation :- { Item otherObject = new Item("Done"); return otherObject; }

  4. All of the above


Correct Option: B

Which is simplest code snippet you will add in the main function to set the name attribute of 50th in the ItemList to “Done”?

  1. im.name = "Done";

  2. Item otherObject = new Item(“Done”); itemList.set(49, otherObject);

  3. ((Item)itemList.get(49)).name = “Done”;

  4. None of above is correct as they are not changing 50th element.


Correct Option: A

Which of the given options code is correct and will not waste memory. Note :- Defination of the Class Item is class Item { public int code; public String name; public Item(String name) { this.name = name; } } itemList is ArrayList containing 50 objects of Class Items.

  1. Item im = new Item(null); im = (Item ) itemList.get(0);

  2. Item im = new Item(“Done”); im = (Item ) itemList.get(0);

  3. Item im = null; im = (Item ) itemList.get(0);

  4. All of the above.


Correct Option: C

How to multiply the VAT factor .12 with the bought product costs (pos 25-30) in the PRODUCT file and copy to the FINAL file? The file length is 215.

  1. SORT FIELDS=COPY OUTREC FIELDS=(1:1,24,25,6,ZD,MUL,+0.97,TO=ZD,LENGTH=6,31:31,185)

  2. SORT FIELDS=COPY OUTREC FIELDS=(1:1,24,25,6,ZD,MUL,+97,DIV,+100,TO=ZD,LENGTH=6,31:31,185)

  3. SORT FIELDS=COPY OUTREC FIELDS=(1:1,24,25,6,ZD,DIV,+100,MUL,+97,TO=ZD,LENGTH=6,31:31,185)

  4. All of the above


Correct Option: B,C

How to copy the eliminated duplicate records into another file wherein the SORT happens on the 1st 3 characters of the file?

  1. SORT FIELDS=(1,3,CH,A) SUM FIELDS=NONE OUTFILE FNAME = F2

  2. SORT FIELDS=(1,3,CH,A) SUM FIELDS=NONE,XSUM

  3. SORT FIELDS=(1,3,CH,A) SUM FIELDS=NONE COPY = F2

  4. None of the above


Correct Option: B

By using _________ statement, data can be sorted in a file between headers and trailers.

  1. DATASORT

  2. SUBSET

  3. both a and b

  4. None of the above


Correct Option: A