Looking for Object Oriented Programming test answers and solutions? Browse our comprehensive collection of verified answers for Object Oriented Programming at lms.upes.ac.in.
Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!
What is the output?
public class Demo implements Runnable{ public static void main(String args[]) { Runnable t = new Demo(); t.start(); } public void run() { System.out.println("Task"); }}
/**/
document.oncopy = new Function("return false");
document.onpaste = new Function("return false");
document.onselectstart = new Function("return false");
document.oncontextmenu = new Function("return false"); /**/
What is the output?
public class Demo{ public static void main(String args[]){ try{ int a[]=new int[5]; a[5]=30/0; } catch(Exception e){System.out.println("C1");} catch(ArithmeticException e){System.out.println("C2");} catch(ArrayIndexOutOfBoundsException e){System.out.println("C3");} System.out.println("Output"); } }
/**/
document.oncopy = new Function("return false");
document.onpaste = new Function("return false");
document.onselectstart = new Function("return false");
document.oncontextmenu = new Function("return false"); /**/
What is the output?
public class Demo{ void m(){ int x = 50/0; System.out.println("1"); } void n(){ m(); System.out.println("2"); } void p(){ try{ n(); }catch(Exception e){System.out.println("3");} } public static void main(String args[]){ Demo obj=new Demo(); obj.p(); System.out.println("4"); } }
/**/
document.oncopy = new Function("return false");
document.onpaste = new Function("return false");
document.onselectstart = new Function("return false");
document.oncontextmenu = new Function("return false"); /**/
What happens if run() is called directly instead of start() in Java threads?
/**/
document.oncopy = new Function("return false");
document.onpaste = new Function("return false");
document.onselectstart = new Function("return false");
document.oncontextmenu = new Function("return false"); /**/
What is the output?
public class Outer { public static void method() { interface IF { void greet(); System.out.println("Hi"); } class Inner implements IF { public void greet() { System.out.println("Hello"); } } Inner in = new Inner(); in.greet(); } public static void main(String[] args) { method(); System.out.println("Bye"); }}
/**/
document.oncopy = new Function("return false");
document.onpaste = new Function("return false");
document.onselectstart = new Function("return false");
document.oncontextmenu = new Function("return false"); /**/
What is the output?
public class Outer { public void method() { class Inner { static final String a = "Hello"; public void greet() { System.out.println(a); } } new Inner().greet(); } public static void main(String[] args) { new Outer().method(); System.out.println("Bye"); }}
/**/
document.oncopy = new Function("return false");
document.onpaste = new Function("return false");
document.onselectstart = new Function("return false");
document.oncontextmenu = new Function("return false"); /**/
What does the T
in class Demo<T> {}
represent?
document.oncopy = new Function("return false");
document.onpaste = new Function("return false");
document.onselectstart = new Function("return false");
document.oncontextmenu = new Function("return false");
// Disable copy, paste, text selection, and right-click context menu
document.oncopy = new Function("return false");
document.onpaste = new Function("return false");
document.onselectstart = new Function("return false");
document.oncontextmenu = new Function("return false");
// Prevent new tab and new window shortcuts
window.addEventListener("keydown", function(event) {
if ((event.ctrlKey && event.key === 't') || (event.ctrlKey && event.key === 'n')) {
event.preventDefault();
alert("Opening a new tab or window is not allowed during the quiz.");
// Close the current tab or new window immediately
window.close();
}
});
// Detect and close the tab if the user tries to switch away from it
document.addEventListener("visibilitychange", function() {
if (document.visibilityState === "hidden") {
alert("Please stay on this tab to complete the quiz.");
// Reload the page if user tries to leave the tab
location.reload();
}
});
// Block certain key combinations for opening developer tools
window.addEventListener("keydown", function(event) {
if ((event.ctrlKey && event.shiftKey && event.key === 'i') || // Ctrl+Shift+I
(event.ctrlKey && event.shiftKey && event.key === 'j') || // Ctrl+Shift+J
(event.ctrlKey && event.shiftKey && event.key === 'c') || // Ctrl+Shift+C
(event.ctrlKey && event.key === 'u')) { // Ctrl+U
event.preventDefault();
alert("Developer tools are disabled during the quiz.");
}
});
document.oncopy = new Function("return false");
document.onpaste = new Function("return false");
document.onselectstart = new Function("return false");
document.oncontextmenu = new Function("return false");
What are generic methods?
/**/
document.oncopy = new Function("return false");
document.onpaste = new Function("return false");
document.onselectstart = new Function("return false");
document.oncontextmenu = new Function("return false"); /**/
/**/
document.oncopy = new Function("return false");
document.onpaste = new Function("return false");
document.onselectstart = new Function("return false");
document.oncontextmenu = new Function("return false"); /**/
In which line do you find an anonymous object being created?
class Student {public class MyClass { public static void main(String args[]) { Student obj = new Student(); //Line-1 Student obj1 = new Student(), obj2 = new Student(); //Line-2 new Student(); //Line-3 }}
/**/
document.oncopy = new Function("return false");
document.onpaste = new Function("return false");
document.onselectstart = new Function("return false");
document.oncontextmenu = new Function("return false"); /**/
Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!