Java and Systems Programming Quiz

Test your knowledge of Java programming, Unix/Linux systems programming, and Windows/.NET development concepts

19 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

how can we provide authetication in Windows Service, So that it will not ask for user credentials at the time of installation

  1. By reading context values from command prompt
  2. By hard coding the user credentials in Windows Service file
  3. both are correct
  4. both are incorrect
Question 2 Multiple Choice (Single Answer)

Which contract is used in WCF Service for Exceptions

  1. Message Contract
  2. Exception Contract
  3. Fault COntract
  4. None of the above
Question 3 Multiple Choice (Single Answer)

Which of the following statements is incorrect for MVC

  1. MVC Framework and MVC Pattern are same
  2. in MVC the flow of execution is determined by controller
  3. Routing is used to redirect user to specific page
  4. Model corresponds Database, View corresponds User Interface and Controller handles
Question 4 Multiple Choice (Single Answer)

how can we provide authetication in Windows Service, So that it will not ask for user credentials at the time of installation

  1. By reading context values ( User Authentication Details) from command prompt
  2. By hard coding the user credentials in Windows Service file
  3. both are correct
  4. both are incorrect
Question 5 Multiple Choice (Single Answer)

Which contract is used in WCF Service for Exceptions

  1. Message Contract
  2. Exception Contract
  3. Fault COntract
  4. None of the above
Question 6 Multiple Choice (Single Answer)

class A { public void main(String args[]) { System.out.println("Hello World!"); } } What is the output of the program?

  1. Hello World!
  2. "Hello World!"
  3. Compilation Fails
  4. Runtime Exception
Question 7 Multiple Choice (Single Answer)

Consider this as a part of a code which has no compilation errors or runtime exceptions 21.Integer i1=1000; 22.Integer i2=1000; 23.System.out.println(i1==i2); what is the output?

  1. true
  2. false
  3. compilation fails at line 21
  4. compilation fails at line 22
Question 8 Multiple Choice (Single Answer)

class A { public static void main(String args[]) { System.out.println(args.length); } } what is the output if the code is run using command line invocation java A

  1. NullPointerException
  2. Compilation fails
  3. 0
  4. 1
Question 9 True/False

int[] a,b[] and int a[],b[] are same??

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

Which one of these are JVM thrown exceptions??

  1. NullPointerException
  2. NumberFormatException
  3. ExceptionInInitializerError
  4. IllegalArgumentException
Question 11 Multiple Choice (Multiple Answers)

Which one of these are true regarding inheritance in java??

  1. A class can extend multiple classes
  2. An interface can extend multiple classes
  3. An interface can implement multiple interfaces
  4. A class can extend multiple interfaces
  5. A class can implement multiple interfaces
  6. An interface can extend multiple interfaces
Question 12 Multiple Choice (Single Answer)

Given a part of code tell the output(Assume that the code is perfect ie no compiler error or runtime exceptions) Pattern p=Pattern.compile("\d+"); Matcher m=p.matcher("345678"); while(m.find()) { System.out.print("-"+m.group()+"-"); }

  1. -345678-
  2. -3--4--5--6--7--8-
  3. -3--34--345--3456--34567--345678-
  4. -345678--345678--345678--345678--345678--345678--345678-
Question 13 Multiple Choice (Single Answer)

Consider the following code snippet String s1="Hello"; String s2=s1; s1.concat("World"); System.out.println(s1+"---"+s2); What is the output??

  1. Hello---Hello
  2. Hello---HelloWorld
  3. HelloWorld---Hello
  4. HelloWorld---HelloWorld
Question 14 Multiple Choice (Multiple Answers)

Which one of these are legal combinations when used with a method??

  1. abstract final
  2. abstract static
  3. static final
  4. private abstract
Question 15 Multiple Choice (Single Answer)

class A { public void add(int,int) { System.out.println("Normal"); } public void add(int... a) { System.out.println("Varargs"); } public static void main(String... args) { new A().add(9,9); } } what is the output??

  1. Varargs
  2. Normal
  3. Compilation Fails
  4. Runtime Exception
Question 16 Multiple Choice (Single Answer)

Inode contains the following fields?

  1. File owner and File type
  2. File access permission and File access tie
  3. Number of Links, File size and Location of the file data
  4. All of the above
Question 17 Multiple Choice (Single Answer)

In a crontab the job to be executed is scheduled as follows . 10 06 * 8 6 Job to be scheduled Which of the following statement is true?

  1. Command will be executed on every Sunday in 06:10 in September
  2. Command will be executed on every Saturday at 10:06 in August
  3. Command will be executed on every Sunday at 10:06 in September
  4. Command will be executed on every Saturday at 6:10 in August
Question 18 Multiple Choice (Single Answer)

How can I forward all the arguments given to my script to another command? Here Command is the name of the command to be execute.

  1. Command “@$”
  2. command \${@:+"\$@"}
  3. command \${"\$@+@:”}
  4. Command “$?”
Question 19 Multiple Choice (Single Answer)

The fork() system call is used for the following process management

  1. To increase/decrease the data segment size of a process
  2. To create a new process
  3. To bias the existing priority of a process
  4. To get parent process identifier