Difference between revisions of "Interview Questions"

From Hawk Wiki
Jump to: navigation, search
(Object-oriented programming)
(JavaScript)
Line 13: Line 13:
 
complex data structure<br>
 
complex data structure<br>
  
 +
==PHP==
 +
===abstract class===
 +
Can not be Instantiable.(cannot become instant. Can only be inherited)<br>
 +
<pre>
 +
abstract class Fruit {
 +
private $color;
 +
 +
abstract public function eat()
 +
 +
public function setColor($c) {
 +
  $this->color = $c;
 +
}
 +
}
 +
</pre>
 
==JavaScript==
 
==JavaScript==
 
Closure.  
 
Closure.  

Revision as of 00:52, 17 February 2012

Some Translation

n! Multiplicative

Object-oriented programming

Check here Interview_Questions(OOP)

C/C++

ArrayList Vs LinkedList

ArrayList: fast random access
slow at delete
memory fill up issue
LinkedList: slow random access
quick delete
no memory fill up issue
complex data structure

PHP

abstract class

Can not be Instantiable.(cannot become instant. Can only be inherited)

abstract class Fruit {
 private $color;

 abstract public function eat()

 public function setColor($c) {
  $this->color = $c;
 }
}

JavaScript

Closure.

<script>
function say667() {
  // Local variable that ends up within closure
  var num = 666;
  
  //var sayAlert = function() { alert(num); }
  return function() { num++; alert(num); };
}

var sayNumba = say667();
sayNumba();
sayNumba();
</script>

The example will keep var num in the memory. alert 667 and 668 on each call;