欧美另类日韩中文色综合,天堂va亚洲va欧美va国产,www.av在线播放,大香视频伊人精品75,奇米777888,欧美日本道免费二区三区,中文字幕亚洲综久久2021

浙大網(wǎng)新中研軟件開發(fā)工程師筆試題

時間:2024-10-06 01:49:15 資料大全 我要投稿
  • 相關推薦

浙大網(wǎng)新中研軟件開發(fā)工程師筆試題

  選擇題

浙大網(wǎng)新中研軟件開發(fā)工程師筆試題

  1: Consider the class hierarchy shown below:

  ——————————————————————–

  class FourWheeler implements DrivingUtilities

  class Car extends FourWheeler

  class Truck extends FourWheeler

  class Bus extends FourWheeler

  class Crane extends FourWheeler

  ———————————————————————-

  Consider the following code below:

  1.DrivingUtilities du;

  2.FourWheeler fw;

  3.Truck myTruck = new Truck();

  4.du = (DrivingUtilities)myTruck;

  5.fw = new Crane();

  6.fw = du;

  Which of the statements below are true?

  Choices:

  A.Line 4 will not compile because an interface cannot refer to an object.

  B.The code will compile and run.

  C.The code will not compile without an explicit cast at line 6, because going down the hierarchy without casting is not allowed.

  D.The code will compile if we put an explicit cast at line 6 but will throw an exception at runtime.

  2:A class design requires that a member variable should be accessible only by same package, which modifer word should be used?

  A.protected

  B.public

  C.no modifer

  D.private

  3:

  What is the result when you compile and run the following code?

  public class ThrowsDemo

  {

  static void throwMethod()

  {

  System.out.println(“Inside throwMethod.”);

  throw new IllegalAccessException(“demo”);

  }

  public static void main(String args[])

  {

  try

  {

  throwMethod();

  }

  catch (IllegalAccessException e)

  {

  System.out.println(“Caught ” + e);

  }

  }

  }

  Choices:

  What is the result when you compile and run the following code?

  public class ThrowsDemo

  {

  static void throwMethod()

  {

  System.out.println(“Inside throwMethod.”);

  throw new IllegalAccessException(“demo”);

  }

  public static void main(String args[])

  {

  try

  {

  throwMethod();

  }

  catch (IllegalAccessException e)

  {

  System.out.println(“Caught ” + e);

  }

  }

  }

  Choices:

  A.Compilation error

  B.Runtime error

  C.Compile successfully, nothing is printed.

  D.Inside throwMethod. followed by caught:java.lang.IllegalAccessExcption: demo

  4:

  In the following code, which is the earliest statement, where the object originally held in e, may be garbage collected:

  1.public class Test {

  2. public static void main (String args []) {

  3. Employee e = new Employee(“Bob”, 48);

  4. e.calculatePay();

  5. System.out.println(e.printDetails());

  6. e = null;

  7. e = new Employee(“Denise”, 36);

  8. e.calculatePay();

  9. System.out.println(e.printDetails());

  10. }

  11.}

  Only One:

  In the following code, which is the earliest statement, where the object originally held in e, may be garbage collected:

  1.public class Test {

  2. public static void main (String args []) {

  3. Employee e = new Employee(“Bob”, 48);

  4. e.calculatePay();

  5. System.out.println(e.printDetails());

  6. e = null;

  7. e = new Employee(“Denise”, 36);

  8. e.calculatePay();

  9. System.out.println(e.printDetails());

  10. }

  11.}

  Only One:

  A.Line 10

  B.Line 11

  C.Line 7

  D.Line 8

  5:

  What will be the result of executing the following code?

  public static void main(String args[])

  {

  char digit = ‘a’;

  for (int i = 0; i < 10; i++)

  {

  switch (digit)

  {

  case ‘x’ :

  {

  int j = 0;

  System.out.println(j);

  }

  default :

  {

  int j = 100;

  System.out.println(j);

  }

  }

  }

  int i = j;

  System.out.println(i);

  }

  Choices:

  What will be the result of executing the following code?

  public static void main(String args[])

  {

  char digit = ‘a’;

  for (int i = 0; i < 10; i++)

  {

  switch (digit)

  {

  case ‘x’ :

  {

  int j = 0;

  System.out.println(j);

  }

  default :

  {

  int j = 100;

  System.out.println(j);

  }

  }

  }

  int i = j;

  System.out.println(i);

  }

  Choices:

  A.100 will be printed 11 times.

  B.The code will not compile because the variable i cannot be declared twice within the main() method.

  C.The code will not compile because the variable j cannot be declared twice within the switch statement.

  D.None of these.

【浙大網(wǎng)新中研軟件開發(fā)工程師筆試題】相關文章:

一套軟件開發(fā)工程師筆試題09-30

筆美國國家儀器試題目09-23

中糧上海筆經(jīng)08-08

銀行軟件開發(fā)筆試題07-25

騰訊軟件開發(fā)類筆試題07-28

中金CICC筆試題10-24

中鼎財富(北京)軟件開發(fā)有限公司 操盤分析師筆試題10-12

機械工程師筆試題07-17

中糧集團筆試題分享07-08

某公司Java工程師筆試題09-20