Java Programming and Unix Fundamentals

A quiz covering Java programming fundamentals including language syntax, servlets, and web development, along with Unix/Linux system administration commands and concepts.

20 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

How can we give an pass phrase (like password) to a file ,to restrict its access ?

  1. vim +X file
  2. vim -X file
  3. vim -p file
  4. vim +p file
Question 2 True/False

Linux aliases are recursive!!

  1. True
  2. False
Question 3 Multiple Choice (Multiple Answers)

What are the extended regular expression operators?

  1. +
  2. ?
  3. ^
  4. !
  5. *
Question 4 Multiple Choice (Single Answer)

Usually , system information present in this folder (in a unix system)?

  1. /sys
  2. /proc
  3. both
  4. none
Question 5 Multiple Choice (Single Answer)

In which scenario ,tail is being used for real time log file monitoring?

  1. tail -r logfile
  2. tail -n 5 logfile
  3. tail -f logfile
  4. tail -x logfile
Question 6 Multiple Choice (Single Answer)

What must be implemented by all Servlets?

  1. Servlet Interface
  2. servlet mapping
  3. Servlet Container
  4. None of the Above
Question 7 Multiple Choice (Single Answer)

Which of the following denote the type of protocol supported by HttpServlet?

  1. HTTP
  2. HTTPS
  3. Both (A) and (B)
  4. None of the Above
Question 8 Multiple Choice (Single Answer)

What is the number of bytes used by Java primitive long?

  1. The number of bytes is compiler dependent
  2. 2
  3. 4
  4. 8
Question 9 Multiple Choice (Single Answer)

Choose the false statement among these?

  1. Servlets are server side components
  2. Applets have GUI interface
  3. Servlets have GUI interface
  4. Applets are client side components
Question 10 Multiple Choice (Single Answer)

Implementations of servlets includes what?

  1. Apache web server
  2. java.net.HttpURLConnection class
  3. Java web server Tomcat
  4. None of the Above
Question 11 Multiple Choice (Single Answer)

Which of the following helps in garbage collection?

  1. final
  2. finaly
  3. finalize
  4. finalizer
Question 12 Multiple Choice (Single Answer)

Consider the following piece of code byte x = 0; x += 1;

  1. Results in x having the value 1.
  2. Causes a compiler error.
  3. Will require a cast (byte) before 1.
  4. Will give syntax error.
Question 13 Multiple Choice (Single Answer)

What will be the result of compiling following code public class SampleClass { final int j ; public static void main(String[] arguments) { System.out.println(new SampleClass().j); } }

  1. The output is 0
  2. Will give compile error
  3. Will give runtime error
  4. The output is 1
Question 14 Multiple Choice (Single Answer)

What is the output of the following code for exampleprint(1)? static void exampleprint(int inputitem) { if (inputitem == 0) { System.out.print("*"); } else { System.out.print("["); exampleprint(inputitem - 1); System.out.print(","); exampleprint(inputitem - 1); System.out.println("]"); } }

  1. *
  2. [,]
  3. ,,*
  4. None of the Above
Question 15 Multiple Choice (Single Answer)

All the wrapper classes (Integer, Boolean, Float, Short, Long, Double and Character)

  1. Are public
  2. Are final
  3. Are Serializable
  4. All the above
Question 16 Multiple Choice (Single Answer)

Which of the following statement is False?

  1. The throw keyword denotes a statement that causes an exception to be initiated
  2. A class that is declared without any access modifiers is said to have package or friendly access
  3. A class inherit the constructors of its superclass
  4. The primitive types are byte, char, short, int, long, float, double, and boolean
Question 17 Multiple Choice (Single Answer)

Which of the following is used to check in particular page the session will be alive or not?

  1. ifAlive()
  2. checkAlive()
  3. isAlive()
  4. None of the above
Question 18 Multiple Choice (Single Answer)

Choose the correct statement from the given choice?

  1. Arrays in Java are essentially objects
  2. It is not possible to assign one array to another. Individual elements of array can however be assigned.
  3. Array elements are indexed from 1 to size of array
  4. If a method tries to access an array element beyond its range, a compile warning is generated.
Question 19 Multiple Choice (Single Answer)

A constructor is used to

  1. Free memory
  2. Initialize a newly created object
  3. Import packages
  4. Create a JVM for applets
Question 20 Multiple Choice (Single Answer)

What does the following expression return? Math.max(Float.POSITIVE_INFINITY,Double.POSITIVE_INFINITY);

  1. Float.POSITIVE_INFINITY
  2. Double.POSITIVE_INFINITY
  3. runtime Exception
  4. None of the Above