Java and Perl Programming Fundamentals
Test your knowledge of Java and Perl programming languages including data types, methods, inheritance, serialization, arrays, hashes, and language-specific features.
Questions
Perl has
- 8 data types
- 7 data types
- 16 data types
- No special data types
Scalar Variable in perl is preceded by a
- $
- #
- @
- None of the above
A Hash variable in perl is preceded by a
- $
- %
- #
- @
What are the functions used to add elements in an array
- Push and unshift
- Push and shift
- Pop and push
- Shift and unshift
Which function is used to remove a key – value pair from hash
- Remove
- Unhash
- Delete
- Rub
From below , which are all available as default options in perl
- -v
- -w
- -k
- -d
PERL is an acronym of
- Powerful Encryption and Report Language
- Practical Extraction and Report Language
- Practical Emotional and Rational Language
- Powerful Execution and Riding Language
Select two methods that correctly overload the following method? (Assume that all necessary packages have been imported). byte bMethod(short i) throws Exception {...}
- int bMethod(int i) throws IOException{...}
- protected int bMethod(short s) throws FileNotFoundException{...}
- private String aMethod(byte b,short s) throws Exception{...}
- char bMethod(String s) throws RuntimeException{...}
- int bMethod(short sh){...}
Which of the following statements are infinite loops? Select two correct answers
- for(int i=10;i>0;i-=-2);
- for(int i=0;i<012;i=i++);
- for(int i=0;i<0;i--);
- for(int i=0;(i++^--i)==0;i++);
- for(int i=010;i==10;i+=0);
Select two methods that correctly override the following method? (Assume that all necessary packages have been imported). protected int aMethod(int i) throws IOException {...}
- int aMethod(int i) throws IOException{...}
- protected int aMethod(int i) throws FileNotFoundException{...}
- public int aMethod(int i) throws Exception{...}
- public int aMethod(byte i) throws IOException{...}
- protected int aMethod(int i) throws IOException,FileNotFoundException{...}
Select three correct statements.
- A static method may override another static method.
- A static method cannot override a non-static method.
- A non-static method cannot override a static method.
- A non-static method may be overloaded by a static method.
- A synchronized method cannot be overridden.
Command to execute a compiled java programs is
- run
- execute
- javac
- java
Which of the following denote methods of HttpServlet class?
- doGet()
- doTrace()
- doOptions()
- All the Above
Which of the following helps in garbage collection?
- final
- finally
- finalize
- finalizer
What is the output of the following code? import java.util.*; public class Example { final Vector v; public Example() { } }
- The above code will not compile, Vector v is not initialized.
- The above code will compile and throw a Runtime Exception
- The above code will compile and not throw any Exception during runtime. V is initialized to null
- None of the Above.
What does the following expression return? Math.max(Float.POSITIVE_INFINITY,Double.POSITIVE_INFINITY);
- Float.POSITIVE_INFINITY
- Double.POSITIVE_INFINITY
- runtime Exception
- None of the Above
The class that inherits is called a
- superclass
- subclass
- instance class
- None of the Above
The process of writing the state of an object to a byte stream is called as
- Deserialization
- Serialization
- Interface
- None
What is the output of the following piece of code? if(" String ".trim() == "String") System.out.println("Welcome"); else System.out.println("Good Bye");
- The code will compile and print "Welcome"
- The code will compile and print "Good Bye"
- The code will cause a compiler error
- None of the Above
What is the number of bytes used by Java primitive long?
- The number of bytes is compiler dependent
- 2
- 4
- 8