Javaプログラミングに関する基礎知識を測るテスト問題

プログラミング言語であるJavaで書かれたコードを解読できるスキルがあるかどうかをチェックできるテスト問題です。

このテストは、プログラミング言語の一つであるJavaについての基礎知識をチェックするものです。ITエンジニア採用時のテストや、採用後の研修の理解度チェックテストとして利用できます。受験者は、Java言語で書かれたコードを解読し、そのコードを実行したときに何が起こるか、設問の選択肢の中から正しいと思われるものを一つ選択して回答します。制限時間は45分で、全20問出題されます。
Javaの基礎知識のチェックをする場合に本テストをぜひご利用ください。

対象職種
エンジニア
問題形式
選択式
問題数
全20問
制限時間
45分

テスト問題プレビュー

1. 次のコードを実行した場合、変数「ans」に格納される値はどれか?

package test;
public class Test {
 public static void main(String[] args){
  int a = 2;
  int b = 3;
  int ans = a + b;
 }
}

2. 次のコードを実行した場合、変数「ans」に格納される値はどれか?

package test;
public class Test {
 public static void main(String[] args){
  String a = "4";
  String b = "5";
  String ans = a + b;
 }
}

3. 次のコードを実行した場合、変数「ans」に格納される値はどれか?

package test;
public class Test {
 public static void main(String[] args){
  int a = 20;
  int b = 10;
  int ans = functionA(a , b);
 }
 public static int functionA(int m ,int n) {
  return m - n;
 }
}

4. 次のコードを実行した場合、変数「ans」に格納される値はどれか?

package test;
public class Test {
 public static void main(String[] args){
  int a = 0;
  for(int i = 0; i < 10; i++) {
   a++;
  }
  int ans = a;
 }
}

5. 次のコードを実行した場合、変数「ans」に格納される値はどれか?

package test;
public class Test {
 public static void main(String[] args){
  int a = 0;
  for(int i = 0; i < 10; i++) {
  for(int j = 0; j < 10; j++) {
   a++;
   }
  }
  int ans = a;
 }
}

6. 次のコードを実行した場合、変数「ans」に格納される値はどれか?

package test;
public class Test {
 public static void main(String[] args){
  int[] array = {1,2,3,4};
  int a = 0;
  for(int b : array) {
   a = a + b;
  }
  int ans= a;
 }
}

7. 次のコードを実行した場合、変数「ans」に格納される値はどれか?

package test;
public class Test {
 public static void main(String[] args){
  int a = 10;
  int b = 0;
  if(a == 10) {
   b = 10;
  } else if(a == 20) {
   b = 20;
  } else {
   b = 30;
  }
  int ans = b;
 }
}

8. 次のコードを実行した場合、変数「ans」に格納される値はどれか?

package test;
public class Test {
 public static void main(String[] args){
  int[][] array = new int[3][3];
  for (int i = 0; i < 3; i++) {
   for (int j = 0; j < 3; j++) {
    array[i][j] = i + j;
   }
  }
  int ans = array[1][2] + array[2][1];
 }
}

9. 次のコードを実行した場合、変数「ans」に格納される値はどれか?

package test;
public class Test {
 public static void main(String[] args){
  int a = 10;
  int b = 20;
  int ans = a + b + functionA(a , b);
 }
 public static int functionA(int m, int n) {
  m = m + 10;
  n = n + 20;
  return m + n;
 }
}

10. 次のコードを実行した場合、変数「ans」に格納される値はどれか?

package test;
public class Test {
 public static void main(String[] args){
  ValueSet vs = new ValueSet();
  vs.a = 10;
  vs.b = 20;
  int ans =functionA(vs);
  ans = ans + vs.a + vs.b;
 }
 public static int functionA(ValueSet vs) {
  vs.a = 20;
  vs.b = 40;
  return vs.a + vs.b;
 }
}

package test;
public class ValueSet {
 int a = 0;
 int b = 0;
}

無料登録をすると、
この問題を無料でご利用いただけます!

プライバシーポリシー利用規約にご同意の上送信してください

ラクテス無料登録

問題作成者紹介

ラクテス編集部

ラクテスはクラウド上で簡単にテスト作成・実施ができるサービスです。

page top