Programming Languages Quiz - Java, JSP, Servlets & Perl
Test your knowledge of multiple programming languages including Java, JSP, Servlets, and Perl. Questions cover core concepts, web technologies, memory management, and language-specific features.
Questions
Method-Overloading implements the principle of Compile-time Polymorphism, wheras Method Over-riding implements the concept of Runtime Polymorphism.
- True
- False
JVM is the compiler for Java.
- True
- False
How many objects are created in the below code...????
String s="abc";
String s1=new String("def");
- 1 Object
- 2 Objects
- 3 Objects
- 4 Objects
What is the concept Below???
class A {
int x=10;
};
class B extends A {
int x=100;
show() {
System.out.println(x);
}
public static void main(String... s) {
B b1=new B();
b1.show();
}
};
The program will print 100. But the concept illustrated is----
- Data Shadowing
- Data Over-riding
- Data Obscuring
- None of the Above
What is the output??(Easy One)
String s1="Java";
String s2="Java";
String s3=new String("Java");
String s4=new String("Java");
if(s1==s2) System.out.print("true");
else System.out.println("false");
if(s3==s4) System.out.print("true");
else System.out.println("false");
if(s1==s3) System.out.print("true");
else System.out.println("false");
if(s2==s3.intern()) System.out.print("true");
else System.out.println("false");
if(s3.intern()==s2.intern()) System.out.print("true");
else System.out.println("false");
Just try and get the Ouput---(Ignore any errors)
- true false true false true
- true false false true true
- true false false false true
- true false true false false
Variables are not interpolated inside which operator when used normally?
- " "
- < >
- ' '
- / /
The regex /g.d?c*/ doesn't match
- godccc
- gddd
- goc
- gc
What is the outcome of the scenario on Unix platform: open(FH, ">c:\temp\notes.txt") ?
- Opens a file notes.txt
- fails to create a file and displays error
- fails to open a file but doesn't display error
- Opens a file but not notes.txt
$a=[ { name=> "rose", kids=> [ qw( ted bobby john ) ] }, { name=> "marge", kids=> [ qw( maggie lisa bart ) } ]
- A list of hashes which contains a list
- A hash of hashes which contains a list
- A list of list which contains another list
- A list of arrays and hashes containing lists
What happens when @_ is modified?
- when arrays and references are passed
- only when references are passed
- args are not changed
- Command line args are changed
%abc = %\$def which option is correct when $def = \%any_hash ?
- all key value pairs are copied but in random order
- all key value pairs are copied in proper order
- all key value pairs from def may not be copied into abc
- syntax error
what is the output for printf ("%06.2f", $amt) when $amt = 9.355 ?
- 9.3550
- 9.4
- 009.40
- Error
($t, @u, $v, @w ) = qw( India US Japan Spain Mexico China ). How many elements are assigned to @u,@w?
- 1 and 2
- 5 and 0
- 1 and 3
- none of the above
Out of below four cases
- -5+5
- " "
- 0X0
- "0.00" + 0
- 1 and 4
- 2 and 4
- 3 and 1
- 2 and 3
- &complex_num();
- complex_num();
which is correct?
- 1 can only be called with predecleration of complex_num
- 1 and 2 are same
- 2 can only be called with predecleration of complex_num
- 1 is reference to a subroutine
Can we use the constructor, instead of init(), to initialize servlet?
- Yes
- No
- May Be
- Can't Say
Which of the following should NOT be used to share data between servlets in a distributed web application?
- Attributes of ServletContext
- Enterprise Java Beans
- Attributes of HttpSession
- Database
Can we call destroy() method on servlets from service method ?
- Yes
- No
- May be
- Cant Say
Which jsp implicit object is synchronized?
- session
- page
- application
- None of the above
Can we implement an interface in JSP ?
- Yes
- No
- May be
- Cant say