Programming Languages: Java, PHP & Algorithms

Test your knowledge of programming language fundamentals including Java OOP concepts, PHP basics, type systems, and algorithm complexity analysis.

20 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

Who is the loose character in java??

  1. class
  2. interface
  3. package
  4. data type
Question 2 True/False

JAVA 1.4 introduced the concept of Generics?

  1. True
  2. False
Question 3 True/False

PHP is a client- side scripting language?

  1. True
  2. False
Question 4 Multiple Choice (Single Answer)

PHP stands for?

  1. Pre Hypertext Processor
  2. Preprocessor Hypertext
  3. Hypertext Preprocessor
  4. Processor Hypertext Pre
Question 5 True/False

PHP is a loosely typed language?

  1. True
  2. False
Question 6 Multiple Choice (Single Answer)

Which are two statements for outputing the text in PHP?

  1. print and display
  2. display and echo
  3. println and display
  4. echo and print
Question 7 Multiple Choice (Single Answer)

Following code will result in: int a = 3.5;

  1. Compilation error
  2. Runtime error
  3. a being 3.5
  4. a being 3
Question 8 Multiple Choice (Single Answer)

Following code will result in: int a1 = 5; double a2 = (float)a1;

  1. Compilation error
  2. Runtime error
  3. Runtime exception
  4. No error
Question 9 Multiple Choice (Single Answer)

Following code will result in: int a = 9/0;

  1. Compilation error: Divisions must be in a try block.
  2. Compilation error: DivideByZeroException
  3. Runtime Exception - correct answer
  4. No Error: a is NaN
Question 10 Multiple Choice (Single Answer)

Following code will result in: float a = 9/0;

  1. Compilation error: Divisions must be in a try block
  2. Compilation error: DivideByZeroException
  3. Runtime Exception
  4. No Error: a is NaN
Question 11 Multiple Choice (Single Answer)

Following code will result in: class A { int b = 1; public static void main(String [] args) { System.out.println("b is " + b); }}

  1. Compilation error
  2. Runtime Error
  3. Runtime Exception
  4. Output of b is 1
Question 12 Multiple Choice (Single Answer)

Following code will result in: class A { public static void main(String [] args) {B b = new A(); }} class B extends A {}

  1. Compile error
  2. Runtime Exception
  3. No error
  4. Rintime Error
Question 13 Multiple Choice (Single Answer)

Following code will result in: class A { public static void main(String [] args) {A a = new B(); }} class B extends A {}

  1. Compiler error
  2. Runtime Exception
  3. No errors
  4. Runtime Error
Question 14 Multiple Choice (Single Answer)

If class A implements an interface does it need to implement all methods of that interface?

  1. Yes, always it should implement
  2. No, Never
  3. No, Not when A is abstract
  4. None of the above
Question 15 Multiple Choice (Single Answer)

The methods wait(), notify() and notifyAll() in Object need to be called from synchronized pieces of code.

  1. true
  2. false
  3. Depends on situation
  4. none of the above
Question 16 Multiple Choice (Single Answer)

A class cannot be declared

  1. volatile
  2. private
  3. default
  4. static
Question 17 Multiple Choice (Single Answer)

mainn() { main(); } This loop runs upto???

  1. Infinite loop
  2. Until Stack Underflow
  3. Until Machine Hangs
  4. Stack Overflow
Question 18 Multiple Choice (Single Answer)

Complexity of Quick Sort????(avg)

  1. O(n2)
  2. O(log n)
  3. O(nlogn)
  4. O(n2 logn)
Question 19 Multiple Choice (Single Answer)

Complexity Of Bubble Sort..???

  1. O(n)
  2. O(log n)
  3. O(n^2)
  4. O(n log n)
Question 20 Multiple Choice (Single Answer)

What is the difference between the types double and Double?

  1. double is primitive datatypes. Double is a class
  2. Both are primitive dataType
  3. Both are class type
  4. double is class and Double is primitive Type