Thursday, July 10, 2014

Learning JavaScript Questions


1. What are the three layers of progressive enhancement?
    Structure, presentation, and behavior

2. What part of any website is flagged as the “most important” when we think about
progressive enhancement?
    Content

3. How does using progressive enhancement benefit performance?
    Progressive enhancement ensures that you are using the proper amount of code in the correct places, which promotes strong caching of the technologies in the browser

4. In which layer of progressive enhancement does JavaScript belong?
    The behavior layer

5. Why do you generally place JavaScript at the bottom of an HTML document?
    JavaScript at the bottom allows the entire document to load before JavaScript blocks the download of subsequent objects on the page.

6. What is the most widely supported method of persistent data storage in JavaScript?
    Cookies

7. What is an anonymous function?
    A function that is declared as it runs and has no assigned name

8. When is a function considered to be a callback function?
    When it is called by another function

9. How do you elicit feedback from a user?
    Through events

10. What are the four types of DOM nodes?
    Document, Element, Text, Attribute

11. Explain what the DOM is and how it relates to HTML and JavaScript.
    The DOM is a standardized outline of an HTML document that creates access points or “hooks” in the form of nodes by which JavaScript can enter.

12. What happens if you try to set a node attribute for an attribute that does not exist on the
node already?
    The attribute node will be created automatically and then set as normal.

13. What are the three data types you can use with a variable?
    Number, String, Boolean

14. What is an associative array?
    An associative array is a normal array that uses strings as index values instead of
numbers.

15. What is a multidimensional array?
    An array that contains other arrays

16. Why is it best to position all variables at the top of your JavaScript file?
    Variables cache in JavaScript, so it’s best to cache them all at once for better referencing.

17. Why are some words reserved in JavaScript?
    Reserved words are references to terms that already exist in the JavaScript language. Therefore, using them in your code would create unwanted collisions and errors.

18. How are anonymous functions different from basic functions?
    Anonymous functions execute immediately and have no label or name assigned to them

19. What is the difference between an event handler and an event listener?
    With event handlers, you can attach only a single function to a specific event of a DOM node. This limitation does not exist with event listeners.

20. What method is used for fallback support of event listeners in IE8 and earlier?
    attachEvent()

21. What is the purpose of the preventDefault() method?
    The preventDefault() method is used to stop the default browser behavior of a given event, such as stopping the browser from executing an href or a form submit.

22. What are the five possible arguments in the XMLHttpRequest open() method, and
which are optional?
    method , file/url , asynchronous username , password. username and password are optional.

23. What does Ajax stand for?
Ajax doesn’t stand for anything; it is simply a combination of technologies meant for server communication from the client.

24. What JavaScript method is typically used to make repeat Ajax calls?
    setInterval()

25. What are the four things you want to accomplish when building your JavaScript?
    The four things are
Get the code to work.
Get the code to work well.
Make the code easy to follow.
Make the code as reusable as possible.

26. Why shouldn’t you start a function or variable name with an underscore?
    In other languages an underscore signifies privacy, which doesn’t exist in JavaScript.

27. When is it best to use an anonymous function?
    When you want to use a block of code only once

28. What is a JavaScript library?
    A JavaScript library is a collection of functions and methods presented in a reusable format.

29. What is a plug-in?
    A plug-in is a built-in way to extend the functionality of a library.

30. What is a content delivery network?
    A content delivery network is a large distributed collection of servers that deliver content based on a user’s geographical location.

31. What are the four types of ARIA roles?
    Landmark, document structure, abstract, and widget

32. What information can be returned from the Battery Status API?
    Information from the battery API includes Level, Charging (true or false), chargingTime, and dischargingTime.

33. What connection types are returned from the Network Information API?
    The network information API returns the following connection types: 2G , 3G , WIFI , ETHERNET , and UNKNOWN .

34. What are the mouse-event counterparts of touchstart , touchmove , and touchend ?
    mousedown , mousemove , and mouseup/click

35. What are the four types of events that can be created by the createEvent() method?
    UIEvents , MouseEvents , MutationEvents , and HTMLEvents

36. What are JavaScript templates used for?
    JavaScript templates are used to process and structure data inside an HTML document.




   
   

Friday, April 5, 2013

CodeIgniter – Interview Questions

1).Code Igniter is a _____
a).Object Oriented Concept
b).PHP Library without Web Server
c).Application Development Framework
d).Content Management System

2).Which of the following is not true about CodeIgniter
a).It is light weight
b).It is fast
c).It uses MVC
d).It uses Delphi Modelling Techniques

3).The separation of logic and presentation can be seen in which of the following?
a).MVC approach
b).Simpleton approach
c).Master/Slave Model
d).Semaphore Model

4).The urls generated by CodeIgniter are search-engine friendly and clean because they use
a).Query String approach
b).Segment based approach
c).Keyword based approach
d). SEO based approach

5).One way to remove the index.php file in CodeIgniter is by using a
a).MVC file
b).root file
c)..htaccess file
d).settings file

6).Which of the following cannot be used to extend CodeIgniter System
a).Library
b).Helper
c).System Hooks
d).Jar files

7).The reason why CodeIgniter does not use a template engine is because
a).To reduce codebase
b).To improve performance
c).To reduce core files
d).To reduce system files

8).Query string URLs cannot be used in CodeIgniter
a).True
b).False
c).Can be used in the latest version
d). None

9).example.com/class/function/ID. The first segment in this example represents
a).Controller class
b).Controller variable
c).Library class
d).Library variable

10).example.com/class/function/ID. The second segment in this example represents
a).Controller class
b).Controller Function
c).Library class
d).Library Function

11).If you want a url like this, example.com/index.php/products/view/email.codeigniter what should you do?
a).Use a controller called do codeigniter
b).Disable query strings
c).Use URL Suffix
d). All of the above

12).In the url example.com/index.php/blog/ what is the controller name?
a).example
b).index
c).blog
d).None

13).You usually save your controller in which of the following folder?
a).application/system/controllers
b).application/controllers
c).application
d).application/helper

14).Your custom controller should
a).extend the child controller
b). extend the super class
c). extend the super controller
d). extend the parent controller

15).In this url, example.com/index.php/products/shoes/sandals/123, shoes is
a).function
b).controller name
c).first variable
d).None

16).To load a default controller what should you do?
a).Give the default controller name
b).Always inherit the parent controller
c).specify this in application/config/routes.php
d).Add a setting to application/config.php

17).The second segment of the URI typically determines
a).Which controller should be called
b).which function in the controller gets called.
C).which system library to load
d).All of the above

18).If your controller contains a function named _remap() which of the following is true?
a).It will always get called regardless of what the URI contains.
b).It overrides the normal behavior in which the URI determines which function to call
c).CodeIgniter permits user to override normal behavior through the use of the _remap() function
d). All of the above

19).CodeIgniter has which output class that takes care of sending your final rendered data to the web browser automatically.
a).View class
b).Output class
c).Controller Class
d).Routing Class

20).Which of the following is a private function in codeigniter?
a)._utility
b).Utility
c).utility_private
d).private_utility

21).If you want to use a constructor in any of the Controllers, which of the following is necessary to achieve this?a).parent::__construct();
b).child::__construct();
c).parent::controller();
d).super::controller()

22).Which of the following is a reserved name and hence cannot be used to name the controller:
a).CI_Base
b).index
c).Default
d).All

23).A ____ is a web page or a page fragment like a header, footer etc
a).Controller
b).Hook
c).Teaser
d).View

24).Which of the following is NOT true about Views?
a).views can flexibly be embedded within other views
b).view must be loaded by a controller
c).views can be called directly
d).views may or may not contain html

25).In the following, $this->load->view(‘name’); what does ‘name ‘ stand for?
a).config parameter
b).view name
c).parent view name
d).controller class name

26). Which of the following is designed to work with information in your database?
a).Controller
b).Model
c).Sql Query
d).Library

27).If you have a model class like this:
1
2
3
4
5
6
class User_model extends CI_Model
{    function __construct()
    {
        parent::__construct();
    }
}
What will be the file name when this class is saved as a model?
a).User_model
b).user_model
c).user_Model
d).User_Model

28).If a model is located in a sub-folder like, application/models/blog/queries.php what is the right way to load this model?a).$this->load->model(‘queries’);
b).$this->load->model(‘model/blog/queries’);
c).$this->load->model(‘blog/queries’);
d).$this->load->model(‘application/models/blog/queries’);

29).If you have a model called “Admissions”, what is the right way to access a function within this model if the model is assigned to a different object name like ‘fubar’?
a). $this->load->model(‘Admissions’, ‘fubar’); $this->fubar->function();
b). $this->load->model(‘Admissions’, ‘fubar’); $this->Admissions->function();
c). $this->load->model(‘Admissions’, ‘fubar’); $this->admin->function();
d). $this->load->model(‘Admissions’, ”); $this->fubar->function();

30).If you want to auto load a model what will you do?
a).Load it then and there using $this->load->model()
b).Load it when the parent model loads
c).Add the model to application/config/autoload.php
d).Remove the model from application/config/autoload.php

31).When a model is loaded
a).it is connected automatically to your database.
b).it does NOT connect automatically to your database.
c).it connects to database if you have set the config file properly
d).it connects ONLY if persistent connection is enabled

32). In the following database connectivity settings for a model, which of the following config is invalid?
1
2
3
4
5
6
7
8
9
10
$config['hostname'] = "localhost";
$config['username'] = "myusername";
$config['password'] = "mypassword";
$config['database'] = "mydatabase";
$config['dbdriver'] = "mysql";
$config['dbprefix'] = "";
$config['pconnect'] = FALSE;
$config['db_debug'] = TRUE;
$config['shared_pool_size'] = '200M';
$this->load->model('Model_name', '', $config);
a).$config['hostname']
b).$config['username']
c).$config['pconnect']
d).$config['shared_pool_size']
Answers to the above questions:
12345678910
CDABCDBBAB
11121314151617181920
CCBDACADBA
21222324252627282930
ADDCBBBCAC
3132
BD

a).Object Oriented Concept b).PHP Library without Web Server c).Application Development Framework d).Content Management System