www.testline.hu v4.2.9 (2017.02.09.) 2017.02.22. 01:27:40 vendég
TestLine - SCJP sample 3 Minta feladatsor Kérdések száma: 21 kérdés Kitöltési idő: 48:36 Pont egység: +6 -2 Értékelés: Alapértelmezett értékelés Típus: Mindig van legalább egy jó válasz (N/1..N) Source: http://scjptest.com 1. A kérdés nagyobb mint egy önálló oldal, ezért nem tud megjelenni.
Core 1:53
2. Given the code. What is the result? [source:java] String test = "This is a test string"; String[] tokens = test.split("\s"); System.out.println(tokens.length); [source] a b c d e
An exception is thrown at runtime Compilation fails 0 5 21 Csak tipp +3 1-
Talán jó + 4.5 1.5 -
Nem válaszolok +6 2-
Valószínűleg jó +9 3-
TestLine - SCJP sample 3 oldal 1/15 Minta feladatsor
Biztosan jó + 12 4 -
www.testline.hu v4.2.9 (2017.02.09.) 2017.02.22. 01:27:40 vendég
TestLine - SCJP sample 3 Minta feladatsor
Thread 2:25
3. Given the code. What is the result? [source:java] public class Cruiser implements Runnable { public static void main(String[] args) throws InterruptedException { Thread a = new Thread(new Cruiser()); a.start(); System.out.print("Begin"); a.join(); System.out.print("End"); } public void run() { System.out.print("Run"); } } [source] a b c d e
"BeginEnd" is printed. An exception is thrown at runtime. "BeginRunEnd" is printed. "BeginEndRun" is printed. Compilation fails. Csak tipp +3 1-
Talán jó + 4.5 1.5 -
Nem válaszolok +6 2-
Valószínűleg jó +9 3-
Biztosan jó + 12 4 Core 2:21
4.
The code below is executed by "java -Dmyprop=myprop Test". Which two, placed instead of "//some code goes here", will produce the output "myprop"? (Choose two) [source:java] public class Test { public static void main(String args[]) { String prop = //some code goes here// System.out.print(prop); } } [source] a b c d e f
System.load("myprop"); System.get("myprop"); System.getProperties().getProperty("myprop"); System.getProperty("myprop"); System.getEnv("myprop"); System.property("myprop"); Csak tipp +3 1-
Talán jó + 4.5 1.5 -
Nem válaszolok +6 2-
Valószínűleg jó +9 3-
TestLine - SCJP sample 3 oldal 2/15 Minta feladatsor
Biztosan jó + 12 4 -
www.testline.hu v4.2.9 (2017.02.09.) 2017.02.22. 01:27:40 vendég
TestLine - SCJP sample 3 Minta feladatsor
Core 2:12
5. Given the code. What is the result? [source:java] DateFormat df = DateFormat.getDateInstance(DateFormat.LONG, Locale.US); Calendar c = Calendar.getInstance(); c.set(Calendar.YEAR, 2009); c.set(Calendar.MONTH, 6); c.set(Calendar.DAY_OF_MONTH, 1); String formattedDate = df.format(c.getTime()); System.out.println(formattedDate); [source] a b c d
Compilation fails An exception is thrown at runtime June 1, 2009 July 1, 2009 Csak tipp +3 1-
Talán jó + 4.5 1.5 -
Nem válaszolok +6 2-
Valószínűleg jó +9 3-
TestLine - SCJP sample 3 oldal 3/15 Minta feladatsor
Biztosan jó + 12 4 -
www.testline.hu v4.2.9 (2017.02.09.) 2017.02.22. 01:27:40 vendég
TestLine - SCJP sample 3 Minta feladatsor
Hash 2:43
6.
Given the code. What is the result? [source:java] import java.util.HashSet; public class HashTest { private String str; public HashTest(String str) { this.str = str; } public static void main(String args[]) { HashTest h1 = new HashTest("1"); HashTest h2 = new HashTest("1"); String s1 = new String("2"); String s2 = new String("2"); HashSet hs = new HashSet(); hs.add(h1); hs.add(h2); hs.add(s1); hs.add(s2); System.out.print(hs.size()); } } [source]
a b c d e
"4" is printed. "2" is printed. "3" is printed. Compilation fails. An exception is thrown at runtime. Csak tipp +3 1-
Talán jó + 4.5 1.5 -
Nem válaszolok +6 2-
Valószínűleg jó +9 3-
TestLine - SCJP sample 3 oldal 4/15 Minta feladatsor
Biztosan jó + 12 4 -
www.testline.hu v4.2.9 (2017.02.09.) 2017.02.22. 01:27:40 vendég
TestLine - SCJP sample 3 Minta feladatsor
Core 2:24
7. Given the code. What is the result? [source:java] public class Test { private static void doStuff(String str) { int var = 4; if (var == str.length()) { System.out.print(str.charAt(--var) + " "); } else { System.out.print(str.charAt(0) + " "); } } public static void main(String args[]) { doStuff("abcd"); doStuff("efg"); doStuff("hi"); } } [source] a b c d e f
cfi ceh Compilation fails. dfi deh An exception is thrown at runtime. Csak tipp +3 1-
Talán jó + 4.5 1.5 -
Nem válaszolok +6 2-
Valószínűleg jó +9 3-
TestLine - SCJP sample 3 oldal 5/15 Minta feladatsor
Biztosan jó + 12 4 -
www.testline.hu v4.2.9 (2017.02.09.) 2017.02.22. 01:27:40 vendég
TestLine - SCJP sample 3 Minta feladatsor
Core 2:21
8. Given the code. What is the result? [source:java] public class TryMe { Integer A; int a; public TryMe(int a) { this.a = A + a; System.out.print(this.a); } public static void main(String args[]) { Integer A = new Integer(1); TryMe t = new TryMe(A); } } [source] a b c d e
The value "1" is printed A NullPointerException occurs at runtime A NumberFormatException occurs at runtime An IllegalStateExcepition occurs at runtime Compilation fails because of an error in line 5 Csak tipp +3 1-
Talán jó + 4.5 1.5 -
Nem válaszolok +6 2-
Valószínűleg jó +9 3-
TestLine - SCJP sample 3 oldal 6/15 Minta feladatsor
Biztosan jó + 12 4 -
www.testline.hu v4.2.9 (2017.02.09.) 2017.02.22. 01:27:40 vendég
TestLine - SCJP sample 3 Minta feladatsor
GC 2:48
9. What is true about objects referenced by a, b, aa at the line labeled "// some code goes here"? [source:java] class A { private B b; public A() { this.b = new B(this); } } class B { private A a; public B(A a) { this.a = a; } } public class Test { public static void main(String args[]) { A aa = new A(); aa = null; // some code goes here } } [source] a b c d e
None of these objects are eligible for garbage collection. Only the object referenced by "b" is eligible for garbage collection. Only the object referenced by "aa" is eligible for garbage collection. Only the object referenced by "a" is eligible for garbage collection. The objects referenced by a and b are eligible for garbage collection. Csak tipp +3 1-
Talán jó + 4.5 1.5 -
Nem válaszolok +6 2-
Valószínűleg jó +9 3-
TestLine - SCJP sample 3 oldal 7/15 Minta feladatsor
Biztosan jó + 12 4 -
www.testline.hu v4.2.9 (2017.02.09.) 2017.02.22. 01:27:40 vendég
TestLine - SCJP sample 3 Minta feladatsor
Core 2:22
10. Given the code. What is the result? [source:java] public class SomeClass { private int value = 1; public int getValue() { return value; } public void changeVal(int value) { value = value; } public static void main(String args[]) { int a = 2; SomeClass c = new SomeClass(); c.changeVal(a); System.out.print(c.getValue()); } } [source] a b c d
An exception is thrown at runtime "1" is printed Compilation fails "2" is printed Csak tipp +3 1-
Talán jó + 4.5 1.5 -
Nem válaszolok +6 2-
Valószínűleg jó +9 3-
TestLine - SCJP sample 3 oldal 8/15 Minta feladatsor
Biztosan jó + 12 4 -
www.testline.hu v4.2.9 (2017.02.09.) 2017.02.22. 01:27:40 vendég
TestLine - SCJP sample 3 Minta feladatsor
Core 2:05
11.
Given the code below. This code is run by "java Test 1 2 3 4". What is the result? [source:java] public class Test { public static void main(String args[]) { for (int i = 1; i < args.length; i++) { System.out.print(i + " "); } } } [source]
a b c d e
An exception is thrown at runtime. 12 123 234 Compilation fails. Csak tipp +3 1-
Talán jó + 4.5 1.5 -
Nem válaszolok +6 2-
Valószínűleg jó +9 3-
Biztosan jó + 12 4 GC 2:04
12.
What should be called after the code below to suggest that the JVM expend effort toward recycling the memory used by the object a? (Select two) [source:java] BigObject a = MyFactory.createBigObject(); a.doStuff(); a = null; [source] a b c d e
Runtime.gc() Runtime.getRuntime().gc() System.gc() System.freeMemory() Runtime.getRuntime().freeMemory() Csak tipp +3 1-
Talán jó + 4.5 1.5 -
Nem válaszolok +6 2-
Valószínűleg jó +9 3-
TestLine - SCJP sample 3 oldal 9/15 Minta feladatsor
Biztosan jó + 12 4 -
www.testline.hu v4.2.9 (2017.02.09.) 2017.02.22. 01:27:40 vendég
TestLine - SCJP sample 3 Minta feladatsor
Core 2:19
13. Given the code. What is the result? [source:java] public class EmptyStringsTest { public static boolean isEmpty(String s) { return (s == null | s.length() == 0); } public static void main(String args[]) { if (isEmpty(null)) { System.out.print("empty "); } else { System.out.print("not_empty "); } } } [source] a b c d
"not_empty" is printed "empty" is printed Compilation fails An exception is thrown at runtime Csak tipp +3 1-
Talán jó + 4.5 1.5 -
Nem válaszolok +6 2-
Valószínűleg jó +9 3-
Biztosan jó + 12 4 Static 2:40
14. Given the code. What is the result when this program is executed? [source:java] public class SuperHotel { static int x[]; static { x[0] = 1; } public static void main(String args[]) { } } [source] a b c d
ArrayIndexOutOfBoundsException is thrown IllegalStateException is thrown ExceptionInInitializerError is thrown StackOverflowException is thrown Csak tipp +3 1-
Talán jó + 4.5 1.5 -
Nem válaszolok +6 2-
Valószínűleg jó +9 3-
TestLine - SCJP sample 3 oldal 10/15 Minta feladatsor
Biztosan jó + 12 4 -
www.testline.hu v4.2.9 (2017.02.09.) 2017.02.22. 01:27:40 vendég
TestLine - SCJP sample 3 Minta feladatsor
Constructor 1:49
15. Given the code. What is the result? [source:java] class Small { public Small() { System.out.print("a "); } } class Small2 extends Small { public Small2() { System.out.print("b "); } } class Small3 extends Small2 { public Small3() { System.out.print("c "); } } public class Test { public static void main(String args[]) { new Small3(); } } [source] a b c d e
a cba c abc The code runs without output. Csak tipp +3 1-
Talán jó + 4.5 1.5 -
Nem válaszolok +6 2-
Valószínűleg jó +9 3-
TestLine - SCJP sample 3 oldal 11/15 Minta feladatsor
Biztosan jó + 12 4 -
www.testline.hu v4.2.9 (2017.02.09.) 2017.02.22. 01:27:40 vendég
TestLine - SCJP sample 3 Minta feladatsor
Core 2:52
16. Given the code. What is the result after the class TryMe execution? [source:java] class A { public void doA() { B b = new B(); b.dobB(); System.out.print("doA"); } } class B { public void dobB() { C c = new C(); c.doC(); System.out.print("doB"); } } class C { public void doC() { if (true) throw new NullPointerException(); System.out.print("doC"); } } public class TryMe { public static void main(String args[]) { try { A a = new A(); a.doA(); } catch (Exception ex) { System.out.print("error"); } } } [source]
a b c d e
"doAdoBdoC" is printed nothing is printed "doBdoAerror" is printed "error" is printed "doCdoBdoA" is printed Csak tipp +3 1-
Talán jó + 4.5 1.5 -
Nem válaszolok +6 2-
Valószínűleg jó +9 3-
TestLine - SCJP sample 3 oldal 12/15 Minta feladatsor
Biztosan jó + 12 4 -
www.testline.hu v4.2.9 (2017.02.09.) 2017.02.22. 01:27:40 vendég
TestLine - SCJP sample 3 Minta feladatsor
Core 2:02
17. Given the code. What is the result if NullPointerException occurs at line 2? [source:java] try { //some code goes here } catch (NullPointerException ne) { System.out.print("1 "); } catch (RuntimeException re) { System.out.print("2 "); } finally { System.out.print("3"); } [source] a b c d e f
13 1 3 31 23 123 Csak tipp +3 1-
Talán jó + 4.5 1.5 -
Nem válaszolok +6 2-
Valószínűleg jó +9 3-
TestLine - SCJP sample 3 oldal 13/15 Minta feladatsor
Biztosan jó + 12 4 -
www.testline.hu v4.2.9 (2017.02.09.) 2017.02.22. 01:27:40 vendég
TestLine - SCJP sample 3 Minta feladatsor
Core 2:24
18. Given the code. What is the result? [source:java] public class Test { private static void doStuff(String str) { int var = 4; if (var == str.length()) { System.out.print(str.charAt(var--) + " "); } else { System.out.print(str.charAt(0) + " "); } } public static void main(String args[]) { doStuff("abcd"); doStuff("efg"); doStuff("hi"); } } [source] a b c d e f
ceh cfi An exception is thrown at runtime. dfi Compilation fails. deh Csak tipp +3 1-
19.
a b c d
Talán jó + 4.5 1.5 -
Nem válaszolok +6 2-
Valószínűleg jó +9 3-
Given the code. What is true about it? (Choose all that apply) [source:java] enum State{ACTIVE, INACTIVE, DELETED} [source]
Biztosan jó + 12 4 Core 1:58
State.ACTIVE == State.INACTIVE is false State.ACTIVE < State.INACTIVE is true State.ACTIVE.equals(State.ACTIVE) is true State.ACTIVE == State.ACTIVE is true Csak tipp +3 1-
Talán jó + 4.5 1.5 -
Nem válaszolok +6 2-
Valószínűleg jó +9 3-
TestLine - SCJP sample 3 oldal 14/15 Minta feladatsor
Biztosan jó + 12 4 -
www.testline.hu v4.2.9 (2017.02.09.) 2017.02.22. 01:27:40 vendég
TestLine - SCJP sample 3 Minta feladatsor
Core 2:12
20. Given the code. What is the result? [source:java] DateFormat df = DateFormat.getDateInstance(); df.setLocale(Locale.US); Calendar c = Calendar.getInstance(); c.set(Calendar.YEAR, 2009); c.set(Calendar.MONTH, 5); c.set(Calendar.DAY_OF_MONTH, 1); String formattedDate = df.format(c.getTime()); System.out.println(formattedDate); [source] a b c d
July 1, 2009 June 1, 2009 Compilation fails An exception is thrown at runtime Csak tipp +3 1-
Talán jó + 4.5 1.5 -
Nem válaszolok +6 2-
Valószínűleg jó +9 3-
Biztosan jó + 12 4 Exception 1:16
21. Given the code. What is the result? [source:java] public static void main(String args[]) { try { String arr[] = new String[10]; arr = null; arr[0] = "one"; System.out.print(arr[0]); } catch(NullPointerException nex) { System.out.print("null pointer exception"); } catch(Exception ex) { System.out.print("exception"); } } [source] a b c d
"null pointer exception" is printed. Compilation fails. "one" is printed. "exception" is printed. Csak tipp +3 1-
Talán jó + 4.5 1.5 -
Nem válaszolok +6 2-
Valószínűleg jó +9 3-
TestLine - SCJP sample 3 oldal 15/15 Minta feladatsor Powered by TCPDF (www.tcpdf.org)
Biztosan jó + 12 4 -