Quizzes
Site Language: English
Українська
English
Русский
Programming Tests
Login
Sign Up
Programming Tests
Theory
Snippets
Papers
Landing
Android
Prices
FAQ
Cosmo Story
Terms and Conditions
Privacy Policy
Cookies Policy
Send Feedback
type-conversion
:
Content language: English
Русский
What will the following code display (ASCII code of '1' is 49)? public class Test { public static void main(String[] args) { char c1 = '1'; char c2 = '\u0031'; char c3 = 49; System.out.println(c1 + c2 + c3); } }
type-conversion
What will be the result of the following code execution? class Alien { String invade(short ships) { return "a few"; } String invade(short... ships) { return "many"; } } public class Defender { public static void main(String [] args) { System.out.println(new Alien().invade(7)); } }
type-conversion
Which line/lines will compilation error occur in? public class Test { public static void main(String[] args) { char c = (char) 1; // 1 boolean boo = (boolean) 1; // 2 byte b = (byte) true; // 3 } }
type-conversion
What will be the result of the program? class A { static byte m1() { final char c1 = '\u0001'; return c1; // 1 } static byte m2(final char c2) { return c2; } // 2 public static void main(String[] args) { char c3 = '\u0003'; System.out.print("" + m1() + m2(c3)); // 3 } }
type-conversion
As a result of compiling of which lines there will be a compilation error: public class Main { public static void main(String[] args) { int v1 = 081; //1 int v2 = 0x81; //2 float v3 = 0x81; //3 float v4 = 0.81; //4 byte v5 = 0x81; //5 } }
type-conversion
What is the result of executing this code: try { int i = new Integer(10); System.out.println(i); } catch(Exception e) { System.out.println("opsss... error"); }
type-conversion
What lines will not cause a compilation error?
type-conversion
What will be the result of the following code execution? public class Main { public static void main(String[] args) { byte b = 12; byte k = b + 1; System.out.println(k); } }
type-conversion
What will happen during the following code execution? import java.util.*; public class Test { public static void main(String[] args) { List a = new ArrayList<Double>();// 4 a.add("1.5");// 5 List<Double> b = new ArrayList();// 6 b.add("1.5");// 7 System.out.println(a + " " + b); } }
type-conversion
What will be the result of the following code execution? public class PrintTest { public static void main(String[] args) { System.out.println("1" + 2 + 3); } }
type-conversion
← Prev
1
2
Next →
Sign Up Now
or
Subscribe for future quizzes