programming languages Online Quiz - 20
Description: programming languages Online Quiz - 20 | |
Number of Questions: 20 | |
Created by: Aliensbrain Bot | |
Tags: programming languages |
public class test08 { public static void main(String[] args) { try{ A a = new B(); a.show(); }catch (Exception e){ } } }class A{ void show() throws FileNotFoundException{ System.out.println("This is the super class"); }}class B extends A{ void show() throws Exception{ System.out.println("This is the inherited class"); }}What will be the output?
NullPointerException is a checked exception
If you declare an object as constant, then every member of the object would be?
class Dog { public static void bark() { System.out.print("woof "); }}class Alsation extends Dog { public static void bark() { }}public class Bark { public static void main(String args[]) { Dog woofer = new Dog(); Dog nipper = new Alsation(); woofer.bark(); nipper.bark(); }}What is the output
Destructors can be overloaded.
public class test08 { public test08(Object o) { System.out.println("Object"); } public test08(double[] dArray) { System.out.println("double array"); } public static void main(String[] args) { new test08(null); } }
#include class NewInt { int num; public: NewInt(int n=0):num(n) {printf("cons\n");} int getInt() const {return num;} void setInt(int n){num =n;} ~NewInt(){printf("Dest\n");} }; int main() { NewInt a[5]; for(int i=0;i<=5;i++) a[i].setInt(i+10); for(int i=0;i<=5;i++) printf("%d\n",a[i].getInt()); return 0; } What does the above code snippet do?
Which of the following operators cannot be overloaded?
Which of the following cannot be inherited?
What happens when the following code is compiled and run. Select the one correct answer. for(int i = 1; i < 3; i++) for(int j = 3; j >= 1; j--) assert i!=j : i;
class C1 { static interface I { static class C2 { } } public static void main(String a[]) { C1.I.C2 ob1=new C1.I.C2(); System.out.println("object created"); } } What is the result of attempting to compile and run the program?
class base { base() { System.out.println("base"); } base(int i1) { } } class Super extends base { Super() { System.out.println("super"); super(1); } public static void main(String [] a) { base b1=new Super(); } }
The "switch" selection structure must end with the default case.
The modulus operator (%) in Java can be used only with variables of integer type.