中文国产日韩欧美视频,午夜精品999,色综合天天综合网国产成人网,色综合视频一区二区观看,国产高清在线精品,伊人色播,色综合久久天天综合观看

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

時間:2018-12-31 12:00:00 資料大全 我要投稿

浙大網(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ā)工程師筆試題】相關(guān)文章:

1.軟件開發(fā)工程師筆試題

2.一套軟件開發(fā)工程師筆試題

3.浙大網(wǎng)新C/C++筆試解惑

4.研華的筆試題

5.360筆試題目

6.360筆試題目

7.中再集團校園招聘軟件開發(fā)崗筆試題

8.軟件開發(fā)的階段試題