Đề thi lập trình java cuối kỳ

18 425 2
Đề thi lập trình java cuối kỳ

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Đề thi trắc nghiệm lập trình java , đề thi cuối kỳ lập trình java, đề thi trắc nghiệm java, trắc nghiệm java bách khoa đà nẵng, bách khoa đà nẵng, đề thi bách khoa lập trình java, lập trình java cuối kỳ, mai văn hà

2/11/2020 Luyện thi hướng đối tượng C++ - Quản lý site - Trắc nghiệm http://testhdtc.aztest.vn Luyện thi hướng đối tượng C++ Lập trình Java kỳ Tổng số câu hỏi : 43 Thời gian : 59 phút @media print { user_checked { border: 1px dashed gray; padding: 4px; } } Câu hỏi 1: // filename Main.java class Test { protected int x, y; }   class Main { public static void main(String args[]) { Test t = new Test(); System.out.println(t.x + " " + t.y); } } A Compile Error B Runtime error C 0 D 1 Câu hỏi 2: class Test { public static void main(String[] args) { for ( int i = ; ; i++) { System.out.println( "Hello" ); break ; } } } A Compiler Error B Runtime Error C D null Câu hỏi 3: class Test { public static void main(String[] args) { for ( int i = ; true ; i++) { System.out.println( "Hello" ); testhdtc.aztest.vn/admin/index.php?language=vi&nv=test&op=exams 1/18 2/11/2020 Luyện thi hướng đối tượng C++ - Quản lý site - Trắc nghiệm break ; } } } A Compiler Error B Runtime Error C Hello D Hello Hello Hello Câu hỏi 4: class Main { public static void main(String args[]) { System.out.println(fun()); } int fun() { return 20 ; } } A Compiler Error B Runtime Error C 20 D Câu hỏi 5: class Main { public static void main(String args[]) { System.out.println(fun()); } static int fun() { return 20 ; } } A Compiler Error B Runtime Error C 20 D testhdtc.aztest.vn/admin/index.php?language=vi&nv=test&op=exams 2/18 2/11/2020 Luyện thi hướng đối tượng C++ - Quản lý site - Trắc nghiệm Câu hỏi 6: class Test { public static void main(String args[]) { System.out.println(fun()); } static int fun() { static int x= ; return ++x; } } A Compiler Error B Runtime Error C D Câu hỏi 7: class Test {  private static int x;  public static void main(String args[]) {      System.out.println(fun());  }  static int fun() {      return ++x;  }  }    A Compiler Error B Runtime Error C D Câu hỏi 8: class Test { int x = 10 ; public static void main(String[] args) { Test t = new Test(); System.out.println(t.x); } } A Compiler Error B Runtime Error C 10 testhdtc.aztest.vn/admin/index.php?language=vi&nv=test&op=exams 3/18 2/11/2020 Luyện thi hướng đối tượng C++ - Quản lý site - Trắc nghiệm D Câu hỏi 9: // filename: Test.java  class Test {          int y = 2;      int x = y+2;      public static void main(String[] args) {              Test m = new Test();          System.out.println("x = " + m.x + ", y = " + m.y);      }  }    A Compiler Error B Runtime Error C x = 4, y = D x = 2, y = Câu hỏi 10: // filename: Test.java  public class Test  {          int x = 2;      Test(int i) { x = i; }      public static void main(String[] args) {              Test t = new Test(5);          System.out.println("x = " + t.x);      }  }    A Compiler Error B Runtime Error C x = D x = Câu hỏi 11: // Main.java  public class Main  {      public static void gfg(String s)      {              System.out.println("String");      }  testhdtc.aztest.vn/admin/index.php?language=vi&nv=test&op=exams 4/18 2/11/2020 Luyện thi hướng đối tượng C++ - Quản lý site - Trắc nghiệm     public static void gfg(Object o)      {          System.out.println("Object");      }      public static void main(String args[])      {          gfg(null);      }  } //end class    A Compiler Error B Runtime Error C String D Object E null Câu hỏi 12: // Main.java  public class Main  {      public static void gfg(String s)      {              System.out.println("String");      }      public static void gfg(Object o)      {          System.out.println("Object");      }      public static void gfg(Integer i)      {          System.out.println("Integer");      }      public static void main(String args[])      {          gfg(null);      }  } //end class    A Compiler Error B Runtime Error C String D Object testhdtc.aztest.vn/admin/index.php?language=vi&nv=test&op=exams 5/18 2/11/2020 Luyện thi hướng đối tượng C++ - Quản lý site - Trắc nghiệm E Integer Câu hỏi 13: // Main.java  public class Main  {      public static void main(String args[])      {          short s = 0;          int x = 07;          int y = 08;          int z = 112345;          s += z;          System.out.println("" + x + y + s);      }  } //end class    A Compiler Error B Runtime Error C 07 08 D Câu hỏi 14: class GfG  {      public static void main(String args[])      {          String s1 = new String("geeksforgeeks");          String s2 = new String("geeksforgeeks");          if (s1 == s2)              System.out.println("Equal");          else             System.out.println("Not equal");      }  }    A Compiler Error B Runtime Error C Equal D Not equal testhdtc.aztest.vn/admin/index.php?language=vi&nv=test&op=exams 6/18 2/11/2020 Luyện thi hướng đối tượng C++ - Quản lý site - Trắc nghiệm Câu hỏi 15: class Gfg  {      // constructor      Gfg()      {          System.out.println("Geeksforgeeks");      }           static Gfg a = new Gfg(); //line 8      public static void main(String args[])      {          Gfg b; //line 12          b = new Gfg();      }  }    A Compiler Error B Runtime Error C Geeksforgeeks D Geeksforgeeks Geeksforgeeks Câu hỏi 16: class Test {      int a = 10;      static int b = 20;  public     static void main(String[] args)      {          Test t1 = new Test();          t1.a = 100;          t1.b = 200;          Test t2 = new Test();          System.out.println("t1.a =" + t1.a + " t1.b =" + t1.b);          System.out.println("t2.a =" + t2.a + " t2.b =" + t2.b);      }  }  A t1.a=100 t1.b=200 t2.a=10 t2.b=200 B t1.a=10 t1.b=200 t2.a=10 t2.b=200 C t1.a=100 t1.b=200 t2.a=10 t2.b=20 D t1.a=100 t1.b=200 t2.a=100 t2.b=200 testhdtc.aztest.vn/admin/index.php?language=vi&nv=test&op=exams 7/18 2/11/2020 Luyện thi hướng đối tượng C++ - Quản lý site - Trắc nghiệm Câu hỏi 17: class Test2 {  public     static void main(String[] args)      {          byte x = 12;          byte y = 13;          byte result = x + y;          System.out.print(result);      }  }    A 25 B Error C -25 D none Câu hỏi 18: class Test3 {  public     static void main(String[] args)      {          int x = 011;          int y = 0xfee;          int result = x + y;          System.out.print(x + ":" + y + ":" + result);      }  }    A Error B 010 : 0xfee : 4089 C : 4078 : 4087 D 010 : 0xfee : 4087 Câu hỏi 19: class Test4 {  public     static void main(String[] args)      {          int x = 0198;          int y = 0xfree;          int result = x + y;          System.out.print(x + " : " + y + " : " + result);  testhdtc.aztest.vn/admin/index.php?language=vi&nv=test&op=exams 8/18 2/11/2020 Luyện thi hướng đối tượng C++ - Quản lý site - Trắc nghiệm     }  }    A Error B 0198 : 0xfree : 68734 C 144 : 68590 : 68734 D 0198 :68590 : 68788 Câu hỏi 20: class Test5 {  public     static void main(String[] args)      {          final int a = 1, b = 5;          for (int i = 0; a < b; i++) {              System.out.println("Hello");          }          System.out.println("Hi");      }  }    A Hello Hello … … … B Error C Hello Hello Hello Hello Hello D Hello Hello Hello Hello Hello Hi Câu hỏi 21: import java.util.*;  public class Test {  public static void main(String[] args)      {          int[] x = { 120, 200, 016 };          for (int i = 0; i < x.length; i++)              System.out.print(x[i] + " ");      }  }    A 120 200 16 B 120 200 14 C 120 200 016 testhdtc.aztest.vn/admin/index.php?language=vi&nv=test&op=exams 9/18 2/11/2020 Luyện thi hướng đối tượng C++ - Quản lý site - Trắc nghiệm D 016 is a compile error It should be written as 16 Câu hỏi 22: import java.util.*;  public class Test {  public static void main(String args[])      {          String S1 = "S1 =" + "123" + "456";          String S2 = "S2 =" + (123 + 456);          System.out.println(S1);          System.out.println(S2);      }  }    A S1=123456, S2=579 B S1=123456, S2=123456 C S1=579, S2=579 D None of This Câu hỏi 23: import java.util.*;  public class Test {  public static void main(String[] args)      {          int[] x = { 1, 2, 3, };          int[] y = x;          x = new int[2];          for (int i = 0; i < x.length; i++)              System.out.print(y[i] + " ");      }  }    A B 0 0 C D 0 testhdtc.aztest.vn/admin/index.php?language=vi&nv=test&op=exams 10/18 2/11/2020 Luyện thi hướng đối tượng C++ - Quản lý site - Trắc nghiệm Câu hỏi 24: class selection_statements {      public static void main(String args[])      {          int var1 = 5;          int var2 = 6;          if ((var2 = 1) == var1)              System.out.print(var2);          else             System.out.print(++var2);      }  }    A B C D Câu hỏi 25: class comma_operator {      public static void main(String args[])      {          int sum = 0;          for (int i = 0, j = 0; i < & j < 5; ++i, j = i + 1)              sum += i;          System.out.println(sum);      }  }    A B C 14 D comilation error Câu hỏi 26: class BitShi {      public static void main(String[] args)      {          int x = 0x80000000;          System.out.print(x + " and ");          x = x >>> 31;          System.out.println(x);      }  }    A -2147483648 and B 0x80000000 and 0x00000001 testhdtc.aztest.vn/admin/index.php?language=vi&nv=test&op=exams 11/18 2/11/2020 Luyện thi hướng đối tượng C++ - Quản lý site - Trắc nghiệm C -2147483648 and -1 D and -2147483648 Câu hỏi 27: class Test1 {  public     static void main(String[] args)      {          int String = 65;          int Runnable = 97;          System.out.print(String + " : " + Runnable);      }  }    A Error B a C 65:97 D None Câu hỏi 28: class Test2 {  public     static void main(String[] args)      {          int if = 65;          int else = 97;          System.out.println(if + " : " + else);      }  }    A Error B A : B C 65 : 97 D None Câu hỏi 29: class Test3 {  public     static void main(String[] args)      {          int x = 1;          if (x) {              System.out.print("GeeksForGeeks");  testhdtc.aztest.vn/admin/index.php?language=vi&nv=test&op=exams 12/18 2/11/2020 Luyện thi hướng đối tượng C++ - Quản lý site - Trắc nghiệm         } else {              System.out.print("GFG");          }      }  }    A GeeksForGeeks B GFG C Error D None Câu hỏi 30: class Test4 {  public     static void main(String[] args)      {          double d1 = 123.456;          double d2 = 12_3.4_5_6;          double d3 = 12_3.4_56;          System.out.println(d1);          System.out.println(d2);          System.out.println(d3);      }  }    A Error B 123.456 12_3.4_5_6 12_3.4_56 C 123.456 123.456 123.456 D None Câu hỏi 31: public class Prg {      public static void main(String args[])      {          System.out.print('A' + 'B');      }  }    A AB B 195 C 131 testhdtc.aztest.vn/admin/index.php?language=vi&nv=test&op=exams 13/18 2/11/2020 Luyện thi hướng đối tượng C++ - Quản lý site - Trắc nghiệm D Error Câu hỏi 32: public class Prg {      public static void main(String args[])      {          System.out.print("A" + "B" + 'A' + 10);      }  }    A ABA10 B AB65 C Error D AB Câu hỏi 33: public class Prg {      public static void main(String args[])      {          System.out.print(20 + 1.34f + "A" + "B");      }  }    A 201.34AB B 201.34fAB C 21.34AB D Error Câu hỏi 34: public class Test {  public     static void main(String[] args)      {          int b = 2147483648;          System.out.println(b);      }  }    A No output testhdtc.aztest.vn/admin/index.php?language=vi&nv=test&op=exams 14/18 2/11/2020 Luyện thi hướng đối tượng C++ - Quản lý site - Trắc nghiệm B 2147483648 C 2147483647 D compile-time error Câu hỏi 35: public class Test  {      static char ch = 59;      public static void main(String[] args)      {          System.out.println(ch);      }  }    A compile-time error B null C No output D ; Câu hỏi 36: public class Test {  public     static void main(String[] args)      {          int x = 0xGeeks;          System.out.println(x);      }  }    A B Compile-time error C null D Run-time error Câu hỏi 37: public class Test {  public     static void main(String[] args)      {  testhdtc.aztest.vn/admin/index.php?language=vi&nv=test&op=exams 15/18 2/11/2020 Luyện thi hướng đối tượng C++ - Quản lý site - Trắc nghiệm         // we are assiging byte data to byte variable          float f = 10l;          System.out.println(f);      }  }    A 10 B Compile-time error C 10.0 D Run-time error Câu hỏi 38: class ArrayDemo {  public static void main(String[] args)      {          int arr1[] = { 1, 2, 3, 4, };          int arr2[5] = { 1, 2, 3, 4, };          for (int i = 0; i < 5; i++)              System.out.print(arr1[i] + " ");          System.out.println();          for (int i = 0; i < 5; i++)              System.out.print(arr2[i] + " ");      }  }    A \n B \n C Error Câu hỏi 39: class ArrayDemo1 {  public static void main(String[] args)      {          int arr1[] = new int[0];          int arr2[] = new int[-1];          System.out.print(arr1.length + " : " + arr2.length);      }  }    A : B : -1 C Compiler Error testhdtc.aztest.vn/admin/index.php?language=vi&nv=test&op=exams 16/18 2/11/2020 Luyện thi hướng đối tượng C++ - Quản lý site - Trắc nghiệm D Run-time error Câu hỏi 40: class ArrayDemo1 {  public static void main(String[] args)      {          int arr1[] = new int[2147483647];          int arr2[] = new int[2147483648];          System.out.println(arr1.length);          System.out.println(arr2.length);      }  }    A 2147483647 2147483648 B Error C 2147483647 \n -1 D 2147483647 \n 2147483646 Câu hỏi 41: class ArrayDemo1 {  public static void main(String[] args)      {          short s = 45;          int arr1[] = new int[s];          char ch = 'A';          int arr2[] = new int[ch];          long l = 10;          int arr3[] = new int[l];          System.out.println(arr1.length);          System.out.println(arr2.length);          System.out.println(arr3.length);      }  }    A 45 65 10 B 45 A 10 C Error Câu hỏi 42: kết quả: u=4; y=5; u = 6, t =7, z; t -=u+++ y; t+=++u + y; z = u+++v++ testhdtc.aztest.vn/admin/index.php?language=vi&nv=test&op=exams 17/18 2/11/2020 Luyện thi hướng đối tượng C++ - Quản lý site - Trắc nghiệm A B Câu hỏi 43:         String java = "Java", ja = "Ja", va = "va";         System.out.println(java == "Ja"+"va");         System.out.println(java == "Ja"+va);         System.out.println(java == ja+va); A true false false B false true false C false true true URL đến thi này: http://testhdtc.aztest.vn/tin-hoc/lap-trinh-java-giua-ky-56.html © Luyện thi hướng đối tượng C++ testhdtc.aztest.vn/admin/index.php?language=vi&nv=test&op=exams xuanmanhitweb1011@gmail.com 18/18 ... 17/18 2/11/2020 Luyện thi hướng đối tượng C++ - Quản lý site - Trắc nghiệm A B Câu hỏi 43:         String java = "Java" , ja = "Ja", va = "va";         System.out.println (java == "Ja"+"va");   ...  System.out.println (java == "Ja"+va);         System.out.println (java == ja+va); A true false false B false true false C false true true URL đến thi này: http://testhdtc.aztest.vn/tin-hoc/lap-trinh -java- giua-ky-56.html... testhdtc.aztest.vn/admin/index.php?language=vi&nv=test&op=exams 9/18 2/11/2020 Luyện thi hướng đối tượng C++ - Quản lý site - Trắc nghiệm D 016 is a compile error It should be written as 16 Câu hỏi 22: import java. util.*;  public class Test { 

Ngày đăng: 02/11/2020, 23:56

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan