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.
Questions
How can we give an pass phrase (like password) to a file ,to restrict its access ?
- vim +X file
- vim -X file
- vim -p file
- vim +p file
Linux aliases are recursive!!
- True
- False
What are the extended regular expression operators?
- +
- ?
- ^
- !
- *
Usually , system information present in this folder (in a unix system)?
- /sys
- /proc
- both
- none
In which scenario ,tail is being used for real time log file monitoring?
- tail -r logfile
- tail -n 5 logfile
- tail -f logfile
- tail -x logfile
What must be implemented by all Servlets?
- Servlet Interface
- servlet mapping
- Servlet Container
- None of the Above
Which of the following denote the type of protocol supported by HttpServlet?
- HTTP
- HTTPS
- Both (A) and (B)
- 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
Choose the false statement among these?
- Servlets are server side components
- Applets have GUI interface
- Servlets have GUI interface
- Applets are client side components
Implementations of servlets includes what?
- Apache web server
- java.net.HttpURLConnection class
- Java web server Tomcat
- None of the Above
Which of the following helps in garbage collection?
- final
- finaly
- finalize
- finalizer
Consider the following piece of code byte x = 0; x += 1;
- Results in x having the value 1.
- Causes a compiler error.
- Will require a cast (byte) before 1.
- Will give syntax error.
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); } }
- The output is 0
- Will give compile error
- Will give runtime error
- The output is 1
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("]"); } }
- *
- [,]
- ,,*
- None of the Above
All the wrapper classes (Integer, Boolean, Float, Short, Long, Double and Character)
- Are public
- Are final
- Are Serializable
- All the above
Which of the following statement is False?
- The throw keyword denotes a statement that causes an exception to be initiated
- A class that is declared without any access modifiers is said to have package or friendly access
- A class inherit the constructors of its superclass
- The primitive types are byte, char, short, int, long, float, double, and boolean
Which of the following is used to check in particular page the session will be alive or not?
- ifAlive()
- checkAlive()
- isAlive()
- None of the above
Choose the correct statement from the given choice?
- Arrays in Java are essentially objects
- It is not possible to assign one array to another. Individual elements of array can however be assigned.
- Array elements are indexed from 1 to size of array
- If a method tries to access an array element beyond its range, a compile warning is generated.
A constructor is used to
- Free memory
- Initialize a newly created object
- Import packages
- Create a JVM for applets
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