programming languages Online Quiz - 113
Description: programming languages Online Quiz - 113 | |
Number of Questions: 20 | |
Created by: Aliensbrain Bot | |
Tags: programming languages |
If we extends class A in Class B they are sharing which relationship?
Match the mobile development platforms with programming languages a. Android i. Java b. Blackberry ii.C c. iPhone iii. Java (RIM APIs) d. BREW iv. Objective C
Match the mobile development platforms with programming languages a. Android i. Java b. Blackberry ii.C c. iPhone iii. Java (RIM APIs) d. BREW iv. Objective C
Match the mobile development platforms with programming languages a. Android i. Java b. Blackberry ii.C c. iPhone iii. Java (RIM APIs) d. BREW iv. Objective C
Given the following code: public class Demo { public int method(int x) { int r = 1; r += x; if ((x > 4) && (x < 10)) { r += 2 * x; } else (x <= 4) { r += 3 * x; } else { r += 4 * x; } r += 5 * x; return r; } public static void main(String [] args) { Demo ob = new Demo(); System.out.println("OF(11) is: " + ob.method (11)); } } What is the result?
class Demo { public static void main(String[] args) { String s = "- " ; try { doMath(args[0]); s += "t "; // line 6 } finally { System.out.println(s += "f "); } } public static void doMath(String a) { int y = 7 / Integer.parseInt(a); } } At commandline if the input is java Demo What will be output?
class Demo { public static void main(String [] args) { int x = 0; // insert code here do { } while (x++ < y); System.out.println(x); } } Which, inserted at line 4, produces the output 12?
class Demo { static String s = "-"; public static void main(String[] args) { new Demo().method1() ; System.out.println(s); } void method1() { try { method2();} catch (Exception e) { s += "c"; } } void method2() throws Exception { method3(); s += "2"; method3(); s += "2b"; } void method3() throws Exception { throw new Exception(); } } What is the result?
class Ping extends Utils { public static void main(String [] args) { Utils u = new Ping(); System.out.print(u.getInt(args[0])); } int getInt(String arg) { return Integer.parseInt(arg); } } class Utils { int getInt(String x) throws Exception { return 7; } } And the following three possible changes: L1. Declare that main() throws an Exception. L2. Declare that Ping.getInt() throws an Exception. L3. Wrap the invocation of getInt() in a try / catch block. Which change(s) allow the code to compile? (Choose all that apply.)
public class Demo { public static void main(String[] args) { int i=0; i++=i++;//1 ++i=++i;//2 System.out.println("i ="+i); } }
class Demo { public static void main(String[] args) { int[] x = {7,6,5,4,3,2,1}; // insert code here System.out.print(y + " "); } } } Which, inserted independently at line 4, compiles? (Choose all that apply.)
- class Demo { 2. final static int x2 = 7; 3. final static Integer x4 = 8; 4. public static void main(String[] args) { 5. Integer x1 = 5; 6. String s = "a"; 7. if(x1 < 9) s += "b"; 8. switch(x1) { 9. case 5: s += "c"; 10. case x2: s += "d"; 11. case x4: s += "e"; 12. } 13. System.out.println(s); 14. } 15. } What is the result?
Given:class Demo { static String s = ""; public static void main(String[] args) { try { throw new Exception(); } catch (Exception e) { try { try { throw new Exception(); } catch (Exception ex) { s += "ic"; } throw new Exception(); } catch (Exception x) { s += "mc"; } finally { s += "mf"; } } finally { s +="of"; } System.out.println(s);} }What is the result?
Given: class Mineral { } class Gem extends Mineral { } class Miner { static int x = 7; static String s = null; public static void getWeight(Mineral m) { int y = 0 / x; System.out.print(s + " "); } public static void main(String[] args) { Mineral[] ma = {new Mineral(), new Gem()}; for(Object o : ma) getWeight((Mineral) o); } } And the command-line invocation: java Miner.java What is the result?
class Super { public static int main(int args[]) { System.out.println("Hi"); return 0; } public static void main(String[] args) { System.out.println("Hello"); int[] a={1,2,3,4}; int b=main(a); } } class main extends Super { public static void main(String[] args) { Super ob=new Super(); String[] b={"a","b","c","d"}; ob.main(b); System.out.println("Hi_Hello"); int[] a={1,2,3,4}; int c=main(a); } } what is the result?
public class Demo { public static void main(String[] args) { String s1="Hello"; String s2="Hello"; if(s1==s2) System.out.println("Hello...."); else System.out.println("Hi...."); } } what is the result?
Given the following code: public class Demo { public int method(int x) { int r = 1; r += x; if ((x > 4) && (x < 10)) { r += 2 * x; } else (x <= 4) { r += 3 * x; } else { r += 4 * x; } r += 5 * x; return r; } public static void main(String [] args) { Demo ob = new Demo(); System.out.println("OF(11) is: " + ob.method (11)); } } What is the result?