programming languages Online Quiz - 17
Description: programming languages Online Quiz - 17 | |
Number of Questions: 20 | |
Created by: Aliensbrain Bot | |
Tags: programming languages |
The statement that is used to replace multiple if statements is
The following code will generate a compiler error.
string GetAgePhrase(int age) { if (age > 60) return "Senior"; if (age > 40) return "Middle-aged"; if (age > 20) return "Adult"; if (age > 12) return "Teen-aged"; if (age > 4) return "Toddler"; }
Which of the following statements, inserted as the last line of the function, would solve the problem?
what is the default access specifier for a Top-level Class, which are not nested into other Classes?
Which statement is true about interface and abstract classes?
The default type of enum is integer and has a default value 1.
Unboxing of a null refrence type will return null.
Difference between const and readonly
A variable declared inside a method is called
In programming languages, which language's version name is also known as "Scorpio" ?
Which of the following declaration will compile without errors?
a)
public abstract class Digit { public abstract void print(); }
b)
public class Digit { public abstract void print(); }
c)
public abstract class Digit { public abstract void print(){}; }
d)
public abstract class Digit { public void print(); }
e)
public class Digit { public void print(){}; }
What are the rules to implement an interface? Considering the following declaration for interface Convertable, which of the following code segments will compile?
public interface Convertable { int convertToInt(); char convertToChar(); }
a)
class Digit implements Convertable { public char convertToChar() { return 0; } public int convertToInt() { return 0; } }
b)
abstract class Digit implements Convertable { int convertToInt(); char convertToChar(); }
c)
abstract class Digit implements Convertable { public int convertToInt() { return 0; } }
d)
abstract class Digit implements Convertable { public int convertToInt() { return 0; } char convertToChar(); }
e)
class Digit implements Convertable { int convertToInt() { return 0; return 0; } }
f)
interface Roundable extends Convertable { int roundUp(); }
Is the following declaration for interface Bendable correct and free of compilation error?
abstract interface Bendable { // line 1 final int x = 2009; // line 3 void method1() {}; // line 5 }
What is the result of compiling and running the following code?
public class Tester { public static void main(String[] args) { System.out.print("1"); try { return; } catch (Exception e) { System.out.print("2"); } finally { System.out.print("3"); } System.out.print("4"); } }