HTML/Javascript Questions

1. Write html code to show the following talbe

header 1header 2header 3header 4
rc11rc12rc13rc14
rc21rc23rc24
rc31rc32rc33rc34
rc41rc42rc44

2. Write html code to show the given text with a list

Given text:
line 1
line 2
line 3
Excepted:
  1. line 1
  2. line 2
  3. line 3

3. Write html code to change word color

I have red color.

4. Write html code to show the following form

User name: *

5. Write javascript code to change User name value as Superman

6. Explain how form validation works?

7. What is different form method "get" and "post"? Explain when we should use post method?

8. Change text content

Given: I am old content.
Expected: This is awesome!
The following content will be changed by click button "Change content"

I am old content

9. How many ways to create object in javascript? Give an example for each way.

There are three ways to create object in javascript.
  1. Using an Object Literal
    var person = {
        firstName:"John",
        lastName:"Doe",
        age:50,
        eyeColor:"blue",
        sayHello: function() {
          console.log("Hello!");
        }
    };
                      
  2. Using the JavaScript Keyword name="viewport"
    var person = new Object();
    person.firstName = "John";
    person.lastName = "Doe";
    person.age = 50;
    person.eyeColor = "blue";
                      
  3. Using an Object Constructor
    function person(first, last, age, eye) {
        this.firstName = first;
        this.lastName = last;
        this.age = age;
        this.eyeColor = eye;
        this.sayHello = function() {
          console.log("Hello.";
        }
    }
    var myFather = new person("John", "Doe", 50, "blue");
    var myMother = new person("Sally", "Rally", 48, "green");
                      

10. Write an object with method sayHello. The message print "Hello" on javascript console.

see examples in previous quesiton.

PHP Questions

1. How to declare an array?

$season=array("summer","winter","spring","autumn");
$salary=array("Sonoo"=>"350000","John"=>"450000","Kartik"=>"200000");

2. What is isset() function?

The isset() function checks if the variable is defined and not null.

3. How to get the length of string

The strlen() function is used to get the length of string.

4. What is the difference between session and cookie?

  1. cookies are stored on user's computer in the text file format while sessions are stored on the server side.
  2. Cookies can't hold multiple variables on the other hand Session can hold multiple variables.
  3. You can manually set an expiry for a cookie, while session only remains active as long as browser is open.

5. How can we get IP address of a client in PHP?

$_SERVER["REMOTE_ADDR"];

6. Differentiate between require and include?

Require and include both are used to include a file, but if file is not found include sends warning whereas require sends Fatal error.

WordPress Questions

1. What is the difference between WordPress posts and pages?

2. How can you disable WordPress comment?

You can disable the WordPress comment on dashboard. On the dashboard, under the options- discussion you will find "Allow people to post comment". Uncheck this to disable comment.

3. How to allow only registered users to comment in WordPress?

If you don't want a comment from a new user on your blog, check the option "Users must be registered and logged in to comment" from Discussions under the Settings option.

4. How can you handle the situation if your WordPress site is hacked?

You should follow these steps:

5. Explain moderate comment in WordPress.

Comments by visitors on a post are not published directly unless it is approved by the admin. This is called moderation. To change comment moderation setting, select Settings option from the dashboard and check the option "Comment must be manually approved".

Drupal

1. What are system requirements for Drupal installation?

System requirements for Drupal 8:
  1. Web server: Apache, Nginx, or Microsoft IIS
  2. Database: MySQL 5.5.3/MariaDB 5.5.20/Percona Server 5.5.8 or higher with PDO and an InnoDB-compatible primary storage engine, PostgreSQL 9.1.2 or higher with PDO, SQLite 3.6.8 or higher
  3. PHP 5.5.9 or higher
  4. PHP Memory: 60 MB

2. What does PDO mean in Drupal?

PDO stands for PHP Data Object. It is a lean and consistent way to access databases. It facilitates developers to write portable codes easily. PDO is not an abstraction layer. It is more like a data access layer which uses a unified API.

3. What is DRUSH in Drupal?

DRUSH is a command line shell and UNIX scripting interface for Drupal.

4. How will you add custom PHP codes in Drupal pages or blocks?

Be default, Drupal doesn't allow the insertion of PHP codes in its pages. To embed PHP codes, you need to activate a Drupal module called PHP filter. By default, this module remains disabled.

How to interact with Drupal search systems?

There are three ways to interact with Drupal search system by implementing:
  1. nodeapi (update index)
  2. hook_search()
  3. hook_update_index()

5. Explain hooks in Drupal.

Drupal integrates well with external search engines such as Xapian, Apache solr if the built-in search engine does not meet your needs properly.

6. What is node in Drupal?

Drupal treats all the stored content on its web site as nodes. Any piece of content like blog, article, page, etc is considered as node. Although, the comments are not stored as nodes but they are always connected to a node.

Data Structure

1. What are Binary trees?

A Binary Tree is a type of data structure that has two nodes: A left node and a right node. In programming, binary trees are actually an extension of the linked list structures.

2. What is a Stack?

A stack is a data structure in which only the top element can be accessed. As data is stored in the stack, each data is pushed downward, leaving the most recently added data on top.

3. What is a linked list in data structure?

A linked list is a sequence of nodes in which each node is connected to the node following it. It makes a chain like link of data storage.

4. When should you use binary search engine?

A binary search algorithm is used to search a list when the elements are already in order or sorted. The list starts searching in the middle, if the middle value is not the target search key, it will check to see if it will continue the search on the lower half of the list or the higher half. The split and search will then continue in the same manner.

5. What is the difference between PUSH and POP?

PUSH and POP operations specify how data is stored and retrieved in a stack.
PUSH: PUSH specifies that data is being "pushed" into the stack.
POP: POP specifies data retrieval, and in particular refers to the topmost data being accessed.

SQL

1. What are the different types of joins in SQL?

Joins are used to merge two tables or retrieve data from tables. It depends on the relationship between tables.
Following are the most commonly used joins in SQL:

2. What is Inner Join in SQL?

Inner join returns rows when there is at least one match of rows between the tables.

3. What is Right Join in SQL?

Right join is used to retrieve rows which are common between the tables and all rows of Right hand side table. It returns all the rows from the right hand side table even though there are no matches in the left hand side table.

4. What is Left Join in SQL?

Left join is used to retrieve rows which are common between the tables and all rows of Left hand side table. It returns all the rows from Left hand side table even though there are no matches in the Right hand side table.

5. What is Full Join in SQL?

Full join return rows when there are matching rows in any one of the tables. This means, it returns all the rows from the left hand side table and all the rows from the right hand side table.

6. Write an SQL query to find names of employee start with 'A'?

SELECT * FROM Employees WHERE EmpName like 'A%'

7. What is the difference between DELETE and TRUNCATE statement in SQL?

1) DELETE is a DML command. TRUNCATE is a DDL command.
2) We can use WHERE clause in DELETE command. We cannot use WHERE clause with TRUNCATE
3) DELETE statement is used to delete a row from a table TRUNCATE statement is used to remove all the rows from a table.
4) DELETE is slower than TRUNCATE statement. TRUNCATE statement is faster than DELETE statement.
5) You can rollback data after using DELETE statement. It is not possible to rollback after using TRUNCATE statement.

8. What are the subsets of SQL?

  1. Data definition language (DDL)
  2. Data manipulation language (DML)
  3. Data control language (DCL)

9. What is data definition language?

Data definition language(DDL) allows you to CREATE, ALTER and DELETE database objects such as schema, tables, view, sequence etc.

10. What is data manipulation language?

Data manipulation language makes user able to access and manipulate data. It is used to perform following operations.

11. What is data control language?

Data control language allows you to control access to the database. It includes two commands GRANT and REVOKE.
GRANT: to grant specific user to perform specific task.
REVOKE: to cancel previously denied or granted permissions.