Upwork MySQL Test latest

MySQL Test 2017

1. Which of the following are true in case of Indexes for MYISAM Tables?

Answers:

  1. Indexes can have NULL values
  2. BLOB and TEXT columns can be indexed
  3. Indexes per table cannot be more than 16
  4. Columns per index cannot be more than 16

2. Below is the table “messages,” please find proper query and result from the choices below.

Id Name Other_Columns
————————-
1 A A_data_1
2 A A_data_2
3 A A_data_3
4 B B_data_1
5 B B_data_2
6 C C_data_1

Answers:

  1. select * from (select * from messages GROUP BY id DESC) AS x ORDER BY name Result: 3 A A_data_3 5 B B_data_2 6 C C_data_1
  2. select * from messages where name =Desc Result: 1 A A_data_1 2 A A_data_2 3 A A_data_3
  3. select * from messages group by name Result: 1 A A_data_1 4 B B_data_1 6 C C_data_1
  4. Answer A and B

3. How can an user quickly rename a MySQL database for InnoDB?

Answers:

  1. He cannot rename any MySQL database
  2. By using: RENAME DATABASE db_old_name TO db_new_name
  3. By using: RENAME DATABASE TO db_new_name
  4. By creating the new empty database, then rename each table using: RENAME TABLE db_old_name.table_name TO db_new_name.table_name

4. Is it possible to insert several rows into a table with a single INSERT statement?

Answers:

  1. No
  2. Yes

5. Consider the following tables:

books

——

bookid

bookname

authorid

subjectid

popularityrating (the popularity of the book on a scale of 1 to 10)

language (such as French, English, German etc)

Subjects

———

subjectid

subject (such as History, Geography, Mathematics etc)

authors

——–

authorid

authorname

country
Which is the query to determine the Authors who have written at least 1 book with a popularity rating of less than 5?

Answers:

  1. select authorname from authors where authorid in (select authorid from books where popularityrating<5)
  2. select authorname from authors where authorid in (select authorid from books where popularityrating<=5)
  3. select authorname from authors where authorid in (select bookid from books where popularityrating<5)
  4. select authorname from authors where authorid in (select authorid from books where popularityrating in (0,5))

6. The Flush statement cannot be used for:

Answers:

  1. Closing any open tables in the table cache
  2. Closing open connections
  3. Flushing the log file
  4. Flushing the host cache

7. Consider the query:

SELECT name

FROM Students

WHERE name LIKE ‘_a%’;
Which names will be displayed?

Answers:

  1. Names starting with “a”
  2. Names containing “a” as the second lette
  3. Names starting with “a” or “A”
  4. Names containing “a” as any letter except the first

8. Which of the following is the best MySQL data type for currency values?

Answers:

  1. SMALLINT
  2. DECIMAL(19,4)
  3. VARCHAR(32)
  4. BIGINT

9. What are MySQL Spatial Data Types in the following list?

Answers:

  1. GEOMETRY
  2. CIRCLE
  3. SQUARE
  4. POINT
  5. POLYGON

10. Examine the two SQL statements given below:

SELECT last_name, salary, hire_date FROM EMPLOYEES ORDER BY salary DESC

SELECT last_name, salary, hire_date FROM EMPLOYEES ORDER BY 2 DESC

What is true about them?

Answers:

  1. The two statements produce identical results
  2. The second statement returns an error
  3. There is no need to specify DESC because the results are sorted in descending order by default
  4. None of the above statments is correct

11. Which of the following will raise MySQL’s version of an error?

Answers:

  1. SIGNAL
  2. RAISE
  3. ERROR
  4. None of these.

12. Which query will return values containing strings “Pizza”, “Burger”, or “Hotdog” in the database?

Answers:

  1. SELECT * FROM fiberbox WHERE field REGEXP ‘Pizza|Burger|Hotdog’;
  2. SELECT * FROM fiberbox WHERE field LIKE ‘%Pizza%’ OR field LIKE ‘%Burger%’ OR field LIKE ‘%Hotdog%’;
  3. SELECT * FROM fiberbox WHERE field = ‘%Pizza%’ OR field = ‘%Burger%’ OR field = ‘%Hotdog%’;
  4. SELECT * FROM fiberbox WHERE field = ‘?Pizza?’ OR field = ‘?Burger?’ OR field = ‘?Hotdog?’;

13. Which datatype is used to store binary data in MySQL?

Answers:

  1. BLOB
  2. BIGINT
  3. INT
  4. Both BLOB and BIGINT

14. Which of the following will reset the MySQL password for a particular user?

Answers:

  1. UPDATE mysql.user SET Password=PASSWORD(‘password’) WHERE User=’username’;
  2. UPDATE mysql.user SET Password=’password’ WHERE User=’username’;
  3. UPDATE mysql.user SET Password=RESET(‘password’) WHERE User=’username’;
  4. None of the above.

15. Which of the following is the best way to modify a table to allow null values?

Answers:

  1. ALTER TABLE table_name MODIFY column_name varchar(255) null
  2. ALTER TABLE table_name MODIFY column_name VARCHAR(255)
  3. ALTER TABLE table_name CHANGE column_name column_name type DEFAULT NULL
  4. ALTER table_name MODIFY column_name varchar(255) null

16. Which of the following will dump the whole MySQL database to a file?

Answers:

  1. mysql -e “select * from myTable” -u myuser -pxxxxxxxxx mydatabase > mydumpfile.txt
  2. mysql -e “select * from myTable” mydatabase > mydumpfile.txt
  3. SELECT * from myTable FIELDS TERMINATED BY ‘,’ ENCLOSED BY ‘”‘ LINES TERMINATED BY ‘n’
  4. None of the above.

17. Which of the following statements is true regarding character sets in MySQL?

Answers:

  1. The default character set of MySQL is UTF-8.
  2. lang.cnf sets the default character set for MySQL databases.
  3. SET CHARSET utf8 will set the character set of data to be imported to UTF-8.
  4. None of these.

18. Which of the following is an alternative to groupwise maximum ranking (ex. ROW_NUMBER() in MS SQL)?

Answers:

  1. Using subqueries
  2. Using variables in a MySQL query
  3. Using self-join
  4. MySQL also supports ROW_NUMBER()

19. Consider the following tables:

Books
——
BookId
BookName
AuthorId
SubjectId
PopularityRating (the popularity of the book on a scale of 1 to 10)
Language (such as French, English, German etc)

Subjects
———
SubjectId
Subject (such as History, Geography, Mathematics etc)

Authors
——–
AuthorId
AuthorName
Country

Which query will determine how many books have a popularity rating of more than 7 on each subject?

Answers:

  1. select subject,count(*) as Books from books,subjects where books.popularityrating > 7
  2. select subject,count(*) as Books from books,subjects where books.authorid=subjects.authorid and books.popularityrating > 7 group by subjects.subject
  3. select subject,count(*) as Books from books,subjects where books.subjectid=subjects.subjectid and books.popularityrating = 7 group by subjects.subject
  4. select subject,count(*) as Books from books,subjects where books.subjectid=subjects.subjectid and books.popularityrating > 7 group by subjects.subject

20. Which of the following statements are true about SQL injection attacks?

Answers:

  1. Wrapping all variables containing user input by a call to mysql_real_escape_string() makes the code immune to SQL injections.
  2. Parametrized queries do not make code less vulnearable to SQL injections.
  3. SQL injections are not possible, if only emulated prepared statements are used.
  4. Usage of later versions of MySQL, validation, and explicit setting of the charset of user input are valid measures to decrease vulnerability to SQL injections.

21. Which of the following is an alternative to Subquery Factoring (ex. the ‘WITH’ clause in MS SQL Server)?

Answers:

  1. The ‘IN’ clause
  2. Using temporary tables and inline views
  3. The ‘INNER JOIN’ clause
  4. Using subqueries

22. Suppose a table has the following records:

+————–+————-+—————-+
| Item | Price | Brand |
+————–+————-+—————-+
| Watch | 100 | abc |
| Watch | 200 | xyz |
| Glasses | 300 | bcd |
| Watch | 500 | def |
| Glasses | 600 | fgh |
+————–+————-+—————-+

Which of the following will select the highest-priced record per item?

Answers:

  1. select item, brand, price from items where max(price) order by item
  2. select * from items where price = max group by item
  3. select item, brand, max(price) from items group by item
  4. select * from items where price > 200 order by item

23. Which of the following will restore a MySQL DB from a .dump file?

Answers:

  1. mysql -u<user> -p < db_backup.dump
  2. mysql -u<user> -p<password> < db_backup.dump
  3. mysql -u<user> -p <password> < db_backup.dump
  4. mysql -u<user> -p<password> > db_backup.dump

24. Which of the following will show when a table in a MySQL database was last updated?

Answers:

  1. Using the following query: SELECT UPDATE_TIME FROM information_schema.tables WHERE TABLE_SCHEMA = ‘database_name’ AND TABLE_NAME = ‘table_name’
  2. Creating an on-update trigger to write timestamp in a custom table, then querying the custom table
  3. Getting the “last modified” timestamp of the corresponding database file in the file system
  4. None of these.

25. Which of the following results in 0 (false)?

Answers:

  1. “EXPERTRATING” LIKE “EXP%”
  2. “EXPERTRATING” LIKE “Exp%”
  3. BINARY “EXPERTRATING” LIKE “EXP%”
  4. BINARY “EXPERTRATING” LIKE “Exp%”
  5. All will result in 1 (true)

26. Which of the following relational database management systems is simple to embed in a larger program?

Answers:

  1. MySQL
  2. SQLite
  3. Both
  4. None

27. What is true about the ENUM data type?

Answers:

  1. An enum value may be a user variable
  2. An enum may contain number enclosed in quotes
  3. An enum cannot contain an empty string
  4. An enum value may be NULL
  5. None of the above is true

28. What will happen if two tables in a database are named rating and RATING?

Answers:

  1. This is not possible as table names are case in-sensitive (rating and RATING are treated as same name)
  2. This is possible as table names are case sensitive (rating and RATING are treated as different names)
  3. This is possible on UNIX/LINUX and not on Windows platform
  4. This is possible on Windows and not on UNIX/LINUX platforms
  5. This depends on lower_case_table_names system variable

29. How can a InnoDB database be backed up without locking the tables?

Answers:

  1. mysqldump –single-transaction db_name
  2. mysqldump –force db_name
  3. mysqldump –quick db_name
  4. mysqldump –no-tablespaces db_name

30. What does the term “overhead” mean in MySQL?

Answers:

  1. Temporary diskspace that the database uses to run some of the queries
  2. The size of a table
  3. A tablespace name
  4. None of the above

31. Consider the following select statement and its output:

SELECT * FROM table1 ORDER BY column1;
Column1

——–

1

2

2

2

2

2

3
Given the above output, which one of the following commands deletes 3 of the 5 rows where column1 equals 2?

Answers:

  1. DELETE FIRST 4 FROM table1 WHERE column1=2
  2. DELETE 4 FROM table1 WHERE column1=2
  3. DELETE WHERE column1=2 LIMIT 4
  4. DELETE FROM table1 WHERE column1=2 LIMIT 3
  5. DELETE FROM table1 WHERE column1=2 LEAVING 1

32. Consider the following queries:

create table foo (id int primary key auto_increment, name int);
create table foo2 (id int auto_increment primary key, foo_id int references foo(id) on delete cascade);

Which of the following statements is true?

Answers:

  1. Two tables are created
  2. If a row in table foo2, with a foo_id of 2 is deleted, then the row with id = 2 in table foo is automatically deleted
  3. Those queries are invalid
  4. If a row with id = 2 in table foo is deleted, all rows with foo_id = 2 in table foo2 are deleted

33. What is NDB?

Answers:

  1. An in-memory storage engine offering high-availability and data-persistence features
  2. A filesystem
  3. An SQL superset
  4. MySQL scripting language
  5. None of the above

34. Which of the following statements are true?

Answers:

  1. Names of databases, tables and columns can be up to 64 characters in length
  2. Alias names can be up to 255 characters in length
  3. Names of databases, tables and columns can be up to 256 characters in length
  4. Alias names can be up to 64 characters in length

35. Which of the following statements is used to change the structure of a table once it has been created?

Answers:

  1. CHANGE TABLE
  2. MODIFY TABLE
  3. ALTER TABLE
  4. UPDATE TABLE

36. What does DETERMINISTIC mean in the creation of a function?

Answers:

  1. The function returns no value
  2. The function always returns the same value for the same input
  3. The function returns the input value
  4. None of the above

37. Which of the following statements grants permission to Peter with password Software?

Answers:

  1. GRANT ALL ON testdb.* TO peter PASSWORD ‘Software’
  2. GRANT ALL ON testdb.* TO peter IDENTIFIED by ‘Software’
  3. GRANT ALL OF testdb.* TO peter PASSWORD ‘Software’
  4. GRANT ALL OF testdb.* TO peter IDENTIFIED by ‘Software’

38. What will happen if you query the emp table as shown below:

select empno, DISTINCT ename, Salary from emp;

Answers:

  1. EMPNO, unique value of ENAME and then SALARY are displayed
  2. EMPNO, unique value ENAME and unique value of SALARY are displayed
  3. DISTINCT is not a valid keyword in SQL
  4. No values will be displayed because the statement will return an error

39. Which of the following is the best way to disable caching for a query?

Answers:

  1. Add the /*!no_query_cache*/ comment to the query.
  2. Flush the whole cache with the command: FLUSH QUERY CACHE
  3. Reset the query cache with the command: RESET QUERY CACHE
  4. Use the SQL_NO_CACHE option in the query.

40. What is the maximum size of a row in a MyISAM table?

Answers:

  1. No limit
  2. OS specific
  3. 65,534
  4. 2’147’483’648
  5. 128

41. Can you run multiple MySQL servers on a single machine?

Answers:

  1. No
  2. Yes

42. Which of the following formats does the date field accept by default?

Answers:

  1. DD-MM-YYYY
  2. YYYY-DD-MM
  3. YYYY-MM-DD
  4. MM-DD-YY
  5. MMDDYYYY

43. State whether true or false:
In the ‘where clause’ of a select statement, the AND operator displays a row if any of the conditions listed are true. The OR operator displays a row if all of the conditions listed are true.

Answers:

  1. True
  2. False

44. What is the name of the utility used to extract NDB configuration information?

Answers:

  1. ndb_config
  2. cluster_config
  3. ndb –config
  4. configNd
  5. None of the above

45. Which one of the following must be specified in every DELETE statement?

Answers:

  1. Table Name
  2. Database name
  3. LIMIT clause
  4. WHERE clause

46. Which of the following are not Numeric column types?

Answers:

  1. BIGINT
  2. LARGEINT
  3. SMALLINT
  4. DOUBLE
  5. DECIMAL

47. Which of the following statements is true regarding multi-table querying in MySQL?

Answers:

  1. JOIN queries are faster than WHERE queries.
  2. WHERE queries are faster than JOIN queries.
  3. INNER queries are faster than JOIN queries.
  4. WHERE & INNER offer the same performance in terms of speed.

48. What is wrong with the following statement?

create table foo (id int auto_increment, name int);

Answers:

  1. Nothing
  2. The id column cannot be auto incremented because it has not been defined as a primary key
  3. It is not spelled correctly. It should be: CREATE TABLE foo (id int AUTO_INCREMENT, name int);

49. Consider the following table definition:

CREATE TABLE table1 (
column1 INT,
column2 INT,
column3 INT,
column4 INT
)

Which one of the following is the correct syntax for adding the column, “column2a” after column2, to the table shown above?

Answers:

  1. ALTER TABLE table1 ADD column2a INT AFTER column2
  2. MODIFY TABLE table1 ADD column2a AFTER column2
  3. INSERT INTO table1 column2a AS INT AFTER column2
  4. ALTER TABLE table1 INSERT column2a INT AFTER column2
  5. CHANGE TABLE table1 INSERT column2a BEFORE column3
  6. Columns are always added after the last column

50. Examine the data in the employees table given below:
last_name department_id salary

ALLEN 10 3000

MILLER 20 1500

King 20 2200

Davis 30 5000
Which of the following Subqueries will execute well?

Answers:

  1. SELECT * FROM employees where salary > (SELECT MIN(salary) FROM employees GROUP BY department_id);
  2. SELECT * FROM employees WHERE salary = (SELECT AVG(salary) FROM employees GROUP BY department_id);
  3. SELECT distinct department_id FROM employees Where salary > ANY (SELECT AVG(salary) FROM employees GROUP BY department_id);
  4. SELECT department_id FROM employees WHERE SALARY > ALL (SELECT AVG(salary) FROM employees GROUP BY department_id);
  5. SELECT department_id FROM employees WHERE salary > ALL (SELECT AVG(salary) FROM employees GROUP BY AVG(SALARY));

51. What privilege do you need to create a function?

Answers:

  1. UPDATE
  2. CREATE ROUTINE
  3. SELECT
  4. CREATE FUNCTION
  5. No specific privilege

52. What is wrong with the following query:

select * from Orders where OrderID = (select OrderID from OrderItems where ItemQty > 50)

Answers:

  1. In the sub query, ‘*’ should be used instead of ‘OrderID’
  2. The sub query can return more than one row, so, ‘=’ should be replaced with ‘in’
  3. The sub query should not be in parenthesis
  4. None of the above

53. Which of the following is a correct way to show the last queries executed on MySQL?

Answers:

  1. First execute SET GLOBAL log_output = ‘TABLE’; Then execute SET GLOBAL general_log = ‘ON’; The last queries executed are saved in the table mysql.general_log
  2. Edit the MySQL config file (mysql.con) and add the following line log = /var/log/mysql/mysql.log
  3. Execute VIEW .mysql_history
  4. Restart MySQL using the following line tail -f /var/log/mysql/mysql.log

54. Choose the appropriate query for the Products table where data should be displayed primarily in ascending order of the ProductGroup column. Secondary sorting should be in descending order of the CurrentStock column.

Answers:

  1. Select * from Products order by CurrentStock,ProductGroup
  2. Select * from Products order by CurrentStock DESC,ProductGroup
  3. Select * from Products order by ProductGroup,CurrentStock
  4. Select * from Products order by ProductGroup,CurrentStock DESC
  5. None of the above

55. What is the correct SQL syntax for returning all the columns from a table named “Persons” sorted REVERSE alphabetically by “FirstName”?

Answers:

  1. SELECT * FROM Persons WHERE FirstName ORDER BY FirstName DESC
  2. SELECT * FROM Persons SORT REVERSE ‘FirstName’
  3. SELECT * FROM Persons ORDER BY -‘FirstName’
  4. SELECT * FROM Persons ORDER BY FirstName DESC

56. You want to display the titles of books that meet the following criteria:

1. Purchased before November 11, 2002
2. Price is less than $500 or greater than $900

You want to sort the result by the date of purchase, starting with the most recently bought book.
Which of the following statements should you use?

Answers:

  1. SELECT book_title FROM books WHERE price between 500 and 900 AND purchase_date < ‘2002-11-11’ ORDER BY purchase_date;
  2. SELECT book_title FROM books WHERE price IN (500, 900) AND purchase_date< ‘2002-11-11’ ORDER BY purchase date ASC;
  3. SELECT book_title FROM books WHERE price < 500 OR>900 AND purchase_date DESC;
  4. SELECT book_title FROM books WHERE (price < 500 OR price > 900) AND purchase_date < ‘2002-11-11’ ORDER BY purchase_date DESC;

57. State whether true or false:
Transactions and commit/rollback are supported by MySQL using the MyISAM engine

Answers:

  1. True
  2. False

58. Consider the following table structure of students:

rollno int

name varchar(20)

course varchar(20)
What will be the query to display the courses in which the number of students enrolled is more than 5?

Answers:

  1. Select course from students where count(course) > 5;
  2. Select course from students where count(*) > 5 group by course;
  3. Select course from students group by course;
  4. Select course from students group by course having count(*) > 5;
  5. Select course from students group by course where count(*) > 5;
  6. Select course from students where count(group(course)) > 5;
  7. Select count(course) > 5 from students;
  8. None of the above

59. MySQL supports 5 different int types. Which one takes 3 bytes?

Answers:

  1. TINYINT
  2. MEDIUMINT
  3. SMALLINT
  4. INT
  5. BIGINT

60. Which of the following is the correct way to determine duplicate values?

Answers:

  1. SELECT column_duplicated, sum(*) amount FROM table_name WHERE amount > 1 GROUP BY column_duplicated
  2. SELECT column_duplicated, COUNT(*) amount FROM table_name WHERE amount > 1 GROUP BY column_duplicated
  3. SELECT column_duplicated, sum(*) amount FROM table_name GROUP BY column_duplicated HAVING amount > 1
  4. SELECT column_duplicated, COUNT(*) amount FROM table_name GROUP BY column_duplicated HAVING amount > 1

61. Examine the query:-

select (2/2/4) from tab1;

where tab1 is a table with one row. This would give a result of:

Answers:

  1. 4
  2. 2
  3. 1
  4. .5
  5. .25
  6. 8
  7. 24

62. Which of the following commands will list the tables of the current database?

Answers:

  1. SHOW TABLES
  2. DESCRIBE TABLES
  3. SHOW ALL TABLES
  4. LIST TABLES

63. Which of the following is not a MySQL statement?

Answers:

  1. ENUMERATE
  2. EXPLAIN
  3. KILL
  4. LOAD DATA
  5. SET

64. When running the following SELECT query:

SELECT ID FROM (
SELECT ID, name FROM (
SELECT *
FROM employee
)
);

The error message ‘Every derived table must have its own alias’ appears.
Which of the following is the best solution for this error?

Answers:

  1. SELECT ID FROM ( SELECT ID AS SECOND_ID, name FROM ( SELECT * FROM employee ) );
  2. SELECT ID FROM ( SELECT ID, name AS NAME FROM ( SELECT * FROM employee ) );
  3. SELECT ID FROM ( SELECT ID, name FROM ( SELECT * FROM employee ) AS T ) AS T;
  4. SELECT ID AS FIRST_ID FROM ( SELECT ID, name FROM ( SELECT * FROM employee ) );

65. Which of the following is not a Table Storage specifier in MySQL?

Answers:

  1. InnoDB
  2. MYISAM
  3. BLACKHOLE
  4. STACK

66. The REPLACE statement is:

Answers:

  1. Same as the INSERT statement
  2. Like INSERT, except that if an old row in the table has the same value as a new row for a PRIMARY KEY or a UNIQUE index, the old row is deleted before the new row is inserted
  3. There is no such statement as REPLACE

67. If you try to perform an arithmetic operation on a column containing NULL values, the output will be:

Answers:

  1. NULL
  2. An error will be generated
  3. Cannot be determined

68. Which of the following is the best way to insert a row, and to update an existing row, using a MySQL query?

Answers:

  1. Use MERGE statement
  2. Use INSERT … ON DUPLICATE KEY UPDATE statement
  3. Use ADD UNIQUE statement
  4. Use REPLACE statement

69. How will you change “Hansen” into “Nilsen” in the LastName column in the Persons Table?

Answers:

  1. UPDATE Persons SET LastName = ‘Nilsen’ WHERE LastName = ‘Hansen’
  2. UPDATE Persons SET LastName = ‘Hansen’ INTO LastName = ‘Nilsen’
  3. SAVE Persons SET LastName = ‘Nilsen’ WHERE LastName = ‘Hansen’
  4. SAVE Persons SET LastName = ‘Hansen’ INTO LastName = ‘Nilsen’

70. Which one of the following correctly selects rows from the table myTable that have NULL in column column1?

Answers:

  1. SELECT * FROM myTable WHERE column1 IS NULL
  2. SELECT * FROM myTable WHERE column1 = NULL
  3. SELECT * FROM myTable WHERE column1 EQUALS NULL
  4. SELECT * FROM myTable WHERE column1 NOT NULL
  5. SELECT * FROM myTable WHERE column1 CONTAINS NULL

71. Is the FROM clause necessary in every SELECT statement?

Answers:

  1. Yes
  2. No

72. Which command will make a backup on the whole database except the tables sessions and log?

Answers:

  1. mysqldump db_name sessions log > backup.sql
  2. mysqldump db_name | grep -vv -E “sessions|log” > backup.sql
  3. mysqldump db_name –ignore-table db_name.sessions db_name.log > backup.sql
  4. mysqldump db_name –except-table=db_name.sessions –except-table=db_name.log > backup.sql

73.Which of the following statements is true?

Answers:

  1. Replication can be a part of a load balancing strategy.
  2. Replication and clustering are complete synonyms in the context of MySQL server administration.
  3. MySQL supports only master-slave replication.
  4. MySQL does not support master-master replication.

74. Which of the following is not a valid Arithmetic operator?

Answers:

    1. +
    2. *
    3. \
    4. %
    5. All are valid

75. What are MySQL Spatial Data Types in the following list?

Answers:

      1. GEOMETRY
      2. CIRCLE
      3. SQUARE
      4. POINT
      5. POLYGON

76. Which of the following statements relating to Alias names is true?

Answers:

      1. Alias names are case sensitive
      2. Alias names are case sensitive
      3. Alias names are case in-sensitive
      4. Alias names are case sensitive on UNIX and not on Windows
      5. Alias names are case sensitive on Windows and not on UNIX
      6. Alias names case sensitivity depends on lower_case_table_names system setting

77. Examine the description of the STUDENTS table:

Answers:
STD_ID INT
COURSE_ID VARCHAR (10)
START_DATE DATE
END_DATE DATE
The aggregate functions valid on the START_DATE column are:

      1. SUM(start_date)
      2. AVG(start_date)
      3. COUNT(start_date)
      4. AVG(start_date, end_date)
      5. AVG(start_date, end_date)
      6. MIN(start_date)

78. Which of the following is the correct way to change the character set to UTF8?

Answers:
STD_ID INT
COURSE_ID VARCHAR (10)
START_DATE DATE
END_DATE DATE
The aggregate functions valid on the START_DATE column are:

      1. Add the following lines in my.cnf:
      2. default-character-set=utf8

        [mysqld]
        default-character-set = utf8

      1. dd the following lines in my.cnf:
        [mysqld]
        character_set_server = utf8
      2. Add the following lines in my.cnf:
        [mysqld]
        skip-character-set-client-handshake
        character_set_client=utf8
        character_set_server=utf8
      3. AVG(start_date, end_date)
      4. AVG(start_date, end_date)
      5. MIN(start_date)

78. To quote a string within a string, which of the following can you use?

Answers:
STD_ID INT
COURSE_ID VARCHAR (10)
START_DATE DATE
END_DATE DATE
The aggregate functions valid on the START_DATE column are:

      1. «This is the «quoted» message»
      2. «This is the «»quoted»» message»
      3. ‘This is the «quoted» message’
      4. «This is the \»quoted\» message»

79.SELECT employee_id FROM employees WHERE commission_pct=.5 OR salary > 23000;
Which of the following statements is correct with regard to this code?
Answers:

      1. It returns employees whose salary is 50% more than $23,000
      2. It returns employees who have 50% commission rate or salary greater than $23,000
      3. It returns employees whose salary is 50% less than $23,000
      4. None of the above

80.Select which of the following is the best way to duplicate MySql Database(DB1) in to another database(DB2) without using mysqldump?

Answers:

      1. Create the target database using MySQLAdmin,
      2. Execute the following MySql query CREATE TABLE t2 SELECT * FROM t1;
      3. Execute the following MySql query CREATE TABLE x LIKE other_db.y;
      4. CREATE TABLE DB2 SELECT * FROM DB1;

81.Which of the following statement will results in 0 (false)?

Answers:

      1. SELECT «EXPERTRATING» LIKE «EXP%»
      2. SELECT «EXPERTRATING» LIKE «Exp%»
      3. SELECT BINARY «EXPERTRATING» LIKE «EXP%»
      4. SELECT BINARY «EXPERTRATING» LIKE «Exp%»
      5. All will result in 1 (true)

82.Which query will display data from the Pers table relating to Analyst, Clerk and Salesman who joined between 1/1/2005 and 1/2/2005 ?

Answers:

      1. select * from Pers where joining_date from #1/1/2005# to #1/2/2005#, job=Analyst or clerk or salesman
      2. select * from Pers where joining_date between #1/1/2005# to #1/2/2005#, job=Analyst or job=clerk or job=salesm
      3. select * from Pers where joining_date between #1/1/2005# and #1/2/2005# and
      4. None of the above

83. How can a InnoDB database be backed up without locking the tables?

Answers:

      1. mysqldump –single-transaction db_name
      2. mysqldump –force db_name
      3. mysqldump –quick db_name
      4. mysqldump –no-tablespaces db_name

85. Which of the following is not a valid Bit operator?

Answers:

      1. &
      2. &&
      3. <<
      4. |
      5. >>

86. What is the main purpose of InnoDB over MyISAM?

Answers:

      1. InnoDB is thread safe
      2. InnoDB provides a transaction safe environment
      3. InnoDB can handle table with more than 1000 columns
      4. InnoDB provides FULLTEXT indexes
      5. None of the above

87. View the following Create statement:
1. Create table Pers
2. (EmpNo Int not null,
3. EName Char not null,
4. Join_dt Date not null,
5. Pay Int)
Answers:

      • 1
      • 2
      • 3
      • 4
      • 5

88.What will happen if some of the columns in a table are of char datatype and others are of varchar datatype?

Answers:

      • Nothing will happen
      • MySQL will generate an error
      • MySQL will convert all varchar datatypes into char
      • MySQL will convert all char datatypes into varchar

89.If you insert (00) as the value of the year in a date column, what will be stored in the database?

Answers:

      • 0000
      • 1900
      • 2000
      • Ambiguous, cannot be determined

90.Which of the following statements is true is regards to whether the schema integration problem between development, test, and production servers can be solved?

Answers:

      • True, only can create migration solution in .NET programming language.
      • True, it can be solve by migration solution. These solutions vary by programming language.
      • Both A and B
      • None of the above

91. Which of the following is not a valid Logical operator?

Answers:

      1. &
      2. &&
      3. AND
      4. NOT

92. What is true regarding the TIMESTAMP data type?

Answers:

      1. For one TIMESTAMP column in a table, you can assign the current timestamp as the default value and the auto-update value
      2. TIMESTAMP columns are NOT NULL by default, cannot contain NULL values, and assigning NULL assigns the current timestamp
      3. When the server runs with the MAXDB SQL mode enabled, TIMESTAMP is identical with DATETIME
      4. A TIMESTAMP column cannot have a default value
      5. None of the above is true

93. Which of the following is not a SQL operator?

Answers:

      1. Between..and..
      2. Like
      3. In
      4. Is null
      5. Not in
      6. All of the above are SQL operators

94. Which of the following is not a SQL operator?

Answers:

      1. Between..and..
      2. Like
      3. In
      4. Is null
      5. Not in
      6. All of the above are SQL operators

95.Which of the following is not a valid Comparison operator?

Answers:

      1. ==
      2. <=>
      3. !=
      4. <>
      5. REGEXP
      6. All of the above are SQL operators

96.What will happen if you write the following statement on the MySQL prompt?
SELECT NOW();

Answers:

      1. It will display the current date
      2. It will display the error message as now does not exist.
      3. It will display a syntax error near ‘()’

97.Assuming the column col1 in table tab1 has the following values:
2,3,NULL,2,3,1
What will be the output of the select statement below?
SELECT count(col1) FROM tab1

Answers:

      1. 6
      2. 5
      3. 4
      4. 3

98. What is the correct SQL syntax for selecting all the columns from the table Persons where the LastName is alphabetically between (and including) «Hansen» and «Pettersen»?
CREATE TABLE `Persons` (
`LastName` varchar(244) NOT NULL DEFAULT »
) ENGINE=InnoDB;
REPLACE INTO Persons VALUE (‘Hansen’),(‘Pettersen’),(‘Nilsen’),(‘Smith’);

Answers:

      1. SELECT * FROM Persons WHERE LastName > ‘Hansen’, LastName <‘Pettersen’
      2. SELECT LastName > ‘Hansen’ AND LastName < ‘Pettersen’ FROM Persons
      3. SELECT * FROM persons WHERE LastName > ‘Hansen’ AND LastName > ‘Pettersen’
      4. SELECT * FROM Persons WHERE LastName BETWEEN ‘Hansen’ AND ‘Pettersen’

99.Which of the following statements is correct in regards to the syntax of the code below?
SELECT table1.this, table2.that, table2.somethingelse
FROM table1
INNER JOIN table2 ON table1.foreignkey = table2.primarykey
WHERE (some other conditions)

Answers:

      1. Using the older syntax is more subject to error. If use inner joins without an ON clause, will get a syntax error.
      2. INNER JOIN is ANSI syntax. It is generally considered more readable, especially when joining lots of tables. It can also be easily replaced with an OUTER JOIN whenever a need arises
      3. (INNER JOIN) ON will filter the data before applying WHERE clause. The subsequent join conditions will be executed with filtered data which makes better performance. After that only WHERE condition will apply filter conditions.
      4. All of the Above

100.Considering table foo has been created with:create table foo (id int primary key auto_increment, name varchar(100));
Is the following query syntactically valid?
delete from foo where id = id-1;

Answers:

      1. Yes
      2. No

101.The STUDENT_GRADES table has these columns:
STUDENT_ID INT
SEMESTER_END DATE
GPA FLOAT

Which of the following statements finds the highest Grade Point Average (GPA) per semester?
Answers:

      1. SELECT MAX(GPA) FROM STUDENT_GRADES WHERE GPA IS NOT NULL
      2. SELECT GPA FROM STUDENT_GRADES GROUP BY SEMESTER_END
      3. SELECT MAX(GPA) FROM STUDENT_GRADES GROUP BY SEMESTER_END
      4. SELECT TOP 1 GPA FROM STUDENT_GRADES GROUP BY SEMESTER_END
      5. None of the above

102.Which of the following queries is valid?
Answers:

      1. Select * from students where marks > avg(marks);
      2. Select * from students order by marks where subject = ‘SQL’;
      3. Select * from students having subject =’SQL’;
      4. Select name from students group by subject, name;
      5. Select group(*) from students;
      6. Select name,avg(marks) from students;
      7. None of the above

103.Which of the following are aggregate functions in MySQL?
Answers:

    1. Avg
    2. Select
    3. Order By
    4. Sum
    5. Union
    6. Group by
    7. Having

Upwork Latest Javascript Test 2017

Javascript Test

1. Which of the following Array methods in JavaScript runs a function on every item in the Array and collects the result from previous calls, but in reverse?

Answers:

  1. reduce()
  2. reduceRight()
  3. everse()
  4. pop()

2. Which of the following is true about setTimeOut()?

Answers:

  1. The statement(s) it executes run(s) only once.
  2. It pauses the script in which it is called.
  3. clearTimeOut() won’t stop its execution.
  4. The delay is measured in hundredths of a second.
  5. It is required in every JavaScript function.

3. How can the operating system of the client machine be detected?

Answers:

  1. It is not possible using JavaScript.
  2. Using the navigator object
  3. Using the window object
  4. Using the document object
  5. None of these.

4. Which of the following prints “AbBc”?

Answers:

  1. var b = ‘a’; var result = b.toUpperCase() + ‘b’ + ‘b’.toUpperCase() +’C'[‘toLowerCase’](); alert(result);
  2. var b = ‘a’; var result = b.toUpperCase() + ‘b’ + ‘b’.toUpperCase() +’c'[‘toUpperCase’](); alert(result);
  3. var b = ‘a’; var result = b.toUpperCase() + b + ‘b’.toUpperCase() +’C'[‘toLowerCase’](); alert(result);
  4. var b = ‘a’; var result = b.toUpperCase() + ‘b’ + ‘b’.toUpperCase() +C; alert(result);

5. Which of the following descriptions is true for the code below?

var object0 = {};
Object.defineProperty(object0, “prop0”, { value : 1, enumerable:false, configurable : true });
Object.defineProperty(object0, “prop1”, { value : 2, enumerable:true, configurable : false });
Object.defineProperty(object0, “prop2”, { value : 3 });
object0.prop3 = 4;

Answers:

  1. Object ‘object0’ contains 4 properties. Property ‘prop2’ and property ‘prop3’ are available in the for…in loop. Property ‘prop0’ and property ‘prop1’ are available to delete.
  2. Object ‘object0’ contains 4 properties. Property ‘prop1’ and property ‘prop2’ are available in the for…in loop. Property ‘prop2’ and property ‘prop3’ are available to delete.
  3. Object ‘object0’ contains 4 properties. Property ‘prop0’ and property ‘prop2’ are available in the for…in loop. Property ‘prop0’ and property ‘prop2’ are available to delete.
  4. Object ‘object0’ contains 4 properties. Property ‘prop1’ and property ‘prop3’ are available in the for…in loop. Property ‘prop0’ and property ‘prop3’ are available to delete.

6. Performance-wise, which is the fastest way of repeating a string in JavaScript?

Answers:

  1. String.prototype.repeat = function( num ) { return new Array( num + 1 ).join( this ); }
  2. function repeat(pattern, count) { if (count < 1) return ”; var result = ”; while (count > 0) { if (count & 1) result += pattern; count >>= 1, pattern += pattern; } return result; }
  3. String.prototype.repeat = function(count) { if (count < 1) return ”; var result = ”, pattern = this.valueOf(); while (count > 0) { if (count & 1) result += pattern; count >>= 1, pattern += pattern; } return result; };
  4. String.prototype.repeat = function (n, d) { return –n ? this + (d || ”) + this.repeat(n, d) : ” + this };

7. Consider the following variable declarations:

var a=”adam”
var b=”eve”

Which of the following would return the sentence “adam and eve”?

Answers:

  1. a.concatinate(“and”, b)
  2. a.concat(“and”, b)
  3. a.concatinate(” and “, b)
  4. a.concat(” and “, b)

8. Which of the following code snippets will correctly split “str”?

Answers:

  1. var str = ‘something — something_else’; var substrn = str.split(‘ — ‘);
  2. var str = ‘something — something_else’; var substrn = split.str(‘ — ‘);
  3. var str = ‘something — something_else’; var substrn = str.split(‘ – ‘,’ – ‘);
  4. var str = ‘something — something_else’; var substrn = split.str(‘ – ‘,’ – ‘);

9. Which object can be used to ascertain the protocol of the current URL?

Answers:

  1. document
  2. window
  3. history
  4. browser
  5. form
  6. location

10. Which of the following best describes a “for” loop?

Answers:

  1. “for” loop consists of six optional expressions, enclosed in parentheses and separated by semicolons, followed by a statement executed in the loop.
  2. “for” loop consists of five optional expressions, enclosed in parentheses and separated by semicolons, followed by a statement executed in the loop.
  3. “for” loop consists of four optional expressions, enclosed in parentheses and separated by semicolons, followed by a statement executed in the loop.
  4. “for” loop consists of three optional expressions, enclosed in parentheses and separated by semicolons, followed by a statement executed in the loop.

11. Which of the following descriptions best describes the code below?


var variable1 = { fastFood: “spaghetti”, length: 10 };
Object.freeze(variable1);
variable1.price = 50;
delete variable1.length;

Answers:

  1. Object is frozen, a property named “price” is added in the variable1 object, a property named “length” is deleted from this object. At the end of the code, the object “variable1” contains 2 properties.
  2. Object is frozen, a property named “price” is not added in the variable1 object, a property named “length” is deleted from this object. At the end of the code, object “variable1” contains 1 properties.
  3. Object is frozen, a property named “price” is added in the variable1 object, a property named “length” is not deleted from this object. At the end of the code, object “variable1” contains 1 properties.
  4. Object is frozen, a property named “price” is not added in the variable1 object, a property named “length” is not deleted from this object. At the end of the code, object “variable1” contains 2 properties.

12. Which of the following is not a valid HTML event?

Answers:

  1. ondblclick
  2. onmousemove
  3. onclick
  4. onblink

13. Analyze the following code snippet which uses a Javascript Regular Expression character set. What will be the output of this code?

<html>
<body>


var str = “Is this enough?”;
var patt1 = new RegExp(“[^A-J]”);
var result = str.match(patt1);
document.write(result);

</body>
</html

Answers:

  1. I
  2. Is
  3. s
  4. I,s,

14. Consider the following image definition:
<img id=”logo” src=”companylogo1.gif” height=”12″ width=”12″ >
Which of the following will change the image to companylogo2.gif when the page loads?

Answers:

  1. logo.source=”companylogo2.gif”
  2. logo.source=”companylogo1.gif”
  3. document.getElementById(‘logo’).src=”companylogo1.gif”
  4. document.getElementById(‘logo’).src=”companylogo2.gif”

15. What is the final value of the variable bar in the following code?

var foo = 9;
bar = 5;
(function() {
var foo = 2;
bar= 1;
}())
bar = bar + foo;

Answers:

  1. 10
  2. 14
  3. 3
  4. 7

16. Which of the following are JavaScript unit testing tools?

Answers:

  1. Buster.js, jQuery, YUI Yeti
  2. QUnit, Modernizr, JsTestDriver
  3. Node.js, Modernizr, Jasmine
  4. Buster.js, YUI Yeti, Jasmine

17. Which of the following can be used for disabling the right click event in Internet Explorer?

Answers:

  1. event.button == 2
  2. event.button == 4
  3. event.click == 2
  4. event.click == 4

18. An image tag is defined as follows:
<img id=”ERImage” width=”100″ height=”100″ onmouseover=”ImageChange()” src=”Image1.jpg”>
The purpose of the ImageChange() function is to change the image source to Image2.jpg. Which of the following should the ImageChange() function look like?

Answers:

  1. document.getElementById(‘ERImage’).src=”Image1.jpg”
  2. document.getElementById(‘ERImage’).src=”Image2.jpg”
  3. document.getElementById(‘ERImage’).style.src=”Image1.jpg”
  4. document.getElementById(‘ERImage’).style.src=”Image2.jpg”

19. Consider the following JavaScript alert:

function message() {
alert(“Welcome to ExpertRating!!!”)
}

Which of the following will run the function when a user opens the page?

Answers:

  1. body onload=”message()”
  2. body onunload=”message()”
  3. body onsubmit=”message()”
  4. body onreset=”message()”

20. Which of the following code snippets will correctly get the length of an object?

Answers:

  1. var newObj = new Object(); newObj[“firstname”] = “FirstName”; newObj[“lastname”] = “LastName”; newObj[“age”] = 21; Object.size = function(obj) { var size = 0, key; for (key in obj) { if (obj.hasOwnProperty(index)) size++; } return size; }; var size = Object.size(newObj);
  2. var newObj = new Object(); newObj[“firstname”] = “FirstName”; newObj[“lastname”] = “LastName”; newObj[“age”] = 21; Object.size = function(obj) { var size = 0, key; for (key in obj) { if (obj.hasOwnProperty(value)) size++; } return size; }; var size = Object.size(newObj);
  3. var newObj = new Object(); newObj[“firstname”] = “FirstName”; newObj[“lastname”] = “LastName”; newObj[“age”] = 21; Object.size = function(obj) { var size = 0, key; for (key in obj) { if (obj.hasOwnProperty(length)) size++; } return size; }; var size = Object.size(newObj);
  4. var newObj = new Object(); newObj[“firstname”] = “FirstName”; newObj[“lastname”] = “LastName”; newObj[“age”] = 21; Object.size = function(obj) { var size = 0, key; for (key in obj) { if (obj.hasOwnProperty(key)) size++; } return size; }; var size = Object.size(newObj);

21. In an HTML page, the form tag is defined as follows:
<form onsubmit=”return Validate()” action=”http://www.mysite.com/”>
The validate() function is intended to prevent the form from being submitted if the name field in the form is empty. What should the validate() function look like?

Answers:

  1. function Validate() { if(document.forms[0].name.value == “”) return true; else return false; }
  2. function Validate() { if(document.forms[0].name.value == “”) return false; else return true; }
  3. script type=”text/javascript”> function Validate() { if(document.forms[0].name== “”) return false; else return true; } </script>
  4. function Validate() { if(document.forms[0].name == “”) return true; else return false; }

22. Which of the following code snippets changes an image on the page?

Answers:

  1. var img = document.getElementById(“imageId”); img.src = “newImage.gif”;
  2. var img = document.getElementById(“imageId”); img.style.src = “newImage.gif”;
  3. var img = document.getElementById(“imageId”); img.src.value = “newImage.gif”;
  4. var img = document.getElementById(“imageId”); img = “newImage.gif”;

23. Which of the following results is returned by the JavaScript operator “typeof” for the keyword “null”?

Answers:

  1. function
  2. object
  3. string
  4. number

24. What will be the final value of the variable “apt”?

var apt=2;
apt=apt<<2;

Answers:

  1. 2
  2. 4
  3. 6
  4. 8
  5. 16

25. How can a JavaScript object be printed?

Answers:

  1. console.log(obj)
  2. console.print(obj)
  3. console.echo(obj);
  4. None of these

26. Which of the following is the correct syntax for using the JavaScript exec() object method?

Answers:

  1. RegExpObject.exec()
  2. RegExpObject.exec(string)
  3. RegExpObject.exec(parameter1,parameter2)
  4. None of these

27. Having an array object var arr = new Array(), what is the best way to add a new item to the end of an array?

Answers:

  1. arr.push(“New Item”)
  2. arr[arr.length] = “New Item”
  3. arr.unshift(“New Item”)
  4. arr.append(“New Item”)

28. Consider the following JavaScript validation function:

function ValidateField()
{
if(document.forms[0].txtId.value ==””)
{return false;}

return true;
}
Which of the following options will call the function as soon as the user leaves the field?

Answers:

  1. input name=txtId type=”text” onreset=”return ValidateField()”
  2. input name=txtId type=”text” onfocus=”return ValidateField()”
  3. input name=txtId type=”text” onsubmit=”return ValidateField()”
  4. input name=txtId type=”text” onblur=”return ValidateField()”

29. Which of following uses the “with” statement in JavaScript correctly?

Answers:

  1. with (document.getElementById(“blah”).style) { background = “black”; color = “blue”; border = “1px solid green”; }
  2. with document.getElementById(“blah”).style background = “black”; color = “blue”; border = “1px solid green”; End With
  3. With document.getElementByName(“blah”).style background = “black”; color = “blue”; border = “1px solid green”; End With
  4. with (document.getElementById(“blah”).style) { .background = “black”; .color = “blue”; .border = “1px solid green”; }

30. Consider the following JavaScript validation function:


function ValidateField()
{
if(document.forms[0].txtId.value ==””)
{return false;}

return true;
}

Which of the following options will call the function as soon as the user leaves the field?

Answers:

  1. input name=txtId type=”text” onreset=”return ValidateField()”
  2. input name=txtId type=”text” onfocus=”return ValidateField()”
  3. input name=txtId type=”text” onsubmit=”return ValidateField()”
  4. input name=txtId type=”text” onblur=”return ValidateField()”

31. Which of the following modifiers must be set if the JavaScript lastIndex object property was used during pattern matching?

Answers:

  1. i
  2. m
  3. g
  4. s

32. Consider the following image definition:

<img id=”logo” src=”companylogo1.gif” height=”12″ width=”12″ >

Which of the following will change the image to “companylogo2.gif” when the page loads?

Answers:

  1. logo.source=”companylogo2.gif”
  2. logo.source=”companylogo1.gif”
  3. document.getElementById(‘logo’).src=”companylogo1.gif”
  4. document.getElementById(‘logo’).src=”companylogo2.gif”

33. Which of the following will check whether the variable vRast exists or not?

Answers:

  1. if (typeof vRast=”undefined”) {}
  2. if (typeof vRast ==”undefined”) {}
  3. if (vRast.defined =true) {}
  4. if (vRast.defined ==true) {}

34. What would be the use of the following code?

function validate(field) {
var valid=”ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz”;
var ok=”yes”;
var temp;

for(var i=0;i<field.value.length;i++) {
temp=”” + field.value.substring(i,i+1)

if(valid.indexOf(temp)==”-1”) {
ok=”no”;
}
}

if(ok==”no”) {
alert(”error”);
field.focus();
}
}

Answers:

  1. It will force a user to enter only numeric values.
  2. It will force a user to enter only alphanumeric values.
  3. It will force a user to enter only English alphabet character values.
  4. None of these.

35. An image tag is defined as follows:

<img id=”ERImage” width=”100″ height=”100″ onmouseover=”ImageChange()” src=”Image1.jpg”>

The purpose of the ImageChange() function is to change the image source to “Image2.jpg”. Which of the following should the ImageChange() function look like?

Answers:

  1. document.getElementById(‘ERImage’).src=”Image1.jpg”
  2. document.getElementById(‘ERImage’).src=”Image2.jpg”
  3. document.getElementById(‘ERImage’).style.src=”Image1.jpg”
  4. document.getElementById(‘ERImage’).style.src=”Image2.jpg”

36. Which of the following choices will detect if “variableName” declares a function?


var variableName= function(){};

Answers:

  1. return variableName;
  2. nameof variableName;
  3. isFunction variableName;
  4. typeof variableName;

37. Which of the following choices will change the source of the image to “image2.gif” when a user clicks on the image?

Answers:

  1. img id=”imageID” src=”image1.gif” width=”50″ height=”60″ onmousedown=”changeimg(image1.gif)” onmouseup=”changeimg(image2.gif)”
  2. img id=”imageID” src=”image1.gif” width=”50″ height=”60″ onmouseclick=”changeimg(image2.gif)” onmouseup=”changeimg(image1.gif)”
  3. img id=”imageID” src=”image2.gif” width=”50″ height=”60″ onmousedown=”changeimg(image1.gif)” onmouseup=”changeimg(image2.gif)”
  4. img id=”imageID” src=”image2.gif” width=”50″ height=”60″ onmousedown=”changeimg(image2.gif)” onmouseup=”changeimg(image1.gif)”
  5. img id=”imageID” src=”image1.gif” width=”50″ height=”60″ onmousedown=”changeimg(‘image2.gif’)” onmouseup=”changeimg(‘image1.gif’)”

38. How can created cookies be deleted using JavaScript?

Answers:

  1. They can’t be deleted. They are valid until they expire.
  2. Overwrite with an expiry date in the past
  3. Use escape() on the value of the path attribute
  4. Use unescape() on the value of the path attribute
  5. The cookie file will have to be removed from the client machine.
  6. Wait till the expiry date is reached

39. What would be the value of ‘ind’ after execution of the following code?

var msg=”Welcome to ExpertRating”
var ind= msg.substr(3, 3)

Answers:

  1. lco
  2. com
  3. ome
  4. Welcome

40. Are the two statements below interchangeable?

object.property
object[”property”]

Answers:

  1. Yes
  2. No

41. Which of the following is not a valid method in generator-iterator objects in JavaScript?

Answers:

  1. send()
  2. throw()
  3. next()
  4. stop()

42. Which of the following code snippets will return all HTTP headers?

Answers:

  1. var req = new XMLHttpRequest(); req.open(‘GET’, document.location, false); req.send(null); var headers = req.getAllResponseHeaders().toLowerCase(); alert(headers);
  2. var req = new XMLHttpAccess(); req.open(‘GET’, document.location, false); req.send(null); var headers = req.getAllResponseHeaders().toLowerCase(); alert(headers);
  3. var req = new XMLHttpRequest(); req.open(‘GET’, document.location, false); req.send(null); var headers = req.getResponseHeader().toLowerCase(); alert(headers);
  4. var req = new XMLHttpRequestHeader(); req.open(‘GET’, document.location, false); req.send(null); var headers = req.retrieveAllResponseHeaders().toLowerCase(); alert(headers);

43. Consider the following JavaScript alert:


function message() {
alert(“Welcome to ExpertRating!!!”)
}

Which of the following will run the function when a user opens the page?

Answers:

  1. body onload=”message()”
  2. body onunload=”message()”
  3. body onsubmit=”message()”
  4. body onreset=”message()”

44. Which of the following is the most secure and efficient way of declaring an array?

Answers:

  1. var a = []
  2. var a = new Array()
  3. var a = new Array(n)
  4. var a

45. Which of the following Regular Expression pattern flags is not valid?

Answers:

  1. gi
  2. p
  3. i
  4. g

46. Which of the following built-in functions is used to access form elements using their IDs?

Answers:

  1. getItem(id)
  2. getFormElement(id)
  3. getElementById(id)
  4. All of these

47. Which of the following statements is correct?

Answers:

  1. There is no undefined property in JavaScript.
  2. Undefined object properties can be checked using the following code: if (typeof something == null) alert(“something is undefined”);
  3. It is not possible to check for undefined object properties in JavaScript.
  4. Undefined object properties can be checked using the following code: if (typeof something === “undefined”) alert(“something is undefined”);

48. Which of the following correctly uses a timer with a function named rearrange()?

Answers:

  1. tmr=setTimeout(“rearrange ()”,1)
  2. tmr=Timer(1,”rearrange ()”)
  3. tmr=Timer(“rearrange ()”,1)
  4. tmr=setTimeout(1,”rearrange ()”)

49. Which of the following can be used to escape the ‘ character?

Answers:

  1. *
  2. \
  3. @
  4. #
  5. %
  6. |
  7. ~

50. Which event can be used to validate the value in a field as soon as the user moves out of the field by pressing the tab key?

Answers:

  1. onblur
  2. onfocus
  3. lostfocus
  4. gotfocus
  5. None of these

51. When setting cookies with JavaScript, what will happen to the cookies.txt data if the file exceeds the maximum size?

Answers:

  1. The script automatically generates a run-time error.
  2. The script automatically generates a load-time error.
  3. All processes using document.cookie are ignored.
  4. The file is truncated to the maximum length.

52. Which of the following are not global methods and properties in E4X?

Answers:

  1. ignoreComments
  2. ignoreWhiteSpace
  3. setName()
  4. setNamespace()
  5. ignoreComments and ignoreWhiteSpace
  6. setName() and setNamespace()

53. Which of the following will change the color of a paragraph’s text to blue when a user hovers over it, and reset it back to black when the user hovers out?

Answers:

  1. <p onmouseover=”style.color=’black’” onmouseout=”style.color=’blue’”> The text of the paragraph..</p>
  2. <p onmouseover=”style.color=’blue’” onmouseout=”style.color=’black’”> The text of the paragraph..</p>
  3. <p onmouseout=”style.color=’blue’”> The text of the paragraph..</p>
  4. <p onmouseover=”style.color=’blue’”> The text of the paragraph..</p>
  5. <p onmousein=”style.color=’blue’” onmouseout=”style.color=’black’”> The text of the paragraph..</p>

54. What is the purpose of while(1) in the following JSON response?

while(1);[[‘u’,[[‘smsSentFlag’,’false’],[‘hideInvitations’,’false’],[‘remindOnRespondedEventsOnly’,’true’],[‘hideInvitations_remindOnRespondedEventsOnly’,’false_true’],[‘Calendar ID stripped for privacy’,’false’],[‘smsVerifiedFlag’,’true’]]]]

Answers:

  1. It’s invalid JSON code.
  2. It makes it difficult for a third-party to insert the JSON response into an HTML document with a tag.
  3. It iterates the JSON response.
  4. It prevents the JSON response from getting executed.

55. Consider the three variables:

someText = ‘JavaScript1.2’;
pattern = /(w+)(d).(d)/i;
outCome = pattern.exec(someText);

What does outCome[0] contain?

Answers:

  1. true
  2. false
  3. JavaScript1.2
  4. null
  5. 0

56. Which of the following choices will turn a string into a JavaScript function call (case with objects) of the following code snippet?


window.foo = {
bar: {
baz: function() {
alert(‘Hello!’);
}
}
};

Answers:

  1. bar[‘baz’]();
  2. object[‘foo’][‘bar’][‘baz’]();
  3. document[‘foo’][‘bar’][‘baz’]();
  4. window[‘foo’][‘bar’][‘baz’]();

57. Which of the following determines whether cookies are enabled in a browser or not?

Answers:

  1. (navigator.Cookie)? true : false
  2. (application.cookieEnabled)? true : false
  3. (navigator.cookieEnabled)? true : false
  4. (application.cookie)? true : false

58. Which of the following options can be used for adding direct support for XML to JavaScript?

Answers:

  1. E4X
  2. egex
  3. Generators and Iterators
  4. let

59. Which of the following will detect which DOM element has the focus?

Answers:

  1. document.activeElement
  2. document.ready
  3. document.referrer
  4. document.getelementbyid

60. Which of the following will randomly choose an element from an array named myStuff, given that the number of elements changes dynamically?

Answers:

  1. randomElement = myStuff[Math.floor(Math.random() * myStuff.length)];
  2. randomElement = myStuff[Math.ceil(Math.random() * myStuff.length)];
  3. randomElement = myStuff[Math.random(myStuff.length)];
  4. randomElement = Math.random(myStuff.length);

61. How can global variables be declared in JavaScript?

Answers:

  1. All variables are local in JavaScript.
  2. Declare the variable between the ‘script’ tags, and outside a function to make the variable global
  3. Precede the variable name with the constant global
  4. Declare the variable in an external file

62. Which of the following objects in JavaScript contains the collection called “plugins”?

Answers:

  1. Location
  2. Window
  3. Screen
  4. Navigator

63. What will be output of the following code?

function testGenerator() {
yield “first”;
document.write(“step1”);

yield “second”;
document.write(“step2”);

yield “third”;
document.write(“step3”);
}

var g = testGenerator();
document.write(g.next());
document.write(g.next());

Answers:

  1. firststep1second
  2. step1step2
  3. step1
  4. step1step2step3

64. Which of the following methods will copy data to the Clipboard?

Answers:

  1. execClipboard(‘Copy’)
  2. copyCommand(‘Clipboard’)
  3. execCommand(‘Copy’)
  4. execClipboard(‘Copy’)

65. Which of the following code snippets trims whitespace from the beginning and end of the given string str?

Answers:

  1. str.replace(/^s+|s+$/g, ”);
  2. str.replace(/^s+/,”);
  3. str.replace(/s+$/,”);
  4. str.replace(/s+/g,’ ‘);

66. What is the difference between call() and apply()?

Answers:

  1. The call() function accepts an argument list of a function, while the apply() function accepts a single array of arguments.
  2. The apply() function accepts an argument list of a function, while the call() function accepts a single array of arguments.
  3. The call() function accepts an object list of a function, while the apply() function accepts a single array of an object.
  4. The call() function accepts an object list of a function, while the apply() function accepts a single array of an object.

67. Which of the following code snippets is more efficient, and why?


for(i=0;i
document.images[i].src=”blank.gif”;


var theimages = document.images;
for(i=0;i
theimages[i].src=”blank.gif”

Answers:

  1. Both are equally efficient.
  2. The first code is more efficient as it contains less code.
  3. The first code is more efficient as it employs object caching.
  4. The second code is more efficient as it employs object caching.

68. What is the meaning of obfuscation in JavaScript?

Answers:

  1. Obfuscation is a keyword in JavaScript.
  2. Making code unreadable using advanced algorithms.
  3. Decrypting encrypted source code using advanced algorithms.
  4. None of these.

69. Which of the following JavaScript Regular Expression modifiers finds one or more occurrences of a specific character in a string?

Answers:

  1. ?
  2. *
  3. +
  4. #

70. Which of the following is not a valid JavaScript operator?

Answers:

  1. |
  2. ===
  3. %=
  4. ^

71. Which of the following code snippets returns “[object object]”?

Answers:

  1. var o = new Object(); o.toSource();
  2. var o = new Object(); o.valueOf();
  3. var o = new Object(); o.toString();
  4. var o = new Object(); o.getName();

72. Which of the following can be used to invoke an iframe from a parent page?

Answers:

  1. window.frames
  2. document.getElementById
  3. document.getelementsbyname
  4. document.getelementsbyclassname

73. Select the following function that shuffles an array?

Answers:

  1. function shuffle(array) { var tmp, current, top = array.length; if(top) while(–top) { current = Math.floor(Math.random() * (top + 1)); tmp = array[current]; array[current] = array[top]; array[top] = tmp; } return array; }
  2. function shuffle(array) { return array.sort(function(a,b) { return (a-b); }); }
  3. function shuffle(array) { var results = new Array(); var sorted_arr = array.sort(); for (var i = 0; i < array.length – 1; i++) { if (sorted_arr[i + 1] == sorted_arr[i]) { results.push(sorted_arr[i]); } } return results; }
  4. function shuffle(array) { for (var tmp, cur, top=array.length; top–;){ cur = (Math.random() * (top + 1)) << 0; tmp = array[cur]; array[cur] = array[top]; array[top] = tmp; } return array.sort(); }

74. Which of the following code snippets removes objects from an associative array?

Answers:

  1. delete array[“propertyName”];
  2. array.propertyName.remove();
  3. array.splice(index, 1);
  4. array[“propertyName”].remove();

75. What is the error in the statement: var charConvert = toCharCode(‘x’);?

Answers:

  1. toCharCode() is a non-existent method.
  2. Nothing. The code will work fine.
  3. toCharCode only accepts numbers.
  4. toCharCode takes no arguments.

76. What value would JavaScript assign to an uninitialized variable?

Answers:

  1. NaN
  2. null
  3. undefined
  4. false

77. What does the following JavaScript code do?

contains(a, obj) {
for (var i = 0; i < a.length; i++) {
if (a[i] === obj) {
return true;
}
}
return false;
}

Answers:

  1. It calculates an array’s length.
  2. It compares ‘a’ and ‘obj’ in an array.
  3. The code will cause an error.
  4. It checks if an array contains ‘obj’.

78. If an image is placed styled with z-index=-1 and a text paragraph is overlapped with it, which one will be displayed on top?

Answers:

  1. The paragraph.
  2. The image.
  3. It depends on other rules.

79. Which of the following code snippets gets an image’s dimensions (height & width) correctly?

Answers:

  1. var img = document.getElementById(‘imageid’); var width = img.clientWidth; var height = img.clientHeight;
  2. var img = document.getElementById(‘imageid’); var width = img.width; var height = img.height;
  3. var img = document.getElementById(‘imageid’); var width = img.getAttribute(‘width’); var height = img.getAttribute(‘height’);
  4. var img=document.getElementById(“imageid”); var width=img.offsetWidth; var height=img.offsetHeight;

80. Which of the following are correct values of variableC, and why?


variableA = [6,8];
variableB =[7,9];
variableC = variableA + variableB;

Answers:

  1. 6, 7, 8 and 9. The + operator is defined for arrays, and it concatenates strings, so it converts the arrays to strings.
  2. 6, 15 and 9. The + operator is defined for arrays, and it concatenates numbers, so it converts the arrays to numbers.
  3. 6, 8, 7 and 9. The + operator is defined for arrays, and it concatenates strings, so it converts the arrays to strings.
  4. 6, 87 and 9. The + operator is not defined for arrays, and it concatenates strings, so it converts the arrays to strings.

81. The following are the samples for getting a selected value in the from a dropdown list:

<select id=”ddlViewBy”>
<option value=”1″>test1</option>
<option value=”2″ selected=”selected”>test2</option>
<option value=”3″>test3</option>
</select>

Which code block is correct?

Answers:

  1. var e = document.getElementById(“ddlViewBy”); var strUser = e.options[e.selectedIndex].text;
  2. var e = document.getElementById(“ddlViewBy”); var strUser = e.options[e.selectedIndex].value;
  3. var e = document.getElementByName(“ddlViewBy”); var strUser = e.options[e.selectedIndex].text;
  4. var e = document.getElementByName(“ddlViewBy”); var strUser = e.options[e.selectedIndex].value;

82. var profits=2489.8237

Which of the following code(s) produces the following output?

output : 2489.824

Answers:

  1. profits.toFixed(4)
  2. profits.toFixed(3)
  3. profits.formatDollar(3)
  4. profits.nuberFormat(3)

83. A form contains two fields named id1 and id2. How can you copy the value of the id2 field to id1?

Answers:

  1. document.forms[0].id1.value=document.forms[0].id2.value
  2. document.forms[0].id2.value=document.forms[0].id1.value
  3. document.id1.value=document.id2.value
  4. document.id2.value=document.id1.value

84. Which of the following code snippets will toggle a div element’s background color?

<button id=”toggle”>Toggle</button>

Change Background Color.

Answers:

  1. var button = document.getElementById(‘toggle’); button.click = function() { terd.style.backgroundColor = terd.style.backgroundColor == ‘blue’ ? ‘red’ : ‘blue’; };
  2. var button = document.getElementById(‘toggle’); button.ready = function() { terd.style.backgroundColor = terd.style.backgroundColor == ‘blue’ ? ‘red’ : ‘blue’; };
  3. var button = document.getElementById(‘toggle’); button.focus = function() { terd.style.backgroundColor = terd.style.backgroundColor == ‘blue’ ? ‘red’ : ‘blue’; };
  4. var button = document.getElementById(‘toggle’); button.onclick = function() { terd.style.backgroundColor = terd.style.backgroundColor == ‘blue’ ? ‘red’ : ‘blue’; };

85. How can the user’s previously navigated page be determined using JavaScript?

Answers:

  1. It is not possible in JavaScript. This can be done only through server-side scripting.
  2. Using the document.referrer property
  3. Using the window object
  4. None of these

86. Which of the following is not a valid method for looping an array?

Answers:

  1. var a= [1,2]; for (var i = 0; i < a.length; i++) { alert(a[i]); }
  2. var a= [1,2]; a.forEach( function(item) { alert(item); })
  3. var a= [1,2]; a.map( function(item) { alert(item); })
  4. var a= [1,2]; a.loop( function(item) { alert(item); })

87. Which of the following correctly sets a class for an element?

Answers:

  1. document.getElementById(elementId).className = “Someclass”;
  2. document.getElementById(elementId).setAttribute(“className”, “Someclass”);
  3. document.getElementById(elementId).class = “Someclass”;
  4. document.getElementById(elementId).style = “Someclass”;

88. An HTML form contains 10 checkboxes all named “chkItems”. Which JavaScript function can be used for checking all the checkboxes together?

Answers:

  1. function CheckAll() { for (z = 0; z < document.forms.chkItems.length; z++) { document.forms.chkItems[z].checked=true } }
  2. function CheckAll() { for (z = 0; z < document.forms[0].chkItems.length; z++) { document.forms[0].chkItems[z].checked=true } }
  3. function CheckAll() { for (z = 0; z < document.forms[0].chkItems.length; z++) { document.forms[0].chkItems.list[z].checked=true } }
  4. function CheckAll() { for (z = 0; z < document.forms[0].chkItems.length; z++) { document.forms[0].chkItems.list[z].checked=false } }

89.Which of the following is not a valid Date Object method in JavaScript?

Answers:

  1. parse()
  2. setDay()
  3. setTime()
  4. valueOf()

90.Which event can detect when the user highlights text within a text or textarea object?

Answers:

  1. onSelect()
  2. onBlur
  3. onChange()
  4. onMove
  5. None of these

91.Consider the following code snippet:
var myJSONObject =
{«ircEvent»: «PRIVMSG», «method»: «newURI», «regex»: «^http://.*»};

What is the best way to remove the property ‘regex’, so the result would be this code snippet?

myJSONObject ==
{«ircEvent»: «PRIVMSG», «method»: «newURI»};

Answers:

  1. myJSONObject.regex.delete;
  2. myJSONObject.regex.remove;
  3. delete myJSONObject.regex;
  4. remove myJSONObject.regex;

92.Which of the following is the best way to show both single and double quotes in the same sentence

Answers:

  1. alert(«It’s «+’»game»‘+» time.»);
  2. alert(‘It\’s \»game\» time.’);
  3. alert(‘It\’\s «game» time.’);
  4. alert(‘It\’s «game» time.’);

93.Which of the following statements is true regarding importing JavaScript files inside of other JavaScript files?

Answers:

  1. There is no import/include/require keyword in JavaScript, but there ways to import JS files inside of other JS files.
  2. There is an import keyword in JavaScript, which allows importing JS files inside of other JS files.
  3. There is no option to do so in JavaScript.

94. Which of the following shortcuts can be used for writing multiple document.write statements?

Answers:

  1. for(document){}
  2. with(document) {}
  3. withThis(document){}
  4. None of these

95.In JavaScript, the encodeURI() function is used to encode special characters. Which of the following special characters is/are an exception to that rule?
A. £
B. €
C. @
D. $
Answers:

  1. A
  2. B
  3. C
  4. D
  5. A and B
  6. C and D

96.Consider the following code:

<form>
<textarea id=»foo» name=»foo»></textarea>
</form>Which of the following is the best method to get the line number of the form’s text area?
Answer:

  1. A foo.value.split(/\r\n\|\r\|\n/g);
  2. foo.value.split(/\r\/n\|\r\|\n/g);
  3. foo.value.split(/\rn\|\r\|\n/g);
  4. foo.value.split(/\r\n|\r|\n/g);

97.Consider the following code:
var setter=new Object()
setter.color=»blue»
How would you delete the color property of the variable seter?

Answer:

  1. setter.color delete;
  2. delete setter.color
  3. delete(setter.color)
  4. setter.color.delete

98. Is the following statement regarding expression closures in JavaScript true or false?
The syntax function(x) {return x*x;} can be written as function(x) x*x.

Answer:

  1. Yes
  2. No

99.Which of the following statements regarding this String prototype is correct?
String.prototype.doSomething = function(suffix) {
return this.indexOf(suffix, this.length — suffix.length) !== -1;
};
Answer:

  1. This method determines whether or not a string ends with another string.
  2. This method determines whether or not a string begins with another string.
  3. This method returns the position of the last occurrence of a specified value in a string.
  4. This method returns the position of the first occurrence of a specified value in a string.

100.What will be the result of the following code?
document.getElementById(“banana”).className = document.getElementById(“banana”).className.replace(/(?:^|\s)apple(?!\S)/g ,’e’ );
Answer:

  1. Replace class ‘apple’ with ‘g’ in the HTML element which contains ID ‘banana’
  2. Replace current class with ‘apple’ in the HTML element which contains ID ‘banana’
  3. Replace class ‘apple’ with ‘e’ in the HTML element which contains ID ‘banana’
  4. Replace ID ‘apple’ with ‘banana’ in the HTML element which contains ID ‘banana’ and class ‘g’

101.Which of the following will determine if the user’s browser is named “Netscape”?

Answer:

  1. if(appName==”Netscape”){}
  2. if(document.appName==”Netscape”){}
  3. if(navigator==”Netscape”){}
  4. if(browser==”Netscape”){}
  5. None of these

102. Given a p element with some text content, which of the following code snippets sets the background color of the text to yellow, its color to red, and its font size to 20px?

Answer:

  1. var p = document.getElementById(elementId);
    p.setAttribute(«style», «background-color:yellow;color:red;font-size:20px;»);
  2. var p = document.getElementById(elementId);
    p.style.background = ‘yellow’;
    p.style.color= ‘red’;
    p.style.size= ’20px’;
  3. var p = document.getElementById(elementId);
    p.style.background = ‘yellow’;
    p.style.color= ‘red’;
    p.style.font.size= ’20px’;
  4. var p = document.getElementById(elementId);
    p.setAttribute(«style», «background-color:red;color:yellow;font-size:20;»);

103.Which of the following are not valid HTML events?

Answer:

  1. onmouseover
  2. onmouseout
  3. onmouseabove
  4. onmousedown
  5. onmousein

104.Which of the following options is used to access the attributes in E4X?

Answer:

  1. @
  2. ::
  3. #
  4. *

105.Which of the following can be used to write a JavaScript function that will accept user input?

Answer:

  1. The prompt method
  2. The alert method
  3. A form field
  4. All of these

106.Which of the following prints «AbBc»?

Answer:

  1. var b = ‘a’; var result = b.toUpperCase() + ‘b’ + ‘b’.toUpperCase() +’C'[‘toLowerCase’](); alert(result);
  2. var b = ‘a’; var result = b.toUpperCase() + ‘b’ + ‘b’.toUpperCase() +’C'[‘toLowerCase’](); alert(result);
  3. var b = ‘a’; var result = b.toUpperCase() + b + ‘b’.toUpperCase() +’C'[‘toLowerCase’](); alert(result);
  4. var b = ‘a’; var result = b.toUpperCase() + ‘b’ + ‘b’.toUpperCase() +C; alert(result);

107.Which of these options is the most maintainable way to attach JavaScript functionality to an HTML element?

Answer:

  1. <p onclick=»alert(‘You clicked me!’)»> some text </p>
  2. function fun(){alert(‘You clicked me!’)}
    <a onclick=fun()>…</a>
  3. function fun(){ alert(‘You clicked me!’); };
    var el = document.getElementById(«click-target»);
    el.onClick = fun;

    <a id=»click-target»>…</a>

  4. <a href=»javascript:alert(‘You clicked me!’)»>…</a>

108.Which of these options is the most maintainable way to attach JavaScript functionality to an HTML element?
<html>
<body>

function validate() {
var chk=»ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz»;
var ok=»yes»;
var temp;
var field1=document.getElementById(«t1»);
var field=field1.value.substring(field1.value.length-1,field1.value.length);
if(chk.indexOf(field)==»-1″) {
alert(«error»);
field1.value=(field1.value).slice(0,field1.value.length-1);
}
}

<input type=»text» id=»t1″ onkeyup=»validate()» onkeypress =»validate()»/>
</body>
</html>
Answer:

  1. The code will cause an error alert to be displayed if a numeric character is entered, and the numeric character is removed.
  2. The code will cause an error alert to be displayed if a non-numeric character is entered, and the non-numeric character is removed.
  3. The code will cause an error alert to be displayed if a numeric character is entered, and the value of textbox is reset.
  4. The code will cause an error alert to be displayed if a non-numeric character is entered, and the value of textbox is reset.

109. What would be the default setting for the expires attribute of the document.cookie property?

Answers:

  1. The duration of the browser session
  2. The duration the current document stays loaded
  3. Twenty-four hours from the time the cookie is set
  4. There is no default setting
  5. The duration for which the machine is on

110.Which of the following choices will remove a selection option from the code below?
<button id”newbtn” onclick=”g();”>Remove</button>
<select name=”selectBox” id=”selectBox”>
<option value=”option1″>option1</option>
<option value=”option2″>option2</option>
<option value=”option3″>option3</option>
<option value=”option4″>option4</option>
</select>
Answers:

  1. function g(){
    var index = 1;
    var d = document.getElementById(“selectBox”);
    var d_nested = d.childNodes[index];
    var throwawayNode = d.deleteChild(d_nested);
    }
  2. >
    function g(){
    var index = 1;
    var d = document.getElementById(“selectBox”);
    var d_nested = d.childNodes[index];
    var throwawayNode = d.clearChild(d_nested);
    }
  3. function g(){
    var index = 1;
    var d = document.getElementById(“selectBox”);
    var d_nested = d.childNodes[index];
    var throwawayNode = d.emptyChild(d_nested);
    }
  4. function g(){
    var index = 1;
    var d = document.getElementById(“selectBox”);
    var d_nested = d.childNodes[index];
    var throwawayNode = d.removeChild(d_nested);
    }

111.Which of the following is incorrect regarding Strict mode in JavaScript?

Answer:

  1. It catches some common coding errors, throwing exceptions.
  2. It enables features that are confusing or poorly thought out.
  3. It prevents, or throws errors, when relatively «unsafe» actions are taken (such as gaining access to the global object).

112. Which of the following is incorrect regarding Strict mode in JavaScript?
var a = ‘A’.charCodeAt(0) + 5;
var b = ‘c’.charCodeAt(0) + 1;
var c = 0;
for (var i = 0; i < 10; i++) {
c = c + (a+b % 2);
}
alert(c);

Answer:

  1. 700
  2. 60
  3. 0
  4. 760

113. Which of the following is/are true regarding JavaScript and multi-threading/concurrency?

Answer:

  1. JavaScript is single-threaded, forcing asynchronous events to a queue to wait for execution.
  2. JavaScript is multi-threaded, and behaves in a synchronous manner.
  3. JavaScript can be single or multi-threaded, depending on the browser’s capabilities.
  4. None of these.

114. Which of the following will change the color of the text box to green, as long as the user is pressing a key?

Answer:

  1. input type=»text» onkeydown=»color(‘white’)» onkeyup=»color(‘green’)» name=»txtName»
  2. input type=»text» onkeydown=»color(‘green’)» onkeyup=»color(‘white’)» name=»txtName»
  3. input type=»text» onkeydown=»color(‘green’)» name=»txtName»
  4. input type=»text» onkeydown=»color(‘white’)» name=»txtName»
  5. input type=»text» onkeypress=»color(‘green’)» onkeyup=»color(‘white’)» name=»txtName»

115. In an HTML page, the form tag is defined as follows:
<form onsubmit=»return Validate()»

action=»http://www.mysite.com/»>
The validate() function is intended to prevent the form from being submitted if the name field in the form is empty. What should the validate() function look like?

Answer:

  1. function Validate() { if(document.forms[0].name.value == «») return true; else return false; }
  2. function Validate() { if(document.forms[0].name.value == «») return false; else return true; }
  3. script type=»text/javascript»> function Validate() { if(document.forms[0].name== «») return false; else return true; } </script>
  4.   function Validate() { if(document.forms[0].name == «») return true; else return false; }

116. Which of the following statements are true regarding the code below?

alert(«foo» === new String(«foo»)); // output false

Answer:

  1. The «===» operator always returns false.
  2. The «===» operator returns true only if they refer to the same object (comparing by reference) and if both the primitive and the object have the same value.
  3. The «===» operator returns true only if the object (comparing by reference) and the primitive have the same value.
  4. The «===» operator does not work for objects.

117.Which of the following statements are true regarding the «this» keyword in JavaScript?

Answer:

  1. The value of «this» can be set by assignment during execution, and it will be the same each time the function is called.
  2. Inside a function, the value of «this» depends on how many times the function is called.
  3. Inside a function, the value of «this» depends on how the function is called (as a simple call, an object method, a constructor, etc.).
  4. In strict mode, the value of «this» may change from whatever it is set to, when entering the execution context.

118.Which of the following is not a correct way to empty the array a?

Answer:

  1. a = new Array();
  2. a = [];
  3. a.splice(0,a.length);
  4. a.clear()

119.Which of the following is the correct way to resize an iframe based on content?

Answer:

  1. function resizeIframe(height)
    {document.getElementById(‘frame_name_here’).height = parseInt(height)+60;}
    http://’src.htm’
  2. function resizeIframe(height)
    {document.getElementByName(‘frame_name_here’).height = parseInt(height)+60;}
    http://’src.htm’
  3. function resizeIframe(height)
    {document.getElementByDivId(‘frame_name_here’).height = parseInt(height)+60;}
    http://’src.htm’
  4. None of these

120.Which of the following is not a valid JavaScript function?

Answers:

  1. apply()
  2. call()
  3. toString()
  4. All the other options are valid.

121.What does the following code snippet do?

<input type=»radio»name=»r1″value=»radio1″onclick=»this.checked=false;alert(‘sorry’)»>

Answers:

  1. The code is invalid.
  2. The code makes it necessary for the user to select the radio button.
  3. The code disables the radio button.
  4. The code displays an alert when the user selects the button.

122.How can properties be added to an object class?

Answers:

  1. With the prototype() method
  2. With the prototype property
  3. It cannot be done.
  4. With the «this» object

123.Which of the following will correctly check if an object is an array?
Note: There may be more than one right answer.

Answers:

  1. Object.prototype.toString.call(arr) === ‘[object Array]’
  2. Object.isArray(arr)
  3. None of these
  4. With the «this» object

124.Which of the following check if an object has a specific property?

Answers:

  1. hasOwnProperty()
  2. hasProperty()
  3. It is browser-dependent
  4. None of these

125. Given the following window.open function:
window.open(url,name,»attributes»)
How can it be ensured that different URLs are opened in the same window?

Answers:

  1. The second attribute, name, should be the same.
  2. The name attribute should be null.
  3. The name attribute should be omitted.
  4. The name attribute should be different.
  5. None of these.

126.Which of the following code snippets renders a button invisible?

Answers:

  1. var button = document.getElementById(‘buttonId’);
    button.style.display=’none’
  2. var button = document.getElementById(‘buttonId’);
    button.style.display=’block’
  3. var button = document.getElementById(‘btn’);
    button.style.visibility=’false’;
  4. var button = document.getElementById(‘btn’);
    button.style.visibility=’disabled’;
  5. None of these.

127. Why does (0 < 5 < 3) return true?

Answers:

  1. Order of operations produces (true < 3), which returns true.
  2. Order of precedence produces (true < 3), which returns true.
  3. Order of operations produces (false < 3), which returns true.
  4. None of these.

128. What is the cleanest, most effective way to validate decimal numbers in JavaScript?

Answers:

  1. IsNumeric()
  2. isNaN()
  3. valid()
  4. isDecimal()

129. Which of the following is the best reason for not using «for…in» with array iteration?

Answers:

  1. for..in should be used to iterate over an array where index order is important.
  2. for..in should not be used to iterate over an array where index order is important.
  3. for…in loops iterate over non–enumerable properties.
  4. for…in loops do not iterate over enumerable properties.

130. Which of the following is the best reason for not using «for…in» with array iteration?

Answers:

  1. It forces the parser to treat the + sign as a part of an expression.
  2. The + sign is used as a cast operator.
  3. It is used to denote a type of object in JavaScript.
  4. None of these.

131.Which of the following will implement a singleton pattern in JavaScript?

Answers:

  1. var anObject = {
    method1: function () {
    // …},

    method2: function () {
    // …
    }
    };
    >
  2. function method1(){
    // …
    }
    function method2(){
    // …
    }
  3. var method1 = function(){
    // …
    }
    var method2 = function(){
    // …
    }
  4. var method1;
    var method2;

132. Which of the following code snippets will correctly detect a touchscreen device?

Answers:

  1. function isTouchDevice() {
    return !!(‘ontouchstart’ in window) || !!(‘onmsgesturechange’ in window);
    };
  2. function isTouchDevice() {
    try {
    document.body.createEvent(«TouchEvent»);
    return true;
    } catch (e) {
    return false;
    }
    }
  3. function isTouchDevice(){
    return (typeof(navigator.ontouchstart) != ‘undefined’) ? true : false;
    }
  4. function isTouchDevice(){
    return (navigator.msMaxTouchPoints == 0);
    }

133. Which of the following shows examples of valid auto increment/decrement loops?

Answers:

  1. for(var i=0; i < 100; i++){} for(var i=0; i > -100; i—){}
  2. for(var i=0; i < 100; i+){} for(var i=0; i > -100; i-){}
  3. for(var i=0; i > 100; i++){}
    for(var i=0; i < -100; i—){}
  4. for(var i=0; i > 100; i+){}
    for(var i=0; i < -100; i-){}

134. Analyze the following code snippet. What will be the output of this code?
<html>
<body>

var str = «The drain of the plane is plain»;
var patt1 =/ain/g;
document.write(str.match(patt1));

</body>
</html>
Answers:

  1. a
  2. ain
  3. 7,29
  4. 7
  5. ain,ain

135.The following are sample codes on how to merge properties of two JavaScript objects dynamically:
var obj1 = { food: ‘pizza’, car: ‘ford’ }
var obj2 = { animal: ‘dog’ }
Which of the following are JavaScript codes?

Answer:

  1. obj1.merge(obj2);
  2. function MergeRecursive(obj1,obj2){
    var obj3 = {};
    for (var attrname in obj1) { obj3[attrname] = obj1[attrname]; }
    for (var attrname in obj2) { obj3[attrname] = obj2[attrname]; }
    return obj3;
    }
  3. function MergeRecursive(obj1, obj2) {
    for (var p in obj2) {
    try {
    // Property in destination object set; update its value.
    if ( obj2[p].constructor==Object ) {
    obj1[p] = MergeRecursive(obj1[p], obj2[p]);
    } else {
    obj1[p] = obj2[p];
    }
    } catch(e) {
    // Property in destination object not set; create it and set its value.
    obj1[p] = obj2[p];}
    }
    return obj1;
    }
  4. Object.extend = function(destination,source) {
    for (var property in source)
    destination[property] = source[property];
    return destination;
    }
    obj1.extend(obj2)

136.You need to be able to determine which page of the web site has been the most recently modified. Which object would enable you to do this?

Answers:

  1. document
  2. window
  3. history
  4. browser
  5. form
  6. location

137.Which of the following are the valid JavaScript codes to obtain the number of milliseconds since the epoch?
Note: There may be more than one right answer.

Answers:

  1. var timestamp = new Date().getTime();
  2. var timestamp = Number(new Date());
  3. var timestamp = Date.now;
  4. var timestamp = new Date().valueOf();

138.Which of the following ‘if’ statements is correctly used to get the size of both ‘variable1’ and ‘variable2’ objects?
var variable1 = {‘name’:’theName’, ‘address’:’theAddress’,’age’: ’18’}
var variable2 = [‘theName’,’theAddress’,’18’];

variable1[«name»] = «theName2»;
variable1[«name»] = «theName3»;
variable1[«name2»] = «theName4»;
variable1[«name2»] = «theName5»;

Object.size = function(importer) {
var exporter = 0, key;
for (key in importer) {
if (importer.hasOwnProperty(key)) exporter++;
}
return exporter;
};

Answers:

  1. if(typeof(variable1)==’object’ && typeof(variable2)==’array’){
    Object.size(variable1);
    variable2.length;
    }
  2. if(typeof(variable1)==’array’ && typeof(variable2)==’object’){
    Object.size(variable1);
    variable2.length;
    }
  3. if(typeof(variable1) > typeof(variable2)){
    Object.size(variable1);
    variable2.length;
    }
  4. if(typeof(variable1) == typeof(variable2)){
    Object.size(variable1);
    variable2.length;
    }

139.Consider the following JavaScript arrays:
var a = [1, 2];
var b = [3, 4, 5];
Which of the following will append the contents of array «b» to array «a»?

Answers:

  1. a.push(b);
  2. a.splice(0,0,b);
  3. a = b.concat(a);
  4. a.join(b);

140.How can it be determined if JavaScript is disabled in the user’s browser?

Answers:

  1. It is browser-dependent.
  2. There is no way to detect if JavaScript is disabled.
  3. Use the HTML<noscript> tag to display different content if JavaScript is disabled.
  4. None of these.

141.Which of the following choices shows the correct result for the code below? var arr = []; arr[0] = «Jani»; arr[1] = «Hege»; arr[2] = «Stale»; arr[3] = «Kai Jim»; arr[4] = «Borge»; console.log(arr.join()); arr.splice(2, 0, «Lene»); console.log(arr.join());

Answers:

  1. Jani,Hege,Stale,Kai Jim,Borge
    Lene,Jani,Hege,Stale,Kai Jim,Borge
  2. Jani,Hege,Stale,Kai Jim,Borge
    Jani,Hege,Lene,Stale,Kai Jim,Borge
  3. Jani,Hege,Stale,Kai Jim,Borge
    Jani,Hege,Stale,Kai Jim,Lene,Borge
  4. Jani,Hege,Stale,Kai Jim,Borge
    Jani,Hege,Stale,Kai Jim,Borge

142. Consider the following scenario:
The document.write() method is embedded to write some text within a pair of 

table tags. Upon loading the file, however, garbled text appears on the section of the page where the text should be. What could be the reason for this?

Answers:

  1. The browser does not support JavaScript.
  2. An older version of the browser is being used.
  3. The browser does not support cookies.

143. What is the output of the following code?
var a = 5;
var b = 1;
if(!!»false») {
a = a + 5;
b = 3;
};
if(!!0) {
a = a + 5;
b = b + 2;
};
alert(a+b);

Answers:

  1. 20
  2. 6
  3. None of these

144.Consider the following code:
var vNew=new Date()
Which of the following options will return true?

Answers:

  1. vNew instanceof boolean
  2. vNew instanceof boolean
  3. vNew instanceof Date
  4. All of these

145.Which of the following will detect if the browser supports a certain CSS property?

Answers:

  1. typeof document.body.style.borderRadius == ‘string’
  2. typeof document.body.style.borderRadius == ‘undefined’
  3. typeof document.body.style.borderRadius == true
  4. It is impossible.

146.Which of the following is not a valid code for redirect to stackoverflow.com?
Note: There may be more than one right answer.

Answers:

  1. window.location.href = «http://stackoverflow.com»;
  2. window.location.href («http://stackoverflow.com»);
  3. window.location.replace=»http://stackoverflow.com»;
  4. window.location.replace(«http://stackoverflow.com»);

147.The following statements show two ways of calling a JavaScript function:
i)onclick = «a();»
ii)onclick=»JavaScript:a();»
Which of the following options is correct, with regard to the two statements above?

Answers:

  1. There is no difference between the two statements
  2. The first statement is incorrect and the second one is correct.
  3. The first statement is correct and the second statement is incorrect.

148.Which of the following code snippets will trigger an input type=»file» attribute when an element with a «newbtn» ID is clicked?

Answers:
<button id»newbtn» onclick=»grt();»>Upload</button>
<form>
<input id=»thisId» type=»file» name=»upload» />
</form>
</form>

  1. function grt(){document.getElementById(‘thisId’).keypress();}
  2. function grt(){document.getElementById(‘thisId’).load();}
  3. function grt(){document.getElementById(‘thisId’).dblclick();}
  4. function grt(){document.getElementById(‘thisId’).click();}

149.Which of the following JavaScript code snippets is the more efficient and why?
Code Snippet 1

for(i=0;i
Code Snippet 2

var theimages = document.images;
for(i=0;i

Answers:

  1. Both codes are equally efficient.
  2. The first code is more efficient because it contains less code.
  3. The first code is more efficient because it employs object caching.
  4. The second code is more efficient because it employs object caching.

150.Which of the following cope samples will correctly search for the word «for» in a string?
Note: There may be more than one right answer.

Answers:

  1. var str=»This is test for javascript search !!!»;
    if(str.search(«for») != -1) {
    alert(«true»);
    }
    else {
    alert(«false»);
    }
  2. var str=»This is test for javascript search !!!»;
    if(str.indexof(«for») != -1) {
    alert(«true»);
    }
    else {
    alert(«false»);
    }
  3. var str=»This is test for javascript search !!!»;
    if(str.indexOf(«for») != -1) {
    alert(«true»);
    }
    else {
    alert(«false»);
    }
  4. var str=»This is test for javascript search !!!»;
    if(str.contains(«for») != -1) {
    alert(«true»);
    }
    else {
    alert(«false»);
    }

151.Given two frames Frame1 and Frame2, where Frame2 has a div element with id «some», how can the div element’s color be changed in Frame2, using JavaScript code in Frame1?

Answers:

  1. var div = top.Frame2.document.getElementById(‘some’);
    div.style.color= «orange»;
  2. var div = document.getElementById(‘some’);
    div.style.color= «orange»;
  3. var div = top.Frame1.document.getElementById(‘some’);
    div.style.color= «orange»;
  4. None of these.

152.Which of the following JavaScript Regular Expression character classes finds any non-digit character in a given string?

Answers:

  1. \W
  2. \S
  3. \B
  4. \D

153. Which best describes void?

Answers:

  1. A method
  2. A function
  3. A statement
  4. An operator
  5. A built-in object

154.Which of the following is used to solve the problem of enumerations in JavaScript?

Answers:

  1. let
  2. Regex
  3. Generators
  4. E4X

155.Which of the following cannot be achieved using JavaScript?
Note: There may be more than one right answer.

Answers:

  1. Read or write from external files (except .js files)
  2. Access or modify browser settings
  3. Launch client processes (eg windows applications)
  4. Launching the default email application of the client

156.The following are sample codes on how to loop through JavaScript object literals with objects as members:
var validation_messages = {
«key_1»: {
«your_name»: «jimmy»,
«your_msg»: «hello world»
},
«key_2»: {
«your_name»: «billy»,
«your_msg»: «foo equals bar»
}
}
Which of the following are invalid native JavaScript codes?
Note: There may be more than one right answer.

Answers:

  1. for (var key in validation_messages) {
    var obj = validation_messages[key];
    for (var prop in obj) {
    alert(prop + » = » + obj[prop]);
    }
    }
  2. Object.keys(validation_messages).forEach(function(key) {
    var obj = validation_messages[key];
    Object.keys(obj).forEach(function(key) {
    alert (prop + “ = “ + obj[key]);
    )};
  3. (validation_messages.hasOwnProperty(key)) {
    var obj = validation_messages[key];
    for (var prop in obj) {
    if (obj.hasOwnProperty(prop)) {
    alert(prop + “ = “ + obj[prop]);
    }
    }
    }
    }
  4. _.each(validation_messages, function(value, key){
    _.each(value, function(value, key){
    alert(prop + » = » + value);
    });
    });

157.Analyze the following code snippet. What will be the output of this code?
html>
<body>

var str = «Visit Gardens(now)»;
var patt1 = new RegExp(«(now)», «g»);
patt1.test(str);
document.write(RegExp.lastParen);

</body>
</html>
Answers:

  1. now
  2. (now)
  3. 15
  4. 19

158.Consider the following code:
var variable=2*2+10000/10-133%5;
Which of the following combinations have the lowest operator precedence in «variable»?

Answers:

  1. «*» and «+»
  2. «/» and «%»
  3. «/» and «+»
  4. «*» and «%»

159.While coding a loop, you come across a condition where you have to terminate the loop and continue with the statements following the loop. Which statement would you use?

Answers:

  1. exit
  2. return
  3. continue
  4. while
  5. break

160. What is the best way to make optional parameters of functions?

Answers:

  1. function someFunction(requiredArg, optionalArg) {
    optionalArg = optionalArg || ‘defaultValue’;
    alert(optionalArg);
    }
  2. function someFunction(requiredArg, optionalArg) {
    optionalArg = (typeof optionalArg === «undefined») ? «defaultValue» : optionalArg;
    alert(optionalArg);
    }
  3. function someFunction(requiredArg, optionalArg) {
    optionalArg = (optionalArg === «undefined») ? «defaultValue» : optionalArg;
    alert(optionalArg);
  4. All of these

161. Which of the following are correct closure functions?

Answers:

  1. function foo(x) {
    var tmp = 3;
    return function (y) {
    alert(x + y + (++tmp));
    }
    }
    var bar = foo(2); // bar is now a closure.
    bar(10);
  2. function foo(x) {
    var tmp = 3;
    function bar(y) {
    alert(x + y + (++tmp));
    }
    bar(10);
    }
    foo(2)
  3. function foo(x) {
    var tmp = 3;
    function bar(y) {
    function bar1(tmp) {
    alert(x + y + (++tmp));
    }
    }
    bar(10);
    }
    foo(2)
  4. function foo(x) {
    var tmp = 3;
    return function (y) {
    alert(x + y + tmp);
    x.memb = x.memb ? x.memb + 1 : 1;
    alert(x.memb);
    }
    }
    var age = new Number(2);
    var bar = foo(age); // bar is now a closure referencing age.
    bar(10);

162.Which of the following will correctly detect browser language preference?

Answers:

        1. var language = window.navigator.userLanguage || window.navigator.language;
          alert(language);
        2. var language = navigator.browserLanguage || window.navigator.language;
          alert(language);
        3. var language =navigator.userLanguage;
          alert(language);
        4. var language = window.navigator.language;
          alert(language);

163.What is the output of the following code?
var container = {
someKey: 3,
someOtherKey: “someObject”,
anotherKey: “Some text”
};
if (“someOtherKey” in container) {
alert (true);
}
delete container [“someOtherKey”];
if (container[“someOtherKey”] === null) {
alert (false);
}
if (container[“someOtherKey”] === undefined) {
alert (true);
}
if (container.someOtherKey === undefined) {
alert (false);
}
if (container.someOtherKey === undefined) {
alert (true);
}
delete container[“someKey”];
if (container.someKey === 3) {
alert (true);
}
Answers:

        1. true
          true
          false
        2. true
          true
          true
        3. true
          false
          true
          false
          true
          true
        4. true
          true
          false
          true

164. Which of the following is a good reason why JavaScript variables would start with a dollar sign ($)?

Answers:

        1. $ is a prefix used to create a instance of a object.
        2. $ is a keyword in JavaScript.
        3. $ is used to quickly identify and parse variables
        4. None of these

165.Which of the following code is correct for validating date values?
Note: There may be more than one right answer.

Answers:

        1. var d = Date.parse(‘foo’);
          if (isNaN(d)==false)
          {
          alert(new Date(d));
          } else {
          alert(‘Invalid date’);
          }
        2. var d = new Date(‘foo’);
          if (d instanceof Date && isFinite(d))
          {
          alert(d);
          } else {
          alert(‘Invalid date’);
          }
        3. Date.prototype.valid = function() {
          return isFinite(this);
          }
          var d = new Date(‘foo’);
          if (d.valid())
          {
          alert(d);
          } else {
          alert(‘Invalid date’);
          }
        4. All of the above

166. Which of the following correctly explains the difference between a «for…in» and a «for» loop?

Answers:

        1. «for…in» has two expressions. It iterates over the enumerable properties of an object, in an arbitrary order, for each distinct property, statements can be executed. This should not be used to iterate over an array where index order is important.
          «for» consists of three optional expressions enclosed in parentheses and separated by semicolons, followed by a statement executed in the loop.
        2. «for…in» has three expressions. It iterates over the enumerable properties of an object, in an arbitrary order, for each distinct property, statements can be executed. This should not be used to iterate over an array where index order is important.
          «for» consists of four optional expressions enclosed in parentheses and separated by semicolons, followed by a statement executed in the loop.
        3. «for…in» iterates over the enumerable properties of an object, in an arbitrary order, for each distinct property, statements can be executed. This should be used to iterate over an array where index order is important.
          «for» consists of three optional expressions enclosed in parentheses and separated by semicolons, followed by a statement executed in the loop.
        4. «for…in» iterates over the enumerable properties of an object, in arbitrary order, for each distinct property, statements can be executed, this should be used to iterate over an array where index order is important.
          «for» consists of two optional expressions enclosed in parentheses and separated by semicolons, followed by a statement executed in the loop.

167.Which of the following will list the properties of a JavaScript object?

Answers:

  1. var keys = Object.keys(myJsonObject);
  2. var keys = Object.value(myJsonObject)
  3. var keys = Object.keys(myJsonValue)
  4. None of these

168.Consider the following image definition:
<img id=»logo» src=»companylogo1.gif» height=»12″ width=»12″ >
Which of the following will change the image to companylogo2.gif when the page loads?

Answers:

  1. logo.source=»companylogo2.gif»
  2. logo.source=»companylogo1.gif»
  3. document.getElementById(‘logo’).src=»companylogo1.gif»v
  4. document.getElementById(‘logo’).src=»companylogo2.gif»

169.Which of the following objects in JavaScript contains the collection called «plugins»?

Answers:

  1. Location
  2. Window
  3. Screen
  4. Navigator

170.Which of following uses the «with» statement in JavaScript correctly?

Answers:

  1. with (document.getElementById(«blah»).style) { background = «black»; color = «blue»; border = «1px solid green»; }
  2. with document.getElementById(«blah»).style background = «black»; color = «blue»; border = «1px solid green»; End With
  3. With document.getElementByName(«blah»).style background = «black»; color = «blue»; border = «1px solid green»; End With
  4. with (document.getElementById(«blah»).style) { .background = «black»; .color = «blue»; .border = «1px solid green»; }

171.Which of the following is the best way to show both single and double quotes in the same sentence?

Answers:

  1. alert(«It’s «+’»game»‘+» time.»);
  2. alert(‘It\’s \»game\» time.’);
  3. alert(‘It\’\s «game» time.’);
  4. alert(‘It\’s «game» time.’);

172.Which of the following code snippets shows an alert for an empty string?

Answers:

  1. If(a){ alert(‘This is empty string’);}
  2. If(a == NUL){ alert(‘This is empty string’);}
  3. If(!a){ alert(‘This is empty string’);}
  4. If(a.empty){ alert(‘This is empty string’);}

173.Which of the following code snippets shows an alert for an empty string?

Answers:

  1. var str = ‘something — something_else’; var substrn = str.split(‘ — ‘);
  2. var str = ‘something — something_else’; var substrn = split.str(‘ — ‘);
  3. var str = ‘something — something_else’; var substrn = str.split(‘ — ‘,’ — ‘);
  4. var str = ‘something — something_else’; var substrn = split.str(‘ — ‘,’ — ‘);

174.Which of the following choices will detect if «variableName» declares a function?

var variableName= function(){};

Answers:

  1. return variableName;
  2. nameof variableName;
  3. isFunction variableName;
  4. typeof variableName;

175. Which of the following choices will change the source of the image to «image2.gif» when a user clicks on the image?

Answers:

  1. img id=»imageID» src=»image1.gif» width=»50″ height=»60″ onmousedown=»changeimg(image1.gif)» onmouseup=»changeimg(image2.gif)»
  2. img id=»imageID» src=»image1.gif» width=»50″ height=»60″ onmouseclick=»changeimg(image2.gif)» onmouseup=»changeimg(image1.gif)»
  3. img id=»imageID» src=»image2.gif» width=»50″ height=»60″ onmousedown=»changeimg(image1.gif)» onmouseup=»changeimg(image2.gif)»
  4. img id=»imageID» src=»image2.gif» width=»50″ height=»60″ onmousedown=»changeimg(image2.gif)» onmouseup=»changeimg(image1.gif)»
  5. img id=»imageID» src=»image1.gif» width=»50″ height=»60″ onmousedown=»changeimg(‘image2.gif’)» onmouseup=»changeimg(‘image1.gif’)»

176.Which of the following best describes a «for» loop?

Answers:

  1. «for» loop consists of six optional expressions, enclosed in parentheses and separated by semicolons, followed by a statement executed in the loop.
  2. «for» loop consists of five optional expressions, enclosed in parentheses and separated by semicolons, followed by a statement executed in the loop.
  3. «for» loop consists of four optional expressions, enclosed in parentheses and separated by semicolons, followed by a statement executed in the loop.
  4. «for» loop consists of three optional expressions, enclosed in parentheses and separated by semicolons, followed by a statement executed in the loop.

177.An HTML form contains 10 checkboxes all named «chkItems». Which JavaScript function can be used for checking all the checkboxes together?

Answers:

  1. function CheckAll() { for (z = 0; z < document.forms.chkItems.length; z++) { document.forms.chkItems[z].checked=true } }
  2. function CheckAll() { for (z = 0; z < document.forms[0].chkItems.length; z++) { document.forms[0].chkItems[z].checked=true } }
  3. function CheckAll() { for (z = 0; z < document.forms[0].chkItems.length; z++) { document.forms[0].chkItems.list[z].checked=true } }
  4. function CheckAll() { for (z = 0; z < document.forms[0].chkItems.length; z++) { document.forms[0].chkItems.list[z].checked=false } }

178. Consider the following JavaScript function to change the color of the text box named txtName:
function color(col) { document.forms[0].txtName.style.background=col }
Which of the following will change the color of the text box to green, as long as the user is pressing a key?
Answers:

  1. input type=»text» onkeydown=»color(‘white’)» onkeyup=»color(‘green’)» name=»txtName»
  2. input type=»text» onkeydown=»color(‘green’)» onkeyup=»color(‘white’)» name=»txtName»
  3. input type=»text» onkeydown=»color(‘green’)» name=»txtName»
  4. input type=»text» onkeydown=»color(‘white’)» name=»txtName»
  5. input type=»text» onkeypress=»color(‘green’)» onkeyup=»color(‘white’)» name=»txtName»

179.Which of the following code snippets returns «[object object]»?

Answers:

  1. var o = new Object(); o.toSource();
  2. var o = new Object(); o.valueOf();
  3. var o = new Object(); o.toString();
  4. var o = new Object(); o.getName(); <

180.In an HTML page, the form tag is defined as follows:
<form onsubmit=»return Validate()» action=»http://www.mysite.com/»>
The validate() function is intended to prevent the form from being submitted if the name field in the form is empty. What should the validate() function look like?

Answers:

  1. function Validate() { if(document.forms[0].name.value == «») return true; else return false; }
  2. function Validate() { if(document.forms[0].name.value == «») return false; else return true; }
  3. function Validate() { if(document.forms[0].name== «») return false; else return true; }
  4. function Validate() { if(document.forms[0].name == «») return true; else return false; }

181.Which of the following results is returned by the JavaScript operator «typeof» for the keyword «null»?

Answers:

  1. function
  2. object
  3. string
  4. number

182.What will be the final value of the variable «apt»?
var apt=2;
apt=apt<<2;

Answers:

  1. 2
  2. 4
  3. 6
  4. 16

183.Consider three variables:
someText = ‘JavaScript1.2’;
pattern = /(\w+)(\d)\.(\d)/i;
outCome = pattern.exec(someText);
What does pattern.global contain?
Answers:

  1. true
  2. false
  3. undefined
  4. null
  5. 1

184.What does the + sign in front of a function name mean in JavaScript?

Answers:

  1. It forces the parser to treat the + sign as a part of an expression.
  2. The + sign is used as a cast operator.
  3. It is used to denote a type of object in JavaScript.
  4. None of these.

185.Consider the following scenario:
The document.write() method is embedded to write some text within a pair of <td></td> table tags. Upon loading the file, however, garbled text appears on the section of the page where the text should be. What could be the reason for this?

Answers:

  1. The browser does not support JavaScript.
  2. An older version of the browser is being used..
  3. The browser does not support cookies.

186.Consider the following code:
var vNew=new Date()
Which of the following options will return true?

Answers:

  1. vNew instanceof boolean
  2. vNew instanceof object
  3. vNew instanceof Date
  4. All of these

187.The following statements show two ways of calling a JavaScript function:
i)onclick = «a();»
ii)onclick=»JavaScript:a();»
Which of the following options is correct, with regard to the two statements above?

Answers:

  1. There is no difference between the two statements.
  2. The first statement is incorrect and the second one is correct.
  3. vNew instanceof Date
  4. The first statement is correct and the second statement is incorrect.

188.Choose another way to write x ? a = b : a = c

Answers:

  1. if (‘x’) { a = b; } else { a = c; }
  2. if (x) { a = c; } else { a = b; }
  3. x : a = c ? a =
  4. None of above

189.What value would JavaScript assign to an unitialized variable?

Answers:

  1. Nan
  2. null
  3. undefined
  4. false

190.What is the difference between setTimeout and setInterval in JavaScript?

Answers:

  1. setInterval executes a function or code snippet a certain amount of time after setInterval() is called, while setTimeout executes a function or code snippet a certain amount of time after the previous timeout fired.
  2. setTimeout executes a function or code snippet a certain amount of time after setTimeout() is called, while setInterval executes a function or code snippet a certain amount of time after the previous interval fired.
  3. setTimeout() triggers only once, while setInterval() triggers repeatedly
  4. There is no difference between setTimeout() and setInterval().

191.What will be the output of this code?
parseInt(1 / 0, 19);

Answers:

  1. 1
  2. 0
  3. 20
  4. 18

192.What will the function NaN return for the condition NaN == NaN?

Answers:

  1. true
  2. false
  3. error
  4. 0

193.What is the output of following charsets in javascript?
++[[]][+[]]+[+[]]

Answers:

  1. 0
  2. 10
  3. 100
  4. 1000

194.While coding a loop, which statement can be used to ignore the rest of the statements, and continue with the beginning of the loop?

Answers:

  1. exit
  2. return
  3. continue
  4. while
  5. break

195.Which of the following code samples prints false?

Answers:

  1. var n = 3.2;
    alert(n===+n && n!==(n|0));
  2. var n = 3;
    alert(n===+n && n===(n|0));
  3. var boolValue = new Boolean(«false»);
    alert(boolValue);
  4. var n=3.2;
    alert(n % 1 === 0);

196.The statement navigator.platform indicates ‘Win16’ on user’s computer that’s running Windows NT. Which of the following is true?

Answers:

  1. navigator.platform is supposed to show ‘Win16’ on Windows NT.
  2. The userAgent property reflects the correct operating system.
  3. The property can be modified.
  4. navigator.platform shows the operating system for which the browser was compiled for.
  5. The browser version is outdated.

197. How can GUIDs/UUIDs be created in JavaScript?

Answers:

  1. GUIDs/UUIDs cannot be created in JavaScript.
  2. The userAgent property reflects the correct operating system.
  3. There is no specific method to create GUIDs/UUIDs, but it’s possible to generate GUID-like random numbers in JavaScript.
  4. JavaScript has methods only for generating GUIDs/UUIDs with only capital letters.
  5. JavaScript has methods for creating and automatically changing GUIDs/UUIDs.

198. Which of the following is the correct method to use, in order to know the name of both the Object and Object Class in JavaScript?

Answers:

  1. toSource()
  2. valueOf()
  3. toString()
  4. getName()

199. How does the keyword work within a JavaScript object literal?

Answers:

  1. var foo = {};
    foo.someMethod = function(){
    alert(this);
    }
  2. someMethod = function(){
    alert(this);
    }
  3. var foo = {};
    someMethod.foo = function(){
    alert(this);
    }
  4. var foo = {};
    someMethod = function(foo){
    alert(this);
    }

200. <a href=’http://w3.org/’ onclick=’someFunc(); return false;’>Click here!</a >
What does «return false» do to this onclick event?

Answers:

  1. It prevents the default browser behavior from taking place alongside someFunc().
  2. It prevents someFunc() to run from a second click.
  3. It prevents someFunc() from returning any values.
  4. None of the above.

201.Which of the following is the best way of retrieving DOM elements using CSS class names?

Answers:

  1. var className = ‘someClassName’;
    var retrievedElements= [];
    var myclass = new RegExp(‘\\b’+className+’\\b’);
    var elem = this.getElementsByTagName(‘*’);
    for (var i = 0; i < elem.length; i++) { var classes = elem[i].className; if (myclass.test(classes)) retrievedElements.push(elem[i]); }
  2. var className = ‘someClassName’;
    var retrievedElements= document.getElementsByClassName(className);
  3. var className = ‘someClassName’;
    var retrievedElements= [];
    var elem = this.getElementsByTagName(‘*’);
    for (var i = 0; i < elem.length; i++) { var classes = elem[i].className; if (className.indexOf(classes) == 0) retrievedElements.push(elem[i]); }
  4. It is not possible to retrieve DOM elements using CSS class names.

202.What is the correct code snippet to change image source?

Answers:

  1. document.getElementById(«imgageId»).src = «newImage.png»;
  2. document.getElementById(«imgageId»).longdesc = «newImage.png»;
  3. document.getElementById(«imgageId»).href = «newImage.png»;
  4. document.getElementById(«imgageId») = «newImage.png»;

203.When toggling a variable, its cycle must be 0 and 1. When the variable’s active value is 0, the next value should be 1, and when the variable’s active value is 1, the next value should be 0.

Considering the scenario above, which of the following is correct?

Answers:

  1. q = (q == 1 ? 1 : 0);
  2. q = 1 — q;
  3. q ^= 0;
  4. q = inv(0);

204. Given a TextArea element with ID «text», which will disable the resizable property of the TextArea?

Answers:

  1. document.getElementById(«text»).style.resize = «none»;
  2. document.getElementById(«text»).style.resize = «disabled»;
  3. document.getElementById(«text»).resize = «none»;
  4. document.getElementById(«text»).resize = «disabled»;

205. Which method evaluates a string of JavaScript code in the context of the specified object?

Answers:

  1. parseInt
  2. Eval
  3. parseFloat
  4. Efloat

206. Which of the following will include a JavaScript file in another JavaScript file?

Answers:

  1. Adding a script tag with the script URL in the HTML
  2. Loading it with an AJAX call then using eval
  3. Using ‘import’ operator
  4. Using ‘include’ operator

207. Suppose you receive url of mp3 from server to play it right away. How would you implement this code snippet?

Answers:

  1. var audio = new Audio();
    audio.play();
  2. var audio = new Audio(url);
    audio.play();
  3. var audio = new Audio(url);
    audio.load();
  4. var audio = new Audio();
    audio.setAttribute(«href», url);
    audio.load();
    audio.play();

208.Which of the following is the correct way to stop setInterval() from calling a function in JavaScript?

Answers:

  1. setInterval() returns an interval ID, which can pass to clearInterval() to stop it from calling its designated function.
  2. Cannot stop the setInterval() from calling its designated function.
  3. var audio = new Audio(url);
    audio.load();
  4. Stopping setInterval() is browser-dependent; some browsers support stopping setInterval(), others don’t.
  5. None of these.

209.Which of the following code samples is correct?

Answers:

  1. var param1 = encodeURIComponent(«http://xyz.com/?a=1&b=2»);
    var param2 = encodeURIComponent(«http://abc.com/?a=2&b=5»);
    var url = «http://test.odesk.com/file name.html?param1=» + param1 + «&param2=» + param2;
    location.href = encodeURI(url);
  2. var param1 = encodeURIComponent(«http://xyz.com/?a=1&b=2»);
    var param2 = encodeURIComponent(«http://abc.com/?a=2&b=5»);
    var url = «http://test.odesk.com/file name.html?param1=» + param1 + «&param2=» + param2;
    location.href = url;
  3. var param1 = encodeURI(«http://xyz.com/?a=1&b=2»);
    var param2 = encodeURI(«http://abc.com/?a=2&b=5»);
    var url = «http://test.odesk.com/file name.html?param1=» + param1 + «&param2=» + param2;
    location.href = encodeURIComponent(url);
  4. var param1 = encodeURIComponent(«http://xyz.com/?a=1&b=2»);
    var param2 = encodeURIComponent(«http://abc.com/?a=2&b=5»);
    var url = «http://test.odesk.com/file name.html?param1=» + param1 + «&param2=» + param2;
    href.location = encodeURI(url);

210.Which of the following statements about the ‘new’ keyword is incorrect?

Answers:

  1. It creates a new object.
  2. It sets the constructor property of the object to ‘Object’.
  3. var audio = new Audio(url);
    audio.load();
  4. It prevents any user-defined function from being called as a constructor.
  5. It executes a constructor function.

211.How can you calculate the number of arguments received by the function?

Answers:

  1. Using arguments.length
  2. Using args.length.
  3. Using count(arguments)
  4. Can not be determined

212. Which of the following statements are true regarding «window.onload» and «»?

Answers:

  1. There is no difference between «window.onload» and «», and there is no general preference between the two, as far as best practices is concerned.
  2. «window.onload» and «» are functionally equivalent, but «» is preferred because it combines the JavaScript code with the HTML markup.
  3. «window.onload» and «» are functionally equivalent, but «window.onload» is preferred because it separates the JavaScript code from the HTML markup.
  4. None of the above.

213. The following codes are for comparing equality operators «==» and «===» in JavaScript.
Which of the following are the correct results?

Answers:

  1. var a = «12» + «3»;
    var b = «123»;
    return (a === b);
    result: true
  2. var a = [1,2,3];
    var b = [1,2,3];
    return (a == b);
    result: false
  3. var a = new String(«123»);
    var b = «123»;
    return (a === b);
    result: true/li>
  4. var a = { x: 1, y: 2 };
    var b = { x: 1, y: 2 };
    return (a == b);
    result: true.

214. Which of the following code prints false?

Answers:

  1. var boolValue = new Boolean(«false»);
    alert(boolValue);
  2. var boolValue = new Boolean();
    alert(boolValue); var boolValue = new Boolean();
    alert(boolValue);
  3. var boolValue = String(«false») == «false»;
    alert(boolValue);
  4. var boolValue = «false»;
    alert(!!boolValue);

215. Which of the following code prints false?

Answers:

  1. var boolValue = new Boolean(«false»);
    alert(boolValue);
  2. var boolValue = new Boolean();
    alert(boolValue); var boolValue = new Boolean();
    alert(boolValue);
  3. var boolValue = String(«false») == «false»;
    alert(boolValue);
  4. var boolValue = «false»;
    alert(!!boolValue);

216. Which of the following statements are correct about null and undefined?

Answers:

  1. Undefined indicates that a variable has not been assigned a value. Null can be assigned to a variable as a representation of no value.
  2. Both undefined and null indicate that a variable has not been assigned a value.
  3. Null is a primitive value used when a variable has not been assigned a value. Undefined is a primitive value that represents an empty or non-existent reference.
  4. None of these.

217. Which of the following will include a CSS style sheet in page, after an event has occurred?

Answers:

  1. document.write();
  2. document.createStyleSheet(‘somestyle.css’);
  3. var styles = «@import url(‘somestyle.css ‘);»;
    var newSS = document.createElement(‘link’);
    newSS.rel = ‘stylesheet’;
    newSS.href = ‘data:text/css,’ + escape(styles);
  4. None of these.

218.Which of the following statements regarding prototypes in JavaScript is not correct?

Answers:

  1. document.write();
  2. document.createStyleSheet(‘somestyle.css’);
  3. var styles = «@import url(‘somestyle.css ‘);»;
    var newSS = document.createElement(‘link’);
    newSS.rel = ‘stylesheet’;
    newSS.href = ‘data:text/css,’ + escape(styles);
  4. None of these.

219.Which of the following statements regarding prototypes in JavaScript is not correct?

Answers:

  1. The prototype property allows you to add properties and methods to an object.
  2. The prototype property is initially an empty object, and can have members added to it.
  3. Every object has a prototype by default.
  4. Prototype does not have a prototype.

220.Which of the following statements is incorrect regarding SVG

Answers:

  1. SVG stands for Scalable Vector Graphics.
  2. SVG graphics do NOT lose any quality if they are zoomed or resized.
  3. SVG images can be searched, indexed, scripted, and compressed.
  4. SVG is a W3C recommendation

221.Suppose you have a circle element of SVG element. How to draw black border with width 10px for this circle element?

Answers:

  1. circle.setAttribute( “stroke”, “#000000”);
    circle.setAttribute( “stroke-width”, “10”);
  2. circle.setAttribute( “border-color”, “#000000”);
    circle.setAttribute( “border-width”, “10”);
  3. circle.setAttribute( “border”, “#000000; 10”);
  4. circle.setAttribute( “stroke”, “#000000 10”);

222.What is the correct format for adding comments to a JSON file

Answers:

  1. /* comment */
  2. Comments aren’t allowed inside JSON files.

223.What is the correct format for adding comments to a JSON file

Answers:

  1. /* comment */
  2. <!— comment —>
  3. <? comment ?>
  4. Comments aren’t allowed inside JSON files.

224. How can you get the type of arguments passed to a function?

Answers:

  1. using typeof operator
  2. using getType function
  3. Both of the above.
  4. None of the above.

225. Which operator creates a new object from the specified object type?

Answers:

  1. obj
  2. create
  3. new
  4. None of the above.

226. Which of the following variable examples is/are undefined?

Answers:

  1. var a;
  2. var a = “undefined”;
  3. var a = undefined;
  4. All of the above

227. How many type(s) of storage HTML5 supports?

Answers:

  • 1
  • 2
  • 3
  • 4

228. Which of the following code snippets sets cookie correctly?

Answers:

  1. document.cookie = «username=John;password=John#1»;
  2. document.cookie = «username:John;password:John#1»;
  3. document.cookie(«username=John;password=John#1»);
  4. document.cookie = «username=John password=John#1»;

229. Which of the following code snippets sets the cookie which will expire when the browser is closed down?

Answers:

  1. var cookie_date = new Date ( );
    cookie_date.setTime ( cookie_date.getTime() — 1 );
    document.cookie = «username=John;password=John#1;expires=» + cookie_date.toGMTString();
  2. document.cookie = «username=John;password=John#1»;
  3. var cookie_date = new Date ( );
    cookie_date.setTime ( cookie_date.getTime() + 1000 );
    document.cookie = «username=John;password=John#1;expires=» + cookie_date.toGMTString();
  4. document.cookie = «username=John;password=John#1;expires=0»;

230. Imagine you have canvas which has image in its content. How to capture HTML Canvas as image?

Answers:

  1. var canvas = document.getElementById(«canvasID»);
    var url = canvas.toDataURL(«image/png»);
    document.write(‘<img src=»‘+url+’»/Z&lgt;’);
  2. var canvas = document.getElementById(«canvasID»);
    var context = canvas .getContext(«2d»);
    var imgData=ctx.getImageData(10,10,50,50);
    document.write(imgData);
  3. var canvas = document.getElementById(«canvasID»);
    var context = canvas .getContext(«2d»);
    var img=document.getElementById(«someImageId»);
    context.drawImage(img,0,0);
  4. It is not possible.

231. What kind of Typed Arrays representation of the pixels does Canvas ImageData return when you call ImageData.data?

Answers:

  1. Uint8ClampedArray
  2. Uint8Array
  3. Int8Array
  4. Uint32Array

232.Which of the following is not a valid variable name?

Answers:

  1. myvar
  2. my_var
  3. 5myvar
  4. myvar_5

233.Can Javascript functions be nested?

Answers:

  1. Yes
  2. No

234.Suppose you have several pages in different locations and need to implement messaging between them. How would you solve security issues?

Answers:

  1. Not to add any event listeners for message events. This is a completely foolproof way to avoid security problems.
  2. Always verify the sender’s identity using the origin and possibly source properties, always verify the syntax of the received message.
  3. use listener method in the following form
    function receiveMessage(event) {
    if (event.origin == senderURL) {
    return;
    }
    // do whatever you want
    }
    window.addEventListener(«message», receiveMessage, false);

235.What is the event that fires when the form element textarea loses the focus?

Answers:

  1. Onclick
  2. Ondbclick
  3. Onfocus
  4. Onblur

236.Which of the following can be used to handle the user clicking on a node?

Answers:

  1. node.addEventListener( “click”, myFunction, false)
  2. node.addEventListener( “onclick”, myFunction, false)
  3. node.onclick = myFunction
  4. node.attachEvent( “onclick”, myFunction)

237.Which of the following is not a mouse event?

Answers:

  1. onmousescroller
  2. onclick
  3. onmouseover
  4. onmousemove

238.What is the correct way to create a JavaScript array?

Answers:

  1. var cars = [“Saab”, “Volvo”, “BMW”];
  2. var cars = “Saab”, “Volvo”, “BMW”
  3. var cars = 1 = (“Saab”), 2 = (“Volvo”), 3 = (“BMW”)
  4. var cars = (1:”Saab”, 2:“Volvo”, 3:“BMW”);

239.What will following code print on browser console?

var foo = function foo() {
console.log(foo === foo);
};
foo();

Answers:

  1. true
  2. false
  3. nothing
  4. It will raise an exception.

240.What command skips the rest of a case statement?

Answers:

  1. return
  2. exit
  3. continue
  4. break

241. What method can’t be used with a window object?

Answers:

  1. open
  2. read
  3. write
  4. close

242. How can you detect the client’s browser name?

Answers:

  1. client.navName
  2. browser.appName
  3. navigator.appName
  4. None of these

243. Which of the following is/are the correct way to redirect to a URL in javascript?

Answers:

  1. document.href= ‘http://www.foobar.com’;
  2. window.location.assign (“http://www.foobar.com”)
  3. window.location = ‘http://www.foobar.com’;
  4. navigator.location = ‘http://www.foobar.com’;

244. Which of the following way is the best to check browser support for localStorage and sessionStorage?

Answers:

  1. if(typeof(Storage)!==”undefined”) {
    // Yes! localStorage and sessionStorage support:
    // Some code…..
    }
    else {
    // Sorry! No web storage support..
    }
  2. if(sessionStorage!==”undefined”) {
    // Yes! localStorage and sessionStorage support:
    // Some code…..
    }
    else {
    // Sorry! No web storage support..
    }
  3. if(typeof(localStorage)!==null && typeof(sessionStorage)!==null ) {
    // Yes! localStorage and sessionStorage support:
    // Some code…..
    }
    else {
    // Sorry! No web storage support..
    }
  4. if(localStorage)!==”undefined”) {
    // Yes! localStorage and sessionStorage support:
    // Some code…..
    }
    else {
    // Sorry! No web storage support..
    }

245. For the following html element, which is the correct method to change the font size to 25px using javascript?
<p id = “foo”>Lorem Ipsum&lt/p>

Answers:

  1. document.getElementById(“foo”).setFontSize = “25px”;
  2. document.getElementById(“foo”).style.FontSize = “25px”;
  3. document.getElementById(“foo”).fontSize = “25px”;
  4. document.getElementById(“foo”).style(“font-size = 25px”);

246. Which Window method is used to call a function or evaluate an expression at specified intervals?

Answers:

  1. setInterval()
  2. repeat()
  3. setTimeout()

247. What will be the output of following code?
function sum() {
var retval = 0;
for (var i = 0, len = arguments.length; i < len; ++i) {
retval += arguments[i];
}
return retval;
}
console.log(sum(1, 2, 3))

Answers:

  1. It will print 1 on browser console
  2. It will print 6 on browser console
  3. It will throw undefined message error

248. Which of following statements is incorrect regarding localStorage and sessionStorage?

Answers:

  1. localStorage — stores data with no expiration date
  2. sessionStorage — stores data for one session
  3. The data stored with session Storage is deleted when the user closes the browser window.
  4. The data stored with localStorage will not be deleted when the browser is closed, and will be available the next day, week, or year.
  5. None of above

249. Which of the following methods is used to get the current location of a user?

Answers:

  1. getUserPosition()
  2. getCurrentPosition()
  3. getPosition()
  4. None of above

250. Suppose you have a following Worker. How do you stop this Worker from the main page?
var w = new Worker(“”workers.js””);
Answers:

  1. w.terminate();
  2. w = null;
  3. w.close();
  4. w.postMessage(“stop”);

251.Which of the following statements is incorrect regarding HTML5 Web Worker?

Answers:

  1. A web worker is a JavaScript that runs in the background.
  2. It runs independently of other scripts, without affecting the performance of the page
  3. The data from the web worker is stored in event.source
  4. postMessage() method — which is used to posts a message back to the HTML page.

252.Which of the following statements is incorrect regarding HTML5 Geolocation?

Answers:

  1. The HTML5 Geolocation is used to get the geographical position of a user and much more accurate for devices with GPS.
  2. watchPosition() method of Geolocation object — returns the current position of the user and continues to return updated position as the user moves
  3. The getCurrentPosition() method returns an object if it is successful.
  4. The position is always available without the user permission

253. What is the output of the following code?
if (typeof(Storage)!==”undefined”) {
localStorage.age=5;
sessionStorage.age=5;
alert(localStorage.age + sessionStorage.age);
}
else {
alert(“Sorry, your browser does not support web storage…”);
}

Answers:

  1. 55
  2. 10
  3. Sorry, your browser does not support web storage…
  4. 5undefined

254. What is the output of the following code?
var foo = 123e5;
var bar = 10;
var foobar = foo + bar;
alert(foobar)

Answers:

  1. 12300010
  2. 1230000010
  3. 123e510
  4. 133

255. What will be the final output ?
var x=3;
x=x<<3;

Answers:

  1. 1
  2. 3
  3. 24
  4. 9

256. What will be the output of following code snippet?
var result = (function(a) {
return a*a;
}(5.5));
alert(result);

Answers:

  1. 5
  2. 25
  3. 10
  4. 30.25

257. What is the correct JavaScript syntax to change the content of next HTML element?
<p id=»sample»>This is a sample text.</p>

Answers:

  1. document.getElement(«p»).innerHTML = «Hello World!»;
  2. #sample.innerHTML = «Hello World!»;
  3. document.getElementById(«sample»).innerHTML = «Hello World!»;
  4. document.getElementByName(«p»).innerHTML = «Hello World!»;

258. What is the correct syntax for referring to an external script called «test.js»?

Answers:

  1. <script name=»test.js»>
  2. <script href=»test.js»>
  3. <script src=»test.js»>
  4. None of these

259. Which of the following code snippets deletes cookie correctly?

Answers:

  1. var mydate = new Date();
    mydate.setTime(mydate.getTime() — 1);
    document.cookie = «username=; expires=» + mydate.toGMTString();
  2. document.cookie = null;
  3. document.cookie = «username=John;password=John#1»;
  4. var mydate = new Date();
    mydate.setTime(mydate.getTime() + 1000000);
    document.cookie = «username=; expires=» + mydate .toGMTString();

260. What will the output of the below code?
function clickValue(){
alert(Math.round(-20.5));
}
clickValue();

Answers:

  1. -20
  2. -21
  3. 20
  4. 19.5

261. What is not true about anonymous functions?

Answers:

  1. anonymous functions are created at runtime.
  2. anonymous functions don’t have a name.
  3. anonymous functions can not return any value.
  4. All variables and functions defined within the anonymous function aren’t available to the code outside of it.

262.What will be the output of following code?
var x = 1;
{
var x = 2;
}
alert(x);

Answers:

  1. 1
  2. 2
  3. undefined
  4. code will raise an exception

263.new String(«This is a JavaScript string») instanceof String evaluates to?

Answers:

  1. False
  2. True
  3. Error
  4. String

264.Which of the following is the correct method to update the content of an HTML element ‘p’ with id = ‘foo’?

Answers:

  1. document.getElementById(«foo»).innerHTML = «some text»;
  2. document.getElementById(«foo»).HTML = «some text»;
  3. document.getElementById(«foo»).text = «some text»;
  4. document.getElementById(«foo»).text = «some text»;

265.What will be the output of following code snippet?
var foo = 10;
bar = 3;
(function() {
var foo = 2;
bar= 1;
}())
bar = bar + foo;
alert(bar);

Answers:

  1. 11
  2. 3
  3. 30
  4. 12

266.Which of the following is incorrect way of instantiating a date?

Answers:

  1. new Date(dateString)
  2. new Date()
  3. new Date(seconds)
  4. new Date(year, month, day, hours, minutes, seconds, milliseconds)

267.What will be the output of following code?
var x = [typeof x, typeof y][1];
console.log(typeof typeof x);

Answers:

  1. string
  2. object
  3. array
  4. It will raise an exception

268.What will this code output?
console.log(typeof a);
console.log(typeof b);
function a() {
}
var b = function () {
};

Answers:

  1. function, function
  2. function, undefined
  3. undefined, undefined
  4. undefined, function
  5. An error

269.Which of the following is a client side object?

Answers:

  1. Database
  2. FileUpLoad
  3. Client
  4. Cursor

270.How do you locate the first X in a string variable named txt?

Answers:

  1. txt.find(‘X’);
  2. txt.locate(‘X’);
  3. txt.indexOf(‘X’);
  4. txt.countTo(‘X’);

271.How to write an IF statement for executing some code if var «my_id» is NOT equal to 10?

Answers:

  1. if (my_id<>10)
  2. if my_id =! 10 then
  3. if my_id <>10
  4. if (my_id != 10)

272.Evaluate the following expression: ~-(2 + «2»)

Answers:

  1. undefined
  2. SyntaxError
  3. 21
  4. -22

273.What would be the output of below regular expression code:
/e/.exec(«The best things in life are free!»);

Answers:

  1. e
  2. 6
  3. 4
  4. true

274.What is the actual way to remove a property from an object?

Answers:

  1. by setting property to undefined
  2. by deleting the property using delete operator
  3. by setting property to null
  4. You can not delete an individual property from an object.

275.What is the use of «this» keyword in JavaScript?

Answers:

  1. It refers to current object
  2. It refers to previous object
  3. It is variable which contains value
  4. None of the above

276.Which of the following determines the type of a given object?

Answers:

  1. variable
  2. typeof
  3. string
  4. object

277. Which of the following is not a valid JavaScript Assignment Operator?

Answers:

  1. /=
  2. *=
  3. =
  4. %=
  5. ^

278. What is the correct JavaScript syntax to change the content of the HTML element with id «header»?

Answers:

  1. document.getElementById(«header»).innerHTML = «Updated Header!»;
  2. #header.innerHTML = «Updated Header!»;
  3. $header.innerHTML = «Updated Header!»;
  4. document.getElement(«p»).innerHTML = «Updated Header!»;

279. What will be the output of the following code?
var foo = 10 << 1;

Answers:

  1. 10
  2. 20
  3. 0
  4. 30

ENGLISH SPELLING TEST (U.S. VERSION) 2016

Pass test with rajat marketing mania

1. Identify the misspelled word in the list below.

Answers:

  1. Pageant
  2. Poignant
  3. Plummage
  4. Priggish

2. Choose the correct spelling of the word from the options below.

Answers:

  1. Persue
  2. Parsue
  3. Persou
  4. Pursue

3. Complete the following sentence by choosing the correct spelling of the missing word.

The judge granted the reluctant witness complete ____________ from prosecution for his part in the crime.

Answers:

  1. amnesty
  2. amnasty
  3. anmesty
  4. emnesty

4. Choose the correct spelling of the word from the options below.

Answers:

  1. Vacuum
  2. Vaccuum
  3. Vacumm
  4. Vaccum

5. Complete the following sentence by choosing the correct spelling of the missing word.

Arthur spent hours admiring the gothic ____________of all those French cathedrals.

Answers:

  1. architecture
  2. arkhitecture
  3. arcitecture
  4. arckitecture

6. Choose the correct spelling of the word from the options below.

Answers:

  1. Forfiet
  2. Forfeit
  3. Forefeit
  4. Fourfit

7. Complete the following sentence by choosing the correct spelling of the missing word.

The waitress brought me a plate of squid even though I _____________ asked for clams.

Answers:

  1. specificaly
  2. specifically
  3. specifycally
  4. specificly

8. Choose the correct spelling of the word from the options below.

Answers:

  1. Posess
  2. Poesess
  3. Possess
  4. Pozess

9. Choose the correct spelling of the word from the options below.

Answers:

  1. Idiosyncracy
  2. Idiosincrasy
  3. Idiosyncrasy
  4. Ideosyncracy

10. Choose the correct spelling of the word from the options below.

Answers:

  1. Manoeuvar
  2. Manouver
  3. Maneuver
  4. Manuver

11. Identify the misspelled word in the list below.

Answers:

  1. CouncelorM
  2. Condescend
  3. Camouflage
  4. Criticize

12. Complete the following sentence by choosing the correct spelling of the missing word.

Sam _________ a successful political campaign.

Answers:

  1. orchestraited
  2. orchestrated
  3. orchestreated
  4. orcestrated

13. Identify the misspelled word in the list below.

Answers:

  1. Rhythmical
  2. Reminiscence
  3. Rheumatism
  4. Resevoir

14. Choose the correct spelling of the word from the options below.

Answers:

  1. Reminiscience
  2. Reminiscence
  3. Reminescence
  4. Reminisense

15. Identify the misspelled word in the list below.

Answers:

  1. Yacht
  2. Youthful
  3. Yeilding
  4. Yesterday

16. Identify the misspelled word in the list below.

Answers:

  1. Wierd
  2. Wired
  3. Whined
  4. Willful

17. Choose the correct spelling of the word from the options below.

Answers:

  1. Embarassment
  2. Embrassement
  3. Embarrasment
  4. Embarrassment

18. Complete the following sentence by choosing the correct spelling of the missing word.

He __________ a summer house, an exercise bike, and a hamster in the divorce settlement.

Answers:

  1. accquired
  2. ecquired
  3. acquired
  4. akquired

19. Identify the misspelled word in the list below.

Answers:

  1. Cachet
  2. Connoisseur
  3. Charateristic
  4. Catastrophe

20. Choose the correct spelling of the word from the options below.

Answers:

  1. Adress
  2. Addrress
  3. Addres
  4. Address

21. Choose the correct spelling of the word from the options below.

Answers:

  1. Temperamental
  2. Tempermental
  3. Temperamentle
  4. Temparamental

22. Identify the misspelled word in the list below.

Answers:

  1. Accomodate
  2. Analyze
  3. Acknowledgment
  4. Asterisk

23. Choose the correct spelling of the word from the options below.

Answers:

  1. Heinous
  2. Henous
  3. Heinus

24. Complete the following sentence by choosing the correct spelling of the missing word.

The protesters hurled ___________ insults at us as we walked by.

Answers:

  1. vicous
  2. vicious
  3. vicoius
  4. vicius

25. Choose the correct spelling of the word from the options below.

Answers:

  1. Gauge
  2. Gaje
  3. Guage
  4. Gaige

26. Complete the following sentence by choosing the correct spelling of the missing word.

Their relationship was plagued by __________ problems.

Answers:

  1. perpetual
  2. perpechual
  3. purpetual
  4. perptual

27. Choose the correct spelling of the word from the options below.

Answers:

  1. Excesive
  2. Exccesive
  3. Excessive
  4. Exceesive

28. Choose the correct spelling of the word from the options below.

Answers:

  1. Priveledge
  2. Privilage
  3. Privilege
  4. Privelege

29. Complete the following sentence by choosing the correct spelling of the missing word.

The purpose of your report should be to ___________ the most relevant facts, not to obscure them.

Answers:

  1. illumenate
  2. iluminate
  3. illuminate
  4. elluminate

30. Complete the following sentence by choosing the correct spelling of the missing word.

On the ____________ day of Christmas, Lucy was annoyed to find her yard full of noisy drummers drumming.

Answers:

  1. twelvth
  2. twelfth
  3. twelfeth
  4. twelth

31. Choose the correct spelling of the word from the options below.

Answers:

  1. Exhilirate
  2. Exhilarate
  3. Exhilireat
  4. Exhilrate

32. Choose the correct spelling of the word from the options below.

Answers:

  1. Bureaucrasy
  2. Buroucracy
  3. Bureaucracy
  4. Beuraucracy

33. Complete the following sentence by choosing the correct spelling of the missing word.

Hazel Dormouse is a _________ creature.

Answers:

  1. nocternal
  2. nocturnal
  3. noctarnal
  4. nacturnal

34. Complete the following sentence by choosing the correct spelling of the missing word.

The church members accused the cult of _______________ practices.

Answers:

  1. sacreligious
  2. sacrelegious
  3. sacrilegious
  4. sacrilgious

35. Identify the misspelled word in the list below.

Answers:

  1. Hemorrhage
  2. Harass
  3. Hankerchief
  4. Hypocrisy

36. Identify the misspelled word in the list below.

Answers:

  1. Sophomore
  2. Supersede
  3. Susceptable
  4. Spontaneous

37. Choose the correct spelling of the word from the options below.

Answers:

  1. Conscentiuos
  2. Consentious
  3. Conscientous
  4. Conscientious

38. Identify the misspelled word in the list below.

Answers:

  1. Enhancement
  2. Elicit
  3. Enegma
  4. Ecstasy

39. Complete the following sentence by choosing the correct spelling of the missing word.

No one knew what devious experiments the scientist conducted in his ______________ .

Answers:

  1. labretory
  2. laboratary
  3. laboratory
  4. labratory

40. Complete the following sentence by choosing the correct spelling of the missing word.

Emma has always been fascinated by the way the mind works, so she’s decided to get a degree in __________.

Answers:

  1. pshycology
  2. psycology
  3. psyhcology
  4. psychology

41. Complete the following sentence by choosing the correct spelling of the missing word.

Helen was surprised by the __________ stature of her blind date.

Answers:

  1. diminutive
  2. diminuative
  3. deminutive
  4. dimminutive

42. Complete the following sentence by choosing the correct spelling of the missing word.

Peter always makes such a _____________ of himself!

Answers:

  1. nuisance
  2. nuisents
  3. newsanse
  4. nuisince

43. Complete the following sentence by choosing the correct spelling of the missing word.

Mrs. Baker took her ______________ class on a field trip to the zoo.

Answers:

  1. kindergarden
  2. kindegarten
  3. kindergarten
  4. kindegarden

44. Complete the following sentence by choosing the correct spelling of the missing word.

The crowd ________________ me on my acceptance into Mensa.

Answers:

  1. congradulated
  2. congrachulated
  3. congratulated
  4. congratilated

45. Complete the following sentence by choosing the correct spelling of the missing word.

The annual _____________ was ruined when a family of bears stole all the hotdogs.

Answers:

  1. barbecue
  2. barbequeue
  3. barbycue
  4. barbcue

46. Complete the following sentence by choosing the correct spelling of the missing word.

Sally’s nervous __________ left her standing at the altar.

Answers:

  1. fiancé
  2. finance
  3. feancé
  4. fience

47. Complete the following sentence by choosing the correct spelling of the missing word.

Clara the cat simply chose to ignore the ______________ of our dog.

Answers:

  1. existence
  2. existance
  3. existense
  4. existanse

48. Complete the following sentence by choosing the correct spelling of the missing word.

My father does not believe in ____________ , but my mother does.

Answers:

  1. reincanation
  2. reincarenation
  3. reincarnation
  4. reincantation

49. Complete the following sentence by choosing the correct spelling of the missing word.

The savvy dancer acted as a __________ between the detective and the cabaret owner.

Answers:

  1. liasion
  2. liaison
  3. liasone
  4. leason

50. Which of the following options means, “the owner or manager of a restaurant”?

Answers:

  1. Restaureter
  2. Restaurater
  3. Restaurateur
  4. Restourateur

51. Complete the following sentence by choosing the correct spelling of the missing word.

Be sure to leave your travel __________with the secretary so he’ll know how to reach you while you’re away.

Answers:

  1. tenreray
  2. itinerary
  3. iteneray
  4. itinirary

52. Complete the following sentence by choosing the correct spelling of the missing word.

The clown’s performance was _______________, to say the least.

Answers:

  1. dissapointing
  2. dissappointing
  3. disapointing
  4. disappointing

53. Complete the following sentence by choosing the correct spelling of the missing word.

_________animals feed almost exclusively on meat.

Answers:

  1. Carnivorus
  2. Carnivorous
  3. Carnivoures
  4. Carnivoreus

54. Complete the following sentence by choosing the correct spelling of the missing word.

After my grandfather was diagnosed with chronic_________, he moved to Arizona.

Answers:

  1. Neumonia
  2. Penumonia
  3. Pneumonia
  4. Pnuemonia

55. Complete the following sentence by choosing the correct spelling of the missing word.

He wrote __________on every topic from shoestrings to string theory.

Answers:

  1. prollifically
  2. prolificaly
  3. prollificaly
  4. prolifically

56. Complete the following sentence by choosing the correct spelling of the missing word.

Let me tie your mittens to your sleeves so you don’t ______________ them.

Answers:

  1. loose
  2. looze
  3. lose
  4. louse

57. Complete the following sentence by choosing the correct spelling of the missing word.

Many would-be travelers were _____________ by the price of gas last summer.

Answers:

  1. flabergasted
  2. flabberghasted
  3. flabbergasted
  4. flabbergashted

58. Complete the following sentence by choosing the correct spelling of the missing word.

The professor made it clear that ___________ would not be tolerated.

Answers:

  1. plagiarism
  2. plagiarizm
  3. plagerism
  4. plagirism

Upwork Search Engine Optimization Test 2016 (Top 10percent) Answers

Upwork Search Engine Optimization Test 2016

Pass test with rajat marketing mania

62 Answered Test Questions:

1. Which of the following factors have an impact on the Google PageRank?
Answers:
a. The total number of inbound links to a page of a web site
b. The subject matter of the site providing the inbound link to a page of a web site
c. The text used to describe the inbound link to a page of a web site
d. The number of outbound links on the page that contains the inbound link to a page of a web site

2. If your site is not appearing in Google search results because of some unethical SEO practices in the recent past, _________________.

Answers:
a. abandon and close your website permanently.
b. modify the page contents, make them useful and relevant to the human users, and request Google to reconsider your site.
c. start a PPC campaign to get your site included in the sponsored results.
d. it is better to discontinue the website and shift your webpages to a fresh website with a new domain name.

3. What does the term Keyword Prominence refer to?

Answers:
a. It refers to the fact that the importance of choosing high traffic keywords leads to the best return on investment
b. It refers to the importance attached to getting the right keyword density
c. It refers to the fact that the keywords placed in important parts of a webpage are given priority by the search engines
d. It refers to the fact that the keywords in bold font are given priority by the search engines

4. What will happen if you type the words ‘Certification -Networking’ in the Google search box?

Answers:
a. Google will find the web pages about Certification and also containing the word “Networking”
b. Google will find all the web pages containing the words “Certification” and “Networking”
c. Google will find all the web pages in which the words “Certification” and “Networking” appear together
d. Google will find the web pages about Certification that do not contain the word Networking

5. Which black hat SEO technique is characterized by a method to deceive search engines, by detecting the search engine bot and “feeding” it with a different HTML code than the HTML actually served to users?

Answers:
a. Coating
b. Foisting
c. Slighting
d. Cloaking

 

6. Which of the following statements is correct with regard to the description meta tag?

Answers:
a. It should be about 50 characters in length
b. The description should not contain the keywords
c. If the meta description is not included, the search engines will use the meta keywords for information
d. Google uses the meta description to generate the search engine results pages

7. Which of the following factors contribute towards link popularity of a website?

Answers:
a. The number of websites that link to it
b. The number of pages of the website indexed by Google
c. The number of pages in the website
d. The quality of websites that link to it

 

8. Which of the following statements about the Google Sitemap are correct:

Answers:
a. Repeated submission of the Sitemap to Google could be penalized
b. It is possible to create and submit specialized Sitemaps to Google for Video and Mobile content
c. The Sitemap acceptable to Google follows an XML format

9. Which of the following statements about Google’s technical and quality guidelines are true?

Answers:
a. It is advantageous if your web server supports the If-Modified-Since HTTP header
b. If using dynamic pages, it helps to keep the parameters short and the number of them few
c. Avoid using robots.txt to prevent crawling of search results pages or other auto-generated pages, even if they don’t add much value for users coming from search engines
d. Submitting new pages of your website at http://www.google.com/addurl.html as soon as they are online, helps to speed up indexing

10. Which of the following conditions will Google treat favorably from the ‘Relevancy’ perspective?

Answers:
a. The website offering products and services to the visitors country
b. A website that provides free content for the related keywords
c. Hidden keywords on the home page matching the search term
d. Image Alt tags on the home page matching the search term

11. Some words, when followed by a colon, have special meanings to Yahoo. What is performed by the link: operator?

Answers:
a. It shows all the outbound links from the URL
b. It shows how many pages of the site Yahoo is pointing to
c. It shows all the pages that point to that URL
d. It shows URLs with broken links

12. Search engines do not index some common words (such as “or”, “and”, “when”, and “in”) within the webpage. What are these common words called?

Answers:
a. Barrier words
b. Non-indexable words
c. Slow words
d. Stop words

13. Which of the following statements about search engine optimization techniques are correct:

Answers:
a. Making a keyword bold does not influence the way that the search engine looks at the keyword
b. Websites with deep linking are looked at favorably by search engines
c. Search engine robots follow the first link they find to any particular page and they do not follow additional links to the same page
d. It is not a good idea to have the same anchor text for all inbound links as it could look automated to the search engines

14. Which of the following can be termed as good keyword selection and placement strategies?

Answers:
a. Targeting synonyms of the main keyword
b. Targeting the highest searched keywords only
c. Copying competitor keywords
d. Optimizing five or more keywords per page

15. What is Keyword Density?

Answers:
a. The number of times the keyword is used / (DIVIDED BY) the total word count on page – (MINUS)the total words in HTML on the page
b. The number of times the keyword is used X (MULTIPLIED BY) the total word count on page
c. The number of times the keyword is used in the page description
d. The number of times the keyword is used in the page title
e. The number of times the keyword is used and multiplied by hundred / (DIVIDED BY) the total word count on the page.

16. If a website’s search engine saturation with respect to a particular search engine is 20%, what does it mean?
Answers:
a. 20% of the webpages of the website have been indexed by the search engine
b. Only 20% of the pages of the website will be indexed by the search engine
c. 20% of the websites pages will never be indexed
d. The website ranks in the first 20% of all websites indexed by the search engine for its most important search terms

17. _________________ use both crawlers and directories to generate relevant results.

Answers:
a. Crawler-based Search Engines
b. Human-Powered Directories
c. Hybrid Search Engines
d. Meta Search Engines

18. What term is commonly used to describe the shuffling of positions in search engine results in between major updates?

Answers:
a. Waves
b. Flux
c. Shuffling
d. Swaying

19. Which of the following statements about FFA pages are true?

Answers:
a. They are greatly beneficial to SEO
b. They are also called link farms
c. They are paid listings
d. They contain numerous inbound links

20. Which of the following actions could get you banned by Google?

Answers:
a. Hiding text on the webpage
b. Stuffing keywords on the webpage
c. Linking to sites banned by Google
d. None of the above

21. Which of the following website design guidelines have been recommended by Google?

Answers:
a. Having a clear hierarchy and text links
b. Every page should be reachable from at least one static text link
c. If the site map is larger than 100 or so links, you should break the site map into separate pages
d. Keeping the links on a given page to a reasonable number (fewer than 100)
e. Use less than 30 images or graphics per page

22. While grading your website, Google gives credit to outbound links pointing to authority websites?

Answers:
a. True
b. False

23. Google looks down upon paid links for enhancing page rank. If a website sells links, what action/s does Google recommend to avoid being penalized?

Answers:
a. The text of the paid links should state the words “paid text link” for Google to identify it as a paid link
b. Only Paid text links to non profit websites should be accepted
c. Paid links should be disclosed through the “rel=nofollow” attribute in the hyperlink
d. Paid links should be disclosed through the “index=nofollow” attribute in the hyperlink

24. All major search engines are case sensitive.

Answers:
a. True
b. False

25. 10 people do a web search. In response, they see links to a variety of web pages. Three of the 10 people choose one particular link. That link then has a __________ click through rate.

Answers:
a. less than 30%
b. 30 percent
c. more than 30%

26. Which of the following is an ethical SEO Technique?

Answers:
a. Creating a subdomain with the hottest keyword and creating duplicate copies of existing pages on it
b. Filling your pages with keywords, whether relevant to the page content or not
c. Creating a page which serves a different content to the search engine bots and different to human users
d. None of the above

27. What will the following robots.txt file do?

User-agent:Googlebot
Disallow:/*?
User-agent:Scooter
Disallow:

Answers:
a. It will allow Google to crawl any of the dynamically generated pages. It will also allow the altavista scooter bot to access every page
b. It will disallow Google from crawling any of the dynamically generated pages. It will also disallow the altavista scooter bot from accessing any page
c. It will disallow Google from crawling any of the dynamically generated pages. It will allow the altavista scooter bot to access every page
d. None of the above

28. What is Anchor Text?

Answers:
a. It is the main body of text on a particular web page
b. It is the text within the left or top panel of a web page
c. It is the visible text that is hyper linked to another page
d. It is the most prominent text on the page that the search engines use to assign a title to the page

29. Why is it a bad idea from the seo perspective to host free articles and write ups that are very common on the internet.

Answers:
a. Because they will not lead to fresh traffic
b. Because you could get penalized by search engines for using duplicate content
c. Because you will not get the benefits of proper keyword targeting
d. Because people could turn up claiming copy right infringement

30. Cloaking is a controversial SEO technique. What does it involve?

Answers:
a. Increasing the keyword density on the web pages
b. Offering a different set of web pages to the search engines
c. Hiding the keywords within the webpage
d. Creating multiple pages and hiding them from the website visitors

31. Which of the following statements is correct with regard to the images within a webpage?

Answers:
a. Images cannot be spidered by the search engines
b. Important keywords related to the image should be placed in the ALT text
c. Images should always be kept close to the top of a webpage
d. Image maps should be used while including the images

32. Which of the following statement about RSS is correct?

Answers:
a. It is a form of XML
b. It stands for Realtime streamlined syndication
c. It is a good way of displaying static information
d. It is a Microsoft technology

33. What is the function of “indexer” part of the Google search engine?

Answers:
a. It helps to retrieve web pages from the world wide web
b. It helps to gather information from other search engines
c. It helps to sort the documents that Google has retrieved
d. It helps to generate meaningful results based upon the user’s search term

34. Which of the following free tools/websites could help you identify which city in the world has the largest search for the keyword – “six sigma”?

Answers:
a. Yahoo Search Term Suggestion Tool
b. Alexa
c. Google Traffic Estimator
d. Google Trends
e. WordTracker

35. Do search engines such as Google detect unnatural linking patterns by checking the Class C IP address of the page where the link to the website originates?

Answers:
a. Yes
b. No

36. What does the 302 server response code signify?

Answers:
a. It signifies conflict, too many people wanted the same file at the same time
b. The page has been permanently removed
c. The method you are using to access the file is not allowed
d. The page has temporarily moved
e. What you requested is just too big to process

37. While optimizing your website it is important to generate the right type of traffic, how does the Bounce Rate information help in this regard?

Answers:
a. By letting you know the percentage of users who entered the website and then went on to visit additional pages
b. By letting you know the percentage of users who entered the website and then left without viewing any other page
c. By letting you know the percentage of users who decided to go back to the source from where they found your website
d. By letting you know the percentage of users who left your website within 10 seconds of viewing the first page

38. Which of the following statements is correct with regard to natural links?

Answers:
a. They are two way links (reciprocal links)
b. They are from authority websites
c. They are voluntary in nature
d. They are from .edu or .gov extension websites

39. Which of the following facts about Alexa are correct?

Answers:
a. Alexa provides free data on relative website visitor traffic
b. Alexa and Quantcast provide information on visitor household incomes
c. Alexa is biased towards US based traffic
d. Quantcast only tracks people who have installed the Quantcast toolbar

40. Are RSS/Atom feeds returned in Google’s search results?

Answers:
a. Yes
b. No

41. How are site maps important for the search engine optimization process?

Answers:
a. Site maps help the search engine editorial staff to quickly go through a website, hence ensuring quicker placement
b. Google gives credit to the websites having site maps. The GoogleBot looks for the keyword or title “Site Map” on the home page of a website.
c. Site maps help the search engine spider pick up more pages from the website
d. None of the above

42. Implementing a 301 Permanent Redirects on the old pages to redirect to the new pages is a good idea from the SEO perspective.

Answers:
a. True
b. False

43. What is the name of the search engine technology due to which a query for the word ‘actor’ will also show search results for related words such as actress, acting or act?

Answers:
a. Spreading
b. Dilating
c. RSD (real time synonym detection)
d. Stemming
e. Branching

44. What is the illegal act of copying of a page by unauthorized parties in order to filter off traffic to another site called?

Answers:
a. Trafficjacking
b. Visitorjacking
c. Viewjacking
d. Pagejacking

45. Google gives priority to themed inbound links.

Answers:
a. True
b. False

46. What is the main reason for the effectiveness of optimizing a webpage towards a long tail keyword search?

Answers:
a. There are more long tail searches than shorter keyword queries
b. Search engines often pass on long tail searches to lesser known and new websites
c. Search engines do not pass on long tail search traffic to websites that rank high for shorter keyword searches
d. There are fewer websites that have targeted such keywords

47. Google displays up to _____ characters of a webpage’s Title Tag.

Answers:
a. 56
b. 60
c. 70
d. 80

48. What is the term for Optimization strategies that are in an unknown area of reputability/validity?

Answers:
a. Red hat techniques
b. Silver hat techniques
c. Grey hat techniques
d. Shady hat techniques

49. A Hallway Page is used to:

Answers:
a. Attract visitors from the search engines straight onto the Hallway Page
b. Organize the Doorway Pages
c. Help people navigate to different Doorway Pages
d. Enable search engine bots to index the Doorway Pages

50. Which of the following search engines or directories provides the directory search results for Yahoo?

Answers:
a. Windows Live
b. Yahoo Directory
c. Google
d. Wikipedia
e. DMOZ

51. _________ is usually the best web page to get linked to while receiving a themed in-bound link from another website.

Answers:
a. The sitemap
b. The contact page
c. The home page
d. The page which you would like to improve in the search engine rankings

52. The following robots meta tag directs the search engine bots:

Answers:
a. Not to index the homepage and not to follow the links in the page
b. Not to index the page and not to follow the links in the page
c. To index the page and not to follow the links in the page
d. Not to index the page but to follow the links in the page

53. If you enter ‘Help site:www.expertrating.com’ in the Google search box, what will Google search for?

Answers:
a. It will open up the Google help pages applicable to http://www.expertrating.com
b. It will find pages about help within http://www.expertrating.com
c. It will only find page titles about help within http://www.expertrating.com
d. It will direct you to the request page for re-indexing of http://www.expertrating.com

54. Which of the following activities could be looked down upon by Google as per their quality guidelines?

Answers:
a. Using automated website submission software
b. Loading pages with irrelevant links
c. Intentionally adding keywords to the TITLE tags and ALT attributes
d. Registering misspellings of well-known websites

55. Which search engine technology prevents a website from appearing in numerous top positions in the search engine result pages?

Answers:
a. Clustering
b. Normalizing
c. Sifting
d. Combing

56. If you search for the term “iq test” in the Word Tracker keyword suggestion tool, will it return the number of independent searches for the term “iq”?

Answers:
a. Yes
b. No

57. Which of the following factors does Google take into account while assessing whether or not a website is an authority website?

Answers:
a. The frequency with which the content of the website is updated
b. The number of web pages containing relevant information on the main theme of the website
c. The number of in-bound natural links related to the website’s theme (or keywords)
d. None of the above

58. State whether true or false.

The Yahoo Directory listing is a free service for commercial sites.

Answers:
a. True
b. False

59. State whether the following statement is true or false.

A Sitemap provides a list of internal links to user accessible pages on a website.

Answers:
a. True
b. False

60. Which of the following statements regarding website content are correct?

Answers:
a. If you have two versions of a document on your website, Google recommends that you only allow the indexing of the better version
b. Linking to a page inconsistently does not affect the way Google views the page/s. Examples of inconsistent linking could be http://www.expertrating.com/page/ and http://www.expertrating.com/page and http://www.expertrating.com/page/index.htm
c. Syndicating your content could lead to Google viewing the material as duplicate
d. Placeholders for pages which do not have content are never viewed as duplicate content by Google

61. Which of the following does Google uses to display characters of a web page’s Title Tag?

Answers:
a. Pixel Width
b. Title Tag Character count
c. None of the above

62.Which of the following statements is correct with regard to natural links?

Answers:
a. They are two way links (reciprocal links)
b. They are from authority websites
c. They are voluntary in nature
d. They are from edu or gov extension websites

63. The following robots meta tag directs the search engine bots

Answers:
a. Not to index the homepage and not to follow the links in the page
b. Not to index the page and not to follow the links in the page
c. To index the page and not to follow the links in the page
d. Not to index the page but to follow the links in the page

Latest CSS Test 2016 – Upwork Test Answers pass

Upwork CSS Test 2016 Video Link (Top 20%)

59 Answered Test Questions: Pass test with rajat marketing mania

1. Consider the following code snippet:

With these style rules:

Which of the following code snippets when inserted into CSS will change the A and B div’s color from red to blue?

Answers:
a. In style rule add this code “#sectors > div:not(.C):not(.D):not(.E) {background-color: blue;}”
b. In style rule add this code “#sectors > div:not(.C, .D, .E) {background-color: blue;}”
c. Both A and B
d. None of the above

2. Which of the following will create a triangle effect using pure CSS3 on a white background, without making use of background images?

Answers:
a. It is not possible to do so.
b. border-color: #a0c7ff #ffffff #ffffff #ffffff; border-style: solid; border-width: 20px; width: 0px; height: 0px;
c. background-color: #a0c7ff #ffffff #ffffff #ffffff; border-style: solid; border-width: 20px; width: 0px; height: 0px;
d. background-color: #a0c7ff #ffffff #ffffff #ffffff; border-style: solid; border-width: 1px; width: 10px; height: 10px;

3. Can a percentage value be given in a ruby-align property?

Answers:
a. Yes
b. No

4. Consider the following font definition:

font-weight:normal

What is the other way of getting the same result?

Answers:
a. font-weight:100
b. font-weight:900
c. font-weight:400
d. font-weight:700

5. Consider the following code:

div[class^=”stronger”] { }
{em

}

Which of the following statements is true?

Answers:
a. It applies the rule only on divs who belong to a class that begins with “stronger”.
b. It applies the rule only on divs of class “stronger”.
c. It applies the rule only on divs who belong to a class which end with “stronger”.
d. It applies the rule only on divs who belong to a class which does not contain “stronger” in its name.

6. For the clear property, which of the following values is not valid?

Answers:
a. none
b. left
c. right
d. top

7. What will be the output of the following code?

Lorem

Answers:
a. The text “Lorem” will be colored black-red.
b. The div element will be colored black-red.
c. The border of div element will be colored black-red.
d. None of these.

8. Which of the following is not a valid value for the font-smooth property?

Answers:
a. auto
b. never
c. always
d. normal
e. length

9. Which of the following option does not exist in media groups available in CSS3?

Answers:
a. continuous or paged
b. visual or tactile
c. grid or bitmap
d. braille or screen

10. Which of the following is not a valid page break?

Answers:
a. page-break-inside
b. page-break-outside
c. page-break-before
d. page-break-after
e. None of these

11. Which statement is correct given the following?
box-shadow:30px 20px 10px 5px black;

Answers:
a. The shadow will be spread out to 30px top, 20px right, 10px bottom, 5px left.
b. The position of the horizontal black shadow is 30px and the position of the vertical black shadow is 20px and blur distance is 10px and size of shadow is 5px.
c. The position of the vertical black shadow is 30px and the position of the horizontal black shadow is 20px and size of shadow is 10px and blur distance is 5px.
d. The shadow will be spread out to 30px top and bottom, 20px left and right with 10px blur distance, 5px shadow size.

12. The min-width property cannot be applied to the following element:

Answers:
a. button
b. span
c. table row

13. Given the following problem:

A drop shadow needs to appear only at the bottom, and no images should be used.
Consider the following code:

-moz-box-shadow: 0px 4px 4px #000;
-webkit-box-shadow: 0px 4px 4px #000;
box-shadow-bottom: 5px #000;

However, this produces shadows on the rest of the element.

Which of the following code snippets will correct the issue?

Answers:
a. border-bottom:5px solid #ffffff; -webkit-box-shadow: 0px 5px #000000; -moz-box-shadow: 0px 5px #000000; box-shadow: 0px 5px #000000;
b. -webkit-box-shadow: 0 4px 4px -2px #000000; -moz-box-shadow: 0 4px 4px -2px #000000; box-shadow: 0 4px 4px -2px #000000;
c. -webkit-box-shadow: 0 4px 4px -2px inside #000000; -moz-box-shadow: 0 4px 4px -2px inside #000000; box-shadow: 0 4px 4px -2px inside #000000;
d. None of these.

14. Consider the following code:

body { text-replace: “a” “b” “b” “c” }

What will be the output of the following string if the text-replace style is implemented?

andy lives behind cafe

Answers:
a. ndy lives behind cbfe
b. cndy lives cehind ccfe
c. andy lives behind cafe
d. andy lives cehind bafe

15. What is the default value of the transform-style property?

Answers:
a. preserve-3d
b. flat
c. none
d. preserve

16. What will be the output of the following code?

Lorem

Answers:
a. The text “Lorem” will be colored black-red.
b. The div element will be colored black-red.
c. The border of div element will be colored black-red.
d. None of these.

17. Which of the following styles is not valid for an image?

Answers:
a. img { float= left }
b. img { float: left here }
c. img { background: “black” }
d. img { border-width: 10 }
e. All of the above

18. Suppose that a
tag has 10tags. In this case which statement is correct given the following?
td:nth-child(3n+0){
background-color: orange;
}

Answers:
a. It returns a syntax error.
b. The background color of the fourth td will be orange.
a. The background color of the third td will be orange.
c. The background color of every third td will be orange.

19. What is the best method to select all elements except for the last one in an unordered list?

Answers:
a. Adding a class to each
b.element but last
c. Using li:not(:last-child) css selector
d. Using li:last-child selector
e. None of the above

20. Which of the following will apply a black inner glow with 25% opacity to a page element?

Answers:
a. box-shadow: 0 0 8px rgba(255,255,255, 0.25);
b. box-shadow: inset 0 0 8px rgba(0,0,0, 0.25);
c. box-shadow: 0 0 8px rgba(255,255,255, 25%);
d. box-shadow: inset 0 0 8px rgba(0,0,0, 25%);

21. Which of the following is the initial value for the column-fill property?

Answers:
a. auto
b. balance
c. none

22. Which of the following can be used to add a shadow around the div element below?

 

Lorem ipsum

Answers:
a. box-shadow: 0 0 8px 2px #888;
b. border-shadow: 0 0 8px 2px #888;
c. div-shadow: 8px 2px 0 0 #888;
d. None of these

23. Which of the following will decrease 50px from a DIV element whose width is 100%?

Answers:
a. width: calc(100% – 50px);
b. width: reduce(100% – 50px);
c. width: decrease(100% – 50px);
d. width: 100% – 50px;

24. Which of the following properties specifies the minimum number of lines of a paragraph that must be left at the bottom of a page?

Answers:
a. orphans
b. widows
c. bottom
d. overflow
e. None of these

25. What is the maximum value that can be given to the voice-volume property?

Answers:
a. 10
b. 100
c. 500
d. None of the above

26. What is the initial value of the font-size property?

Answers:
a. small
b. medium
c. large
d. default

27. Is there a way to create a pure CSS3 text color gradient?

Answers:
a. Yes, using the text-gradient property.
b. Yes, but only for headings.
c. There is no way to do a text color gradient with CSS3.
d. None of the above.

28. Consider the following code:

border-opacity:0.7;

Given a div element that needs to have a transparent red border, which of the following code samples will work in conjunction with the code above to accomplish the requirement?

Answers:
a. border: 1px solid rgba(255, 0, 0, 0.7);
b. border: 1px solid rgb(255, 0, 0, 0.7);
c. border: 1px solid rgba(255, 255, 0, 0.7);
d. border: 1px solid red; opacity: 0.7;

29. What is the initial value of the animation-iteration-count property?

Answers:
a. 1
b. 5
c. None

30. What is the default value of the animation-direction property?

Answers:
a. none
b. normal
c. alternate
d. inherited

31. Is it possible to combine a background image and CSS3 gradients?

Answers:
a. It is possible only when two separate styles are used, “background-image” and “gradient”, on an HTML tag.
b. It is possible only when “background-image” is used.
c. It is possible only when layered HTML tags are used, “background-image” and “gradient”.
d. It is not possible to combine a background image and CSS3 gradients.

32. What will happen if the cursor property value is set to none?

Answers:
a. The default cursor will be displayed.
b. No cursor will be displayed.
c. A pointer cursor will be displayed.
d. A text cursor will be displayed.

33. What will be the outcome of given code?
div[class^=”stronger”] { }
{

}

Answers:
a. It applies the rule only on divs who belong to a class that begins with “stronger”.
b. It applies the rule only on divs of class “stronger”.
c. It applies the rule only on divs who belong to a class which end with “stronger”.
d. It applies the rule only on divs who belong to a class which does not contain “stronger” in its name.

34. To apply style on every input element except text, which of the following selectors should be used?

Answers:
a. input:([!type=’text’])
b. input:not([type=”text”])
c. input:not([type!=”text”])
d. input:([type!=’text’])

35. For the clear property, which of the following value is not valid?

Answers:
a. none
b. left
c. right
d. top

36. Read the following:

@page rotated {size: landscape}
TABLE {page: rotated; page-break-before: right}

What will this code do?

Answers:
a. It will put all tables on a right-hand side landscape page.
b. It will rotate the page if the table is positioned at the right side.
c. It will keep the table in the landscape position and rotate the page.
d. None of the above

37. What is the initial value of the opacity property?

Answers:
a. 1
b. normal
c. none

38. State whether the following statement is true or false.

If a parent element display property is set to none, its children too will not be rendered.

Answers:
a. True
b. False

39. Which of the following filters does SVG support?

Answers:
a. SVG supports only CSS filters.
b. SVG supports CSS filters as well as ‘filter’ property of SVG
c. SVG supports only ‘filter’ property of SVG
d. SVG does not supports any filters

40. What will happen if the pause property is used as follows?

h2 { pause: 40s 60s }

Answers:
a. pause-before will be set to 40 seconds and pause-after will be set to 60 seconds.
b. pause-after will be set to 40 seconds and pause-before will be set to 60 seconds.
c. pause-after and pause-before will be set to 40 seconds.
d. pause-after and pause-before will be set to 60 seconds.

41. Which of the following properties allow percentages in their value fields?

Answers:
a. font-size
b. font-variant
c. font-weight
d. line-height

42. Which of the following is not a valid value for the font-stretch property?

Answers:
a. condensed
b. normal
a. semi-narrower
c. expanded
d. semi-expanded

43. Which of the following styles is valid?

Answers:
a. order: “none”;
b. order= “none”;
c. order: none;
d. order= none;
e. None of these.

44. Which one of the following is appropriate to mirror/flip text by using CSS3?

Answers:
a. .mirror_text{ -moz-transform: scaleX(-1); -o-transform: scaleX(-1); -webkit-transform: scaleX(-1); transform: scaleX(-1); filter: FlipH; -ms-filter: “FlipH”; }
b. .mirror_text{ Box-reflect; 20px right; }
c. .mirror_text{ Box-reflect; 20px left; }
d. .mirror_text{ -moz-transform: rotate(-180deg); -webkit-transform: rotate(-180deg); transform: rotate(-180deg); }

45. What is the initial value of the marquee-speed property?

Answers:
a. slow
b. normal
c. fast
d. none

46. Which of the following will apply a gradient transition to #DemoGradient using CSS3?

Answers:
a. @-webkit-keyframes pulse #DemoGradient { 0% { background: -webkit-gradient(linear, left top, left bottom, color-stop(0, rgb(196,222,242)), color-stop(0.5, rgb(242,242,242)), color-stop(1, rgb(240,240,240))); } 50% { background: -webkit-gradient(linear, left top, left bottom, color-stop(0, rgb(222,252,255)), color-stop(0.5, rgb(242,242,242)), color-stop(1, rgb(240,240,240))); } 100% { background: -webkit-gradient(linear, left top, left bottom, color-stop(0, rgb(196,222,242)), color-stop(0.5, rgb(242,242,242)), color-stop(1, rgb(240,240,240))); } }
b. #DemoGradient{ background: -webkit-linear-gradient(#C7D3DC,#5B798E); background: -moz-linear-gradient(#C7D3DC,#5B798E); background: -o-linear-gradient(#C7D3DC,#5B798E); background: linear-gradient(#C7D3DC,#5B798E); -webkit-transition: background 1s ease-out; -moz-transition: background 1s ease-out; -o-transition: background 1s ease-out; transition: background 1s ease-out; background-size:1px 200px; border-radius: 10px; border: 1px solid #839DB0; cursor:pointer; width: 150px; height: 100px; } #DemoGradient:Hover{ background-position:100px; }
c. It is not possible to apply a gradient transition using only CSS3.

47. Using height on transitions is not possible with:

Answers:
a. height:auto
b. height:100%
c. height:0
d. max-height:100%

48. Consider the following problem:
When trying to apply a CSS3 style to a label of a checked radio button like this:
….

….

A Label

This does not produce the desired effect.
Which of the following snippets will correct issue?

Answers:
a. It is not possible to style.
b. <label “rad”>A Label
c. input[type=”radio”]:checked+label{ font-weight: bold; }
d. input[type=”radio”]:checked@label{ font-weight: bold; }

49. There are various types of input fields in a HTML page. Choose the appropriate CSS3 code which will have an effect on all inputs, except checkbox and radio.

Answers:
a. form input:not([type=”radio”], [type=”checkbox”]) { }
b. input:not([type=”radio”]):not([type=”checkbox”]) { }
c. input:not([type=”radio & checkbox”]) { }
d. input:!([type=”radio”]) , input:!([type=”checkbox”]) { }

50. Is it possible to use transition animations with a gradient background?

Answers:
a. Yes
b. No

51. What is the difference between float:left; vs display:inline-block; ?

Answers:
a. There is no difference, both of them have the same results.
b. display:inline-block; adds whitespace between the elements.
c. float:left; collapses the parent element on itself.
d. None of these.

52. What is the range of values (in decimal notation) that can be specified in the RGB color model?

Answers:
a. 0 to 256
b. 0 to 255
c. -250 to 250
d. -255 to 255

53. Which of the following are not valid values for the target-new property?

Answers:
a. window
b. tab
c. none
d. parent
e. current

54. What will be the output of the following rule?

em { color: rgba(0,0,255,1) }

Answers:
a. Opacity 1 with solid red color
b. Opacity 0 with solid blue color
c. Opacity 0 with solid red color
d. Opacity 1 with solid blue color
e. None of these

55. While rendering the following code, what is the role of “src” propery?

@font-face {
font-family: “calibriforh1”;
src: local(“calibri”), url(calibri.woff);
}
h1 { font-family: “calibriforh1”, arial, sans-serif; }

Answers:
a. It’s for searching the user’s system for a “calibri” font, and if it does not exist, it will load the font from the server instead.
b. It’s for searching the user’s system for a “calibri” font, and if it does not exist, it will load user’s system’s default font instead.
c. It’s for loading the user’s system’s default font.
d. None of these.

56. Which of the following statements is true with regard to CSS3 transitions?

Answers:
a. Using CSS transitions will slow down page upload and produce lag.
b. The completion of a CSS transition generates a corresponding DOM event. An event is fired for each property that undergoes a transition. This allows a content developer to perform actions that synchronize with the completion of a transition.
c. CSS transitions allow DOM events in CSS values to occur smoothly over a specified duration.
d. None of these.

57. Given that one div element needs to be hidden and on active state needs to be displayed, what will be the output of the following code?

div {
display: none;
-webkit-transition: opacity 1s ease-out;
opacity: 0;
}

div.active {
opacity: 1;
display: block;
}

Answers:
a. On active state the element is displayed.
b. On active state the element’s opacity is changed to 1.
c. On active state the element’s opacity is changed to 0.
d. Nothing will be shown.

58. Which of the given options is/are equivalent to the following rule?

DIV { line-height: 1.2; font-size: 10pt }

Answers:
a. DIV { line-height: 1.2em; font-size: 10pt }
b. DIV { line-height: 12em; font-size: 10pt }
c. DIV { line-height: 120%; font-size: 10pt }
d. DIV { line-height: 20%; font-size: 10pt }
e. DIV { line-height: 80%; font-size: 10pt }

59. What will happen if the following style declaration is applied to an element?

p { margin: 3em 2em }

Answers:
a. The top and the bottom margins will be 3em and the left and the right margins will be 2em.
b. The top and the bottom margins will be 2em and the left and the right margins will be 3em.
c. The top and the left margins will be 3em and the bottom and the right margins will be 2em.
d. The top and the right margins will be 2em and the bottom and the left margins will be 3em.

60. Problem to solve:
Need to use attribute selector in css to change link on different color and image.
The following code is not working correctly:

…..
A PDF File

Which of the following code snippets will correct issue?

Answers:
a. a[href$=’.pdf’] { /*css*/ }
b. a[href#=’.pdf’] { /*css*/ }
c. a[href@=’.pdf’] { /*css*/ }
d. a{href$=’.pdf’} [/*css*/ ]

61.
Suppose there are 16

elements and a style needs to applied only on every 4th element. Which of the following is correct?

Answers:
a. div:nth-child(4), div:nth-child(8), div:nth-child(12), div:nth-child(16) { }
b. div:nth-child(4n) { }
c. div:nth-child(4n+4) { }
d. div:nth-child(3n+4)

62. To make childdiv vertically center of given code, what should the “display” property of parentdiv and childdiv be?

#parentdiv
{
width: 200px;
height: 400px;
vertical-align: middle;
}

#childdiv
{
width: 100px;
height: 50px;
}

Vertical Center

Answers:
a. display:table-cell; for parentdiv and display:inline-block; for childdiv
b. display:block; for parentdiv and display:inline-block; for childdiv
c. display:inline-block; for parentdiv and display:table-cell; for childdiv
d. display:inline-block; for parentdiv and display:inline-block; for childdiv

63.
Which of the following can be used to add a shadow around the div element below?

Lorem ipsum

Answers:
a. box-shadow: 0 0 8px 2px #888;
b. border-shadow: 0 0 8px 2px #888;
c. div-shadow: 8px 2px 0 0 #888;
d. None of these

64. Is it possible to format numbers with CSS?

Answers:
a. No, CSS cannot be used for that purpose.
b. Yes, it can be done using the number-format property.
c. Yes, it can be done using the decimal property.
d. None of these.

65. What is true about the background-clip property?

Answers:
a. The background-clip property specifies the painting area of the background.
b. The background-clip property is not supported in Internet Explorer 8 and earlier versions.
c. The background-clip property is supported in Internet Explorer 9+, Firefox, Opera, Chrome, and Safari.
d. All are correct.

Upwork WordPress Test Answer 2017 very latest Questions

Upwork WordPress Test 2017

latest 150 Answered Test Questions:

1. Which of the following will hash a string/password to its md5 equivalent?

Answers:
a. md5()
b. wp_generate_password()
c. wp_generate_md5()
d. password_md5()

2. Which conditional tag checks if the dashboard or the administration panel is attempting to be displayed by returning “true’ (if the URL being accessed is in the admin section) or “false” (for a front-end page).

Answers:
a. my_admin()
b. view_admin()
c. is_admin()
d. root_admin()

3. Which of the following functions are used to add administration menu item in WordPress ?

Answers:
a. add_menu_page();
b. add_admin_item();
c. add_admin_page();
d. add_admin_option();

4. Which of the following WordPress Multisite functions allows for getting content from one blog and display it on another?

Answers:
a. switch_blog()
b. switch_to_blog()
c. restore_current_blog()
d. restore_to_current_blog()

5. What is the BEST way to get last inserted row ID from WordPress database ?

Answers:
a. Use the following code snippet $lastid->$wpdb=$last->get_row;
b. The call to mysql_insert_id() inside a transaction should be added: mysql_query(‘BEGIN’); // Whatever code that does the insert here. $id = mysql_insert_id(); mysql_query(‘COMMIT’); // Stuff with $id.
c. The following code snippet should be added $last = $wpdb->get_row(“SHOW TABLE STATUS LIKE ‘table_name’”); $lastid = $last->Auto_increment;
d. Straight after the $wpdb->insert() insert, the following code should be added: $lastid = $wpdb->insert_id;

6. Which of the follow is a WordPress alternatives for Ruby on Rails?

Answers:
a. Refinery
b. Typof
c. Symenta
d. Rubyalt

7. Which of the following code snippets can be used to create custom POST status in wordpress 3.0 +?

Answers:
a. register_new_post()
b. register_post_status()
c. add_new_post_status()
d. modify_post_status()

8. How can the upload media panel be included in a WordPress template/plugin?

Answers:
a. By using function wp_enqueue_script(‘media-upload’)
b. By using function wp_add_media( );
c. By using function wp_enqueue_script(‘upload’);
d. By using function wp_add_script(‘media-upload’);

9. What are the database privileges that are required for WordPress?

Answers:
a. insert, delete, update, drop and alter
b. select, insert, delete, update, create, drop and alter
c. insert, delete, update, create, drop and alter
d. insert and delete

10. Which of the following is an example of a WordPress plugin that provides multilingual capabilities?

Answers:
a. WP Super Cache
b. qTranslate
c. BuddyPress
d. Hotfix

11. Which of the following functions can be used to create a WordPress page?

Answers:
a. wp_insert_post()
b. wp_insert_page()
c. wp_create_post()
d. wp_create_page()

12. Which function is used to display the name of current page in wordpress?

Answers:
a. get_the_title()
b. content_title()
c. page_name()
d. post_name()

13. Which of the following methods can be used to make permalinks SEO friendly?

Answers:
a. Updating the database.
b. Changing the source code.
c. Configuring the feature in the config file.
d. Configuring the feature in the admin settings.

14. User Level 7 converts to _________?

Answers:
a. Contributo
b. Autho
c. Edito
d. Subscribe
e. Administrato

15. Which of the following is the correct way to add custom excerpts length identifiers in WordPress?

Answers:
a. By adding excerpt_length filter in function.php
b. Can’t declare custom excerpts in wordpress
c. Custom exceprts are already available in wordpress
d. Using the_excerpt(‘long’); or the_excerpt(‘short’)

16. Which of the following is the correct sequence of steps to adapt a WordPress plugin to a multisite?

Answers:
a. 1. Use $wpdb to iterate through all blogs 2. Hook according to the $blog_id 3. Install the plugin as Network only 4. Uninstall depends the specific plugin
b. 1. Use $wp_posts to iterate through all blogs 2. Hook according to the $function 3. IInstall the plugin as Network only 4. Uninstall depends the specific plugin
c. 1. Use $wp_posts to iterate through all blogs 2. Hook according to the $function 3. Install other activations except Network 4. Uninstall is the same for all the plugins
d. 1. Use $wp_posts to iterate through all blogs 2. Hook according to the $function 3. Install the plugin as Network only 4. Uninstall is same for all the plugins

17. On which of the following databases can WordPress be installed by default?

Answers:
a. MySQL
b. Oracle Database
c. Microsoft SQL Server
d. PostgreSQL

18. Which of the following actions must be performed to import data from wordpress.com?

Answers:
a. Enter the full access to wordpress.com into the data import form so that it can automatically connect and directly retrieve content.
b. Import from wordpress.com’s RSS.
c. Login to wordpress.com, then the export data using the export tool, then import an exported xml file to the site.

19. Meta tags can be added to WordPress pages by ________________.

Answers:
a. using plug-ins
b. adding them to the header.php file
c. updating the database
d. a and
e. and c

20. Which of the following codes will return the current plugin directory in WordPress?

Answers:
a.
b.
c.
d.

21. WordPress’s requirements are modest. At minimum, which of the following standards should your server support for WordPress 3.1?

Answers:
a. PHP version 4.4.9 or greater, MySQL version 4.0 or greater
b. PHP version 4.3 or greater, MySQL version 4.1.2 or greater
c. PHP version 4.4.9 or greater, MySQL version 5.1 or greater
d. PHP version 4.3 or greater, MySQL version 5.1 or greater

22. Which of the following will give the option to add inline Ajax for comment posting?

Answers:
a. Enabling Ajax in the wp-config.php file
b. Activating Ajax from the admin settings of WordPress
c. Using the Ajax Comment Posting plugin
d. WordPress doesn’t support inline Ajax.

23. What is the limitation to the depth of your categories?

Answers:
a. 10 levels
b. 20 levels
c. No limit levels

24. Can the contents of the wp-content folder be moved or renamed without changing any settings?

Answers:
a. Yes
b. No

25. Which of the following code snippets best protects a system from SQL injections?

Answers:
a. sql_real_escape_strong()
b. mysql_real_escape()
c. mysql_real_escape_string()
d. mysql_not_real_delete_string()

26. Which of the following role levels has the highest privilege?

Answers:
a. Level_0
b. Level_10
c. Depends on your settings.
d. Every role level has the same privilege.

27. How can the Home link be disable from the WordPress top nav?

Answers:
a. Using Jquery to hide it
b. By adding this code in functions.php function page_menu_args( $args ) { $args[‘show_home’] = FALSE; return $args; } add_filter( ‘wp_page_menu_args’, ‘page_menu_args’ );
c. wp_nav_menu( array(‘menu’ => ‘news’, ‘show_home’ => false))
d. Can not disable the default Home link from wordpress top nav

28. Which of the following is the correct way to retrieve a featured image from a post?

Answers:
a.
b.
c.
d.

29. Which of the following will correctly load localized (translated) text for a WordPress plugin?

Answers:
a. function custom_theme_setup() { $lang_dir = get_template_directory() . ‘/lang’); load_theme_textdomain(‘tutsplus’, $lang_dir); } add_action(‘after_setup_theme’, ‘custom_theme_setup’);
b. function custom_theme_setup() { $lang_dir = get_template_directory() . ‘/lang’); add_action(‘after_setup_theme’, ‘custom_theme_setup’); }
c. function custom_theme_setup() { $lang_dir = get_template_directory() . ‘/lang’); add_action(‘after_setup_theme’, ‘custom_theme_setup’); } load_theme_textdomain(‘tutsplus’, $lang_dir);
d. function load_theme_textdomain(‘tutsplus’, $lang_dir); { $lang_dir = get_template_directory() . ‘/lang’); custom_theme_setup(); } add_action(‘after_setup_theme’, ‘custom_theme_setup’);

30. Image size limits can be set _______________.

Answers:
a. directly in the posts
b. in the wp-imageresize plug-in
c. in the admin settings
d. a and

31. How can a user be found through its meta data?

Answers:
a. User can not be retrieved through its meta data
b. get_user_by_metadata($metaid,$metavalue)
c. get_user($args)
d. get_users($args)

32. Which PHP method(s) can be used to send form data that is persistent across succeeding page views (such as for a language selection feature) in WordPress?

Answers:
a. POST
b. GET
c. SESSION or COOKIE
d. POST or GET

33. Which of the following will call the WordPress media uploader form element?

Answers:
a.

/wp-admin/media-upload.php?inline=&upload-page-form=” class=”media-upload-form type-form validate” id=”file-form”>
b. Upload Image
c. Upload Image
d.

/wp-admin/media-upload.php?inline=&upload-page-form=” class=”media-upload-form type-form validate” id=”file-form”>34. Which of the following is the correct way to print the slug property of $firstTag object in this code snippet?

$tags = wp_get_post_tags($post->ID);
$firstTag = $tags[0];

Answers:
a. $firstTag[‘slug’];
b. $firstTag->slug
c. $firstTag.slug
d. $firstTag[0][‘slug’]

35. Which of the following code snippets is the correct way to get content from Tinymce via javascript ?

Answers:
a. document.getElementById(‘content’)
b. tinymce.activeEditor.getContent();
c. tinymce.element.getContent();
d. document.getElement(‘tinymce_content’)

36. Is super cache a built-in plugin of WordPress?

Answers:
a. Yes
b. No

37. A possible way to allow the display of several authors’ names on one post is to ______

Answers:
a. update the database
b. change the admin settings
c. change the config files
d. use a plug-in

38. In which way MD5 hash does wordpress stores and represents?

Answers:
a. In Hex string
b. In Base64 string
c. in raw data file
d. text file

39. What is the first action you need to take for enabling WordPress MU feature?

Answers:
a. Enable WordPress MU feature on admin panel
b. Enable Network feature
c. Add this code to wp-config.php file: define( ‘WP_ALLOW_MULTISITE’, true );

40. What is Automated Testing in WordPress?

Answers:
a. Automated testing is running test cases where manual intervention is not required to run each one.
b. It is a plugin which is used to test your custom template or plugin.
c. It is a function available in WordPress to test the custom template/plugin.
d. There is no such thing as Automated Testing in WordPress.

41. You can limit the number of revisions WordPress stores by _____

Note: Categories must have distinct slugs. Even if two categories have different parents and would therefore have different permalinks, you can’t assign them the same slug.

Answers:
a. adding the following line to your wp-config.php file: define(‘WP_POST_REVISIONS’, 3);
b. using a plugin
c. changing a setting on admin panel

42. Which of the following snippets disable depreciated warnings in WordPress like this one ?

“Deprecated: Assigning the return value of new by reference is deprecated in /home//public_html/hub/wp-settings.php on line 647”

Answers:
a. define(E_DEPRECATED, false);
b. error_reporting(E_ALL ^ E_DEPRECATED);
c. define(E_NOTICE, false);
d. error_reporting(WP_DEBUG, true)

43. One possible way to collect realtime statistics about traffic on a WordPress site is:

Answers:
a. using a built-in tool
b. using a plugin
c. using a widget
d. Traffic statistics cannot be collected on a WordPress site.

44. _____________ can publish, edit, and delete their own posts. They cannot write pages. They can upload some kinds of media files, and they are allowed to use only the limited set of HTML tags.

Answers:
a. Contributo
b. Autho
c. Edito
d. Subscribe
e. Administrato

45. How can an

  • tag’s class and ID attributes be removed from menu items and page lists?Answers:
    a. add_filter(‘nav_menu_css_class’, ‘my_css_attributes_filter’, 100, 1); add_filter(‘nav_menu_item_id’, ‘my_css_attributes_filter’, 100, 1); add_filter(‘page_css_class’, ‘my_css_attributes_filter’, 100, 1); function my_css_attributes_filter($var) { return is_array($var) ? array() : ”; }b. add_filter(‘nav_menu_css_class’, ‘my_css_attributes_filter’, 100, add_filter(‘nav_menu_item_id’, ‘my_css_attributes_filter’, 100, 1); function my_css_attributes_filter($var) { if(is_array($var)){ $varci= array_intersect($var, array(‘current-menu-item’)); $cmeni = array(‘current-menu-item’); $selava = array(‘selectedmenu’); $selavaend = array(); $selavaend = str_replace($cmeni, $selava, $varci); } else{ $selavaend= ”; } return $selavaend; }b. add_filter (‘wp_nav_menu’,’strip_empty_classes’); function strip_empty_classes($menu) { $menu = preg_replace(‘/ class=([“\’])(?!active).*?\1/’,”,$menu); return $menu; }

    c. None of the above

    46. ____________ can publish, edit, and delete posts and pages written by any user. They can upload some kinds of files, and they can write HTML without restrictions. They can manage links and categories, and they can moderate comments. Editors and administrators are also the only users allowed to read private posts and pages.

    Answers:
    a. Contributor
    b. Author
    c. Editor
    d. Subscriber
    e. Administrator

    47. Which of the following will show the most recent post (by date) from a custom taxonomy?

    Answers:
    a. select * from wp_posts where ID in( select ID from ( select wp_posts.ID , wp_posts.post_date, d.name from wp_posts as a join wp_term_relationships as b on ( a.ID = b.object_id) join wp_term_taxonomy as c on (b.term_taxonomy_id = c.term_taxonomy_id) join wp_terms as d on (c.term_id = d.term_id) where c.taxonomy = ‘post-series’ group by d.name having (wp_posts.post_date = max(wp_posts.post_date)) )tmp)

    b. select * from wp_posts where ID in( select ID from ( select wp_posts.ID , wp_posts.post_date, d.name from wp_posts as a join wp_terms as d on (c.term_id = d.term_id) where c.taxonomy = ‘post-series’ group by d.name having (wp_posts.post_date = max(wp_posts.post_date)) )tmp)

    c. select * from wp_posts where ID in( select ID from ( select wp_posts.ID , wp_posts.post_date, d.name from wp_posts as a join wp_term_relationships as b on ( a.ID = b.object_id) join wp_term_taxonomy as c on (b.term_taxonomy_id =

    d.term_taxonomy_id) join wp_terms as d on (c.term_id = d.term_id) having (wp_posts.post_date = max(wp_posts.post_date)) )tmp)

    f. select * from wp_posts where ID in( select ID from ( select wp_posts.ID , wp_posts.post_date, d.name from wp_posts as a join wp_term_relationships as b on ( a.ID = b.object_id) join wp_terms as d on (c.term_id = d.term_id) where c.taxonomy = ‘post-series’ group by d.name having (wp_posts.post_date = max(wp_posts.post_date)) )tmp)

    48. What are the correct steps in wordpress plugin development:

    Answers:
    a. Step 1 – Create your file and let it be known as a plugin Step 2 – Create the objects of your plugin Step 3 – Adding your actions and filters Step 4 – Adding settings/options to your plugin Step 5 – Finishing the code
    b. Step 1 – Adding settings/options to your plugin Step 2 – Create your file and let it be known as a plugin Step 3 – Create the objects of your plugin Step 4 – Adding your actions and filters Step 5 – Finishing the code
    c. Step 1 – Create the objects of your plugin Step 2 – Adding settings/options to your plugin Step 3 – Create your file and let it be known as a plugin Step 4 – Finishing the code
    d. Step 1 – Create the objects of your plugin Step 2 – Adding settings/options to your plugin Step 3 – Finishing the code

    49. What is the output of the following code?

a. example 1
b. example 2
c. example 3
d. example 4

$(document).ready(function(){
$(‘#sortable’).sortable({
update: function(event, ui) {
var newOrder = $(this).sortable(‘toArray’).toString();
$.get(‘saveSortable.php’, {order:newOrder});
}
});
});

Answers:
a. Removes positions from data base based on the user input
b. Saves sortable positions to data base based on the user input
c. Adding new sortable positions from another data base
d. Sorting out existing positions without updating the data base with the new user inputs

50. Which of the following is the correct way to assign a category to a WordPress post?

Answers:
a. wp_set_post_categories($postId,$categories)
b. wp_set_category($catId,$postId)
c. By XML-RPC call to wpc.newPost
d. This is not possible

51. Conditional tags can be used to _______________________.

Answers:
a. get all comments from one post
b. get all posts from one category
c. change the content to be displayed
d. None of the above: conditional tags are not available in WordPress.

52. Which of the following commands can change the ownership of WordPress directory to www-data (for Apache)?

Answers:
a. sudo chown -Rf www-data *
b. chown -Rf www-data *
c. sudo crown -Df www-data *
d. Alldo chown -Rf www-data *

53. How can a custom content filter be added?

Answers:
a. By using add_action(‘the_content’,’my_custom_filter’)
b. By using add_filter(‘the_content’,’my_custom_filter’)
c. By using wp_filter(‘the_content’,’my_custom_filter’)
d. By using add_action(‘content’,’my_custom_filter’)

54. How can a post ID be retrieved from the permalink?

Answers:
a. Its not possible to retrieve the post ID from a permalink due to its structure.
b. It can be retrieved by using a Regular Expression.
c. wp_get_post_id($permalink)
d. url_to_postid($permalink)

55. Which of the following is the correct way to redirect the default login and registration page URL to a custom login and registration page URL?

Answers:
a. add_action(‘init’,’possibly_redirect’); function possibly_redirect(){ global $pagenow; if( ‘wp-login.php’ == $pagenow ) { return(‘Your custom url’); exit(); } }
b. add_action(‘init’,’possibly_redirect’); function possibly_redirect(){ global $pagenow; if( ‘wp-login.php’ == $pagenow ) { wp_redirect(‘Your custom url’); exit(); } }
c. add_action(‘init’,’possibly_redirect’); function possibly_redirect(){ global $pagenow; if( ‘wp-login.php’ == $pagenow ) { redirect(‘Your custom url’); exit(); } }
d. add_action(‘init’,’possibly_redirect’); function possibly_redirect(){ global $pagenow; if( ‘wp-login.php’ == $pagenow ) { wp_return(‘Your custom url’); exit(); } }

56. How can a WordPress template be integrated inside a codeigniter framework using WordPress functions like wp_header,wp_footer,wp_sidebar?

Answers:
a. Include the file wp-blog-header.php from WordPress installation directory to codeigniters index.php and create template inside codeigniter’s view.
b. Include the file wp-settings.php from WordPress installation directory to codeigniters index.php and create template inside codeigniter’s view.
c. Create template inside WordPress theme directory and include the file in codeigniter’s view.php file.
d. It is not possible to integrate wordpress with codeigniter.

57. What is the first action you need to take for enabling the WordPress multisite (MS) feature?

Answers:
a. Enable the WordPress multisite feature on admin panel
b. Enable the Network feature
c. Add this code to wp-config.php file: define( ‘WP_ALLOW_MULTISITE’, true );

58. Which of the functions below is required to create a new taxonomy?
Answers:
a. add_taxonomy
b. register_taxonomy
c. create_taxonomy

59. Which of the following actions cannot be hooked in with add_submenu_page() function?

Answers:
a. admin_submenu
b. admin_menu
c. user_admin_menu
d. network_admin_menu

60. Which of the following is the correct way to filter the content for a few posts?

Answers:
a. By using apply_filters(filter,postId)
b. This is not possible in wordpress
c. Can create filter for posts in a specific wordpress category
d. Passing arguments into the_content()

61. What is the function of add_filter in WordPress?

Answers:
a. It registers a filter for a tag.
b. It removes line breaks from the pages list.
c. It is a companion function to apply_filters().
d. All of the above.

62. Which of the following code snippets will create plugins back-end page without showing it as menu item?

Answers:
a. add_submenu_page with parent slug = null
b. add_menu_page with parent slug = null
c. add_submenu_page without parent slug = null
d. add_menu_page without parent slug = null

63. ____________ can manage their own profiles, but can do virtually nothing else in the administration area.

Answers:
a. Contributor
b. Author
c. Editor
d. Subscriber
e. Administrator

64. Are categories and tags available for pages?

Note: Categories must have distinct slugs. Even if two categories have different parents and would therefore have different permalinks, you can’t assign them the same slug.

Answers:
a. Yes
b. No

65. Which of the following is the correct way to get WordPress Post ID from the Post title?

Answers:
a. $page = get_page_title( ‘About’ ); wp_pages( ‘exclude=’ . $page->ID );
b. $page = get_page_by_title( ‘Home’ ); $page_id = $page->ID;
c. $page = get_page_by_title( ‘About’ ); wp_pages( ‘exclude=’ . $page->ID );
d. None of the above

66. Which of the following will correctly add custom mod rewrite rules to .htaccess from a WordPress plugin?

Answers:
a. $custom_mod_rewrite = new custom_mod_rewrite; register_activation_hook( __FILE__, array($custom_mod_rewrite, ‘flush_rewrite_rules’)); register_deactivation_hook( __FILE__, array($custom_mod_rewrite, ‘flush_rewrite_rules’)); add_action(‘generate_rewrite_rules’, array($custom_mod_rewrite, “generate_rewrite_rules”)); class custom_mod_rewrite { function __construct() { $this->wp_rewrite = & $POST[“wp_rewrite”]; }}

b. $custom_mod_rewrite = new custom_mod_rewrite; register_activation_hook( __FILE__, array($custom_mod_rewrite, ‘flush_rewrite_rules’)); register_deactivation_hook( __FILE__, array($custom_mod_rewrite, ‘flush_rewrite_rules’)); add_action(‘generate_rewrite_rules’, array($custom_mod_rewrite, “generate_rewrite_rules”)); class custom_mod_rewrite { function __construct() { $this->wp_rewrite = & $GLOBALS[“wp_rewrite”]; } }

c. $custom_mod_rewrite = new custom_mod_rewrite; register_activation_hook( __FILE__, array($custom_mod_rewrite, ‘flush_rewrite_rules’)); register_deactivation_hook( __FILE__, array($custom_mod_rewrite, ‘flush_rewrite_rules’)); add_action(‘generate_rewrite_rules’, array($custom_mod_rewrite, “generate_rewrite_rules”)); class custom_mod_rewrite { function __construct() { $this->wp_rewrite = & $GLOBALS[“wp_rewrite”]; } function mod_rewrite_rules($rules) { return preg_replace(‘#^(RewriteRule \^.*/)\?\$plugin_name .*(http://.*) \[QSA,L\]#mi’, ‘$1 $2 [R=301,L]’, $rules); } }

d. $custom_mod_rewrite = new custom_mod_rewrite; register_activation_hook( __FILE__, array($custom_mod_rewrite, ‘flush_rewrite_rules’)); register_deactivation_hook( __FILE__, array($custom_mod_rewrite, ‘flush_rewrite_rules’)); add_action(‘generate_rewrite_rules’, array($custom_mod_rewrite, “generate_rewrite_rules”)); class custom_mod_rewrite { function __construct() { $this->wp_rewrite = & $SESSION[“wp_rewrite”]; } }

67. Which of the following is the correct code to get an array of every image uploaded to a particular post?

Answers:
a. $images =& get_children( ‘post_type=attachment&post_mime_type=image&post_parent=10’ );
b. $images = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
c. $images = get_post(7, ARRAY_A);
d. It cannot be done

68. Which of the following will echo the base URL of a WordPress site?

Answers:
a.
b.
c.
d.

69. Which of the following functions are used when adding CSS and jQuery codes on a WordPress plugin?

Answers:
a. wp_register_style
b. wp_enqueue_style
c. wp_enqueue_script
d. None of these.

70. In order to display a widget, the user must _________________.

Answers:
a. set the “show property” of the desired widget to “true”
b. drag the desired widget to the side ba
c. add the desired widget to the post
d. change the source code

71. How can the class name of a sub-menu be changed in the wp_nav_menu?

Answers:
a. By manually adding the class name in Appearance–>Menus
b. WordPress does not support the ability to change the class name of a sub-menu in the wp_nav_menu.
c. By adding the following code in functions.php: class UL_Class_Walker extends Walker_Nav_Menu { function start_lvl(&$output, $depth) { $indent = str_repeat(“\t”, $depth); $output .= “\n$indent

      \n”; } }

 

      d. By adding the following code in header.php: class UL_Class_Walker etends Walker_Nav_Menu { function start_lvl(&$output, $depth) { $indent = str_repeat(“\t”, $depth); $output .= “\n$indent

 

        \n”; } }

 

        72. Which of the following is a Online Code Coloring Service?

 

        Answers:

 

        a. Prettify

 

        a. SyntaxHighligherText

 

        a. Edit Pad

 

        a. Collabedit

 

        73. What is the name of theme file for a page with slug ‘about’?

 

        Answers:

 

        a. page-slug-about.php

 

        a. page-about.php

 

        a. about.php

 

        74. Which of the following is the correct way to add a simple WordPress gallery in an external PHP file?

 

        Answers:

 

        a. add_filter(‘the_content’, ‘do_shortcode
        ‘, 11);

 

        a. echo do_shortcode(‘
        ‘);

 

        a. add_filter(‘widget_text’, ‘do_shortcode
        ‘);

 

        a. This can’t be done.

 

        75. Who of the following persons can read a post locked by password?

 

        Answers:

 

        a. Only administrators, editors and authors

 

        a. Registered users who knows password

 

        a. Anyone who knows a password

 

 

        Answers:

 

        a. Stock Format

 

        a. Stock Variable

 

        a. Stock Symbol

 

        a. Stock Supplier

 

        77. Which of the following is a quick way to move a WordPress website from one server to another?

 

        Answers:

 

        a. Using migration plugin

 

        a. Copying wordpress files and database from source to destination server

 

        a. Using XML export through wp-admin interface

 

        a. Install new wordpress and copy theme and plugin directory

 

      78. Which of the following will remove anchors from all nodes/levels except the 4th level nodes of a WordPress category?

Parent node (1st level)
–>Child node (2nd level)
—->3rd level node
——>4th level node
Answers:
a. .cat-item a, .cat-item .cat-item a.hover {cursor: default;} .cat-item .cat-item a.hover {cursor: pointer;}
a. .cat-item a, .cat-item .cat-item a {cursor: default;} .cat-item .cat-item a {cursor: pointer;}
a. .cat-item a, .cat-item .cat-item .cat-item .cat-item a {cursor: default;} .cat-item .cat-item .cat-item a {cursor: pointer;}
a. .cat-item a, .cat-item .cat-item a:hover {cursor: pointer;} .cat-item .cat-item a:hover {cursor: default;}

New question answer on Upwork WordPress test qualify

1. You can limit the number of revisions WordPress stores by _____Note: Categories must have distinct slugs. Even if two categories have different parents and would therefore have different permalinks, you can’t assign them the same slug.

Answers:

  1. adding the following line to your wp-config.php file: define(‘WP_POST_REVISIONS’, 3);
  2. using a plugin
  3. changing a setting on admin panel

2. Which of the following will hash a string/password to its md5 equivalent?

Answers:

  1. md5()
  2. wp_generate_password()
  3. wp_generate_md5()
  4. password_md5()

3. Which conditional tag checks if the dashboard or the administration panel is attempting to be displayed by returning “true’ (if the URL being accessed is in the admin section) or “false” (for a front-end page).

Answers:

  1. my_admin()
  2. view_admin()
  3. is_admin()
  4. root_admin()

4. Which of the following functions are used to add administration menu item in WordPress ?

Answers:

  1. add_menu_page();
  2. add_admin_item();
  3. add_admin_page();
  4. add_admin_option();

5. Which of the following WordPress Multisite functions allows for getting content from one blog and display it on another?

Answers:

  1. switch_blog()
  2. switch_to_blog()
  3. restore_current_blog()
  4. restore_to_current_blog()

6. What is the BEST way to get last inserted row ID from WordPress database ?

Answers:

  1. Use the following code snippet $lastid->$wpdb=$last->get_row;
  2. The call to mysql_insert_id() inside a transaction should be added: mysql_query(‘BEGIN’); // Whatever code that does the insert here. $id = mysql_insert_id(); mysql_query(‘COMMIT’); // Stuff with $id.
  3. The following code snippet should be added $last = $wpdb->get_row(“SHOW TABLE STATUS LIKE ‘table_name’”); $lastid = $last->Auto_increment;
  4. Straight after the $wpdb->insert() insert, the following code should be added: $lastid = $wpdb->insert_id;

7. Which of the follow is a WordPress alternatives for Ruby on Rails?

Answers:

  1. Refinery
  2. Typof
  3. Symenta
  4. Rubyalt

8. Which of the following code snippets can be used to create custom POST status in wordpress 3.0 +?

Answers:

  1. register_new_post()
  2. register_post_status()
  3. add_new_post_status()
  4. modify_post_status()

9. How can the upload media panel be included in a WordPress template/plugin?

Answers:

  1. By using function wp_enqueue_script(‘media-upload’)
  2. By using function wp_add_media( );
  3. By using function wp_enqueue_script(‘upload’);
  4. By using function wp_add_script(‘media-upload’);

10. What are the database privileges that are required for WordPress?
Answers:

  1. insert, delete, update, drop and alter
  2. select, insert, delete, update, create, drop and alter
  3. insert, delete, update, create, drop and alter
  4. insert and delete

11. Which of the following is an example of a WordPress plugin that provides multilingual capabilities?

Answers:

  1. WP Super Cache
  2. qTranslate
  3. BuddyPress
  4. Hotfix

12. Which of the following functions can be used to create a WordPress page?

Answers:

  1. wp_insert_post()
  2. wp_insert_page()
  3. wp_create_post()
  4. wp_create_page()

13. Which function is used to display the name of current page in wordpress?
Answers:

  1. get_the_title()
  2. content_title()
  3. page_name()
  4. post_name()

14. Which of the following methods can be used to make permalinks SEO friendly?

Answers:

  1. Updating the database.
  2. Changing the source code.
  3. Configuring the feature in the config file.
  4. Configuring the feature in the admin settings.

15. User Level 7 converts to _________?

Answers:

  1. Contributo
  2. Autho
  3. Edito
  4. Subscribe
  5. Administrato

16. Which of the following is the correct way to add custom excerpts length identifiers in WordPress?

Answers:

  1. By adding excerpt_length filter in function.php
  2. Can’t declare custom excerpts in wordpress
  3. Custom exceprts are already available in wordpress
  4. Using the_excerpt(‘long’); or the_excerpt(‘short’)

17. Which of the following is the correct sequence of steps to adapt a WordPress plugin to a multisite?

Answers:

  1. 1. Use $wpdb to iterate through all blogs 2. Hook according to the $blog_id 3. Install the plugin as Network only 4. Uninstall depends the specific plugin
  2. 1. Use $wp_posts to iterate through all blogs 2. Hook according to the $function 3. IInstall the plugin as Network only 4. Uninstall depends the specific plugin
  3. 1. Use $wp_posts to iterate through all blogs 2. Hook according to the $function 3. Install other activations except Network 4. Uninstall is the same for all the plugins
  4. 1. Use $wp_posts to iterate through all blogs 2. Hook according to the $function 3. Install the plugin as Network only 4. Uninstall is same for all the plugins

18. On which of the following databases can WordPress be installed by default?

Answers:

  1. MySQL
  2. Oracle Database
  3. Microsoft SQL Server
  4. PostgreSQL

19. Which of the following actions must be performed to import data from wordpress.com?

Answers:

  1. Enter the full access to wordpress.com into the data import form so that it can automatically connect and directly retrieve content.
  2. Import from wordpress.com’s RSS.
  3. Login to wordpress.com, then the export data using the export tool, then import an exported xml file to the site.

20. Meta tags can be added to WordPress pages by ________________.

Answers:

  1. using plug-ins
  2. adding them to the header.php file
  3. updating the database
  4. a and
  5. and c

21. Which of the following codes will return the current plugin directory in WordPress?

Answers:

  1. <!–?php plugin_basename($file); ?–>
  2. <!–?php plugin_basename(‘url’); ?–>
  3. < !–?php bloginfo_plugin(‘url’); ?–>
  4. < !–?php content_plugin_url( $path ); ?–>

22. WordPress’s requirements are modest. At minimum, which of the following standards should your server support for WordPress 3.1?

Answers:

  1. PHP version 4.4.9 or greater, MySQL version 4.0 or greater
  2. PHP version 4.3 or greater, MySQL version 4.1.2 or greater
  3. PHP version 4.4.9 or greater, MySQL version 5.1 or greater
  4.  PHP version 4.3 or greater, MySQL version 5.1 or greater

23. Which of the following will give the option to add inline Ajax for comment posting?

Answers:

  1. Enabling Ajax in the wp-config.php file
  2. Activating Ajax from the admin settings of WordPress
  3. Using the Ajax Comment Posting plugin
  4. WordPress doesn’t support inline Ajax.

24. What is the limitation to the depth of your categories?

Answers:

  1. 10 levels
  2. 20 levels
  3. No limit levels

25. Can the contents of the wp-content folder be moved or renamed without changing any settings?

Answers:

  1. Yes
  2.  No

26. Which of the following code snippets best protects a system from SQL injections?

Answers:

  1. sql_real_escape_strong()
  2. mysql_real_escape()
  3. mysql_real_escape_string()
  4. mysql_not_real_delete_string()

27. Which of the following role levels has the highest privilege?

Answers:

  1. Level_0
  2. Level_10
  3. Depends on your settings.
  4. Every role level has the same privilege.

28. How can the Home link be disable from the WordPress top nav?

Answers:

  1. Using Jquery to hide it
  2. By adding this code in functions.php function page_menu_args( $args ) { $args[‘show_home’] = FALSE; return $args; } add_filter( ‘wp_page_menu_args’, ‘page_menu_args’ );
  3. wp_nav_menu( array(‘menu’ => ‘news’, ‘show_home’ => false))
  4. Can not disable the default Home link from wordpress top nav

29. Which of the following is the correct way to retrieve a featured image from a post?
Answers:

  1. <!–?php echo get_post_thumb($page->ID, ‘thumbnail’); ?–>
  2. <!–?php echo get_featured_image($page->ID, ‘thumbnail’); ?–>
  3. <!–?php echo get_the_post_thumbnail($page->ID, ‘thumbnail’); ?–>
  4. <!–?php echo get_post_thumbnail($page->ID, ‘thumbnail’); ?–>

30. Which of the following will correctly load localized (translated) text for a WordPress plugin?

Answers:

  1. function custom_theme_setup() { $lang_dir = get_template_directory() . ‘/lang’); load_theme_textdomain(‘tutsplus’, $lang_dir); } add_action(‘after_setup_theme’, ‘custom_theme_setup’);
  2. function custom_theme_setup() { $lang_dir = get_template_directory() . ‘/lang’); add_action(‘after_setup_theme’, ‘custom_theme_setup’); }
  3. function custom_theme_setup() { $lang_dir = get_template_directory() . ‘/lang’); add_action(‘after_setup_theme’, ‘custom_theme_setup’); } load_theme_textdomain(‘tutsplus’, $lang_dir);
  4. function load_theme_textdomain(‘tutsplus’, $lang_dir); { $lang_dir = get_template_directory() . ‘/lang’); custom_theme_setup(); } add_action(‘after_setup_theme’, ‘custom_theme_setup’);

31. Image size limits can be set _______________.

Answers:

  1. directly in the posts
  2. in the wp-imageresize plug-in
  3. in the admin settings
  4. a and

32. How can a user be found through its meta data?

Answers:

  1. User can not be retrieved through its meta data
  2. get_user_by_metadata($metaid,$metavalue)
  3. get_user($args)
  4. get_users($args)

33. Which PHP method(s) can be used to send form data that is persistent across succeeding page views (such as for a language selection feature) in WordPress?

Answers:

  1. POST
  2. GET
  3. SESSION or COOKIE
  4. POST or GET

34. Which of the following will call the WordPress media uploader form element?

Answers:

  1. <form enctype=”multipart/form-data” method=”post” action=”<?=bloginfo(“siteurl”);?>/wp-admin/media-upload.php?inline=&upload-page-form=” class=”media-upload-form type-form validate” id=”file-form”>
  2.  <a onclick=”return false;” title=”Upload image” class=”thickbox” id=”add_image” href=”media-upload.php?type=image&TB_iframe=true&width=640&height=105″>Upload Image</a>
  3. <a href=”media-upload.php?type=image&TB_iframe=true&width=640&height=105″>Upload Image</a>
  4. <form enctype=”multipart/form-data” method=”post” action=”<?=bloginfo(“bloginfo”);?>/wp-admin/media-upload.php?inline=&upload-page-form=” class=”media-upload-form type-form validate” id=”file-form”>

35. Which of the following is the correct way to print the slug property of $firstTag object in this code snippet?$tags = wp_get_post_tags($post->ID);
$firstTag = $tags[0];

Answers:

  1. $firstTag[‘slug’];
  2. $firstTag->slug
  3. $firstTag.slug
    $firstTag[0][‘slug’]

36. Which of the following code snippets is the correct way to get content from Tinymce via javascript ?

Answers:

  1. document.getElementById(‘content’)
  2. tinymce.activeEditor.getContent();
  3. tinymce.element.getContent();
  4. document.getElement(‘tinymce_content’)

37. Is super cache a built-in plugin of WordPress?

Answers:

  1. Yes
  2. No

38. A possible way to allow the display of several authors’ names on one post is to ______

Answers:

  1. update the database
  2. change the admin settings
  3. change the config files
  4. use a plug-in

39. In which way MD5 hash does wordpress stores and represents?

Answers:

  1. In Hex string
  2. In Base64 string
  3. in raw data file
  4. text file

40. What is the first action you need to take for enabling WordPress MU feature?

Answers:

  1. Enable WordPress MU feature on admin panel
  2. Enable Network feature
  3. Add this code to wp-config.php file: define( ‘WP_ALLOW_MULTISITE’, true );

41. What is Automated Testing in WordPress?

Answers:

  1. Automated testing is running test cases where manual intervention is not required to run each one.
  2. It is a plugin which is used to test your custom template or plugin.
  3. It is a function available in WordPress to test the custom template/plugin.
  4.  There is no such thing as Automated Testing in WordPress.

42. Which of the following snippets disable depreciated warnings in WordPress like this one ?

“Deprecated: Assigning the return value of new by reference is deprecated in /home//public_html/hub/wp-settings.php on line 647”

Answers:

  1. define(E_DEPRECATED, false);
  2. error_reporting(E_ALL ^ E_DEPRECATED);
  3. define(E_NOTICE, false);
  4. error_reporting(WP_DEBUG, true)

43. One possible way to collect realtime statistics about traffic on a WordPress site is:

Answers:

  1. using a built-in tool
  2. using a plugin
  3. using a widget
  4. Traffic statistics cannot be collected on a WordPress site.

44. _____________ can publish, edit, and delete their own posts. They cannot write pages. They can upload some kinds of media files, and they are allowed to use only the limited set of HTML tags.

Answers:

  1. Contributo
  2. Autho
  3. Edito
  4. Subscribe
  5. Administrato

45. How can an < li >tag’s class and ID attributes be removed from menu items and page lists?

Answers:

  1. add_filter(‘nav_menu_css_class’, ‘my_css_attributes_filter’, 100, 1); add_filter(‘nav_menu_item_id’, ‘my_css_attributes_filter’, 100, 1); add_filter(‘page_css_class’, ‘my_css_attributes_filter’, 100, 1); function my_css_attributes_filter($var) { return is_array($var) ? array() : ”; }
  2. add_filter(‘nav_menu_css_class’, ‘my_css_attributes_filter’, 100, 1); add_filter(‘nav_menu_item_id’, ‘my_css_attributes_filter’, 100, 1); function my_css_attributes_filter($var) { if(is_array($var)){ $varci= array_intersect($var, array(‘current-menu-item’)); $cmeni = array(‘current-menu-item’); $selava = array(‘selectedmenu’); $selavaend = array(); $selavaend = str_replace($cmeni, $selava, $varci); } else{ $selavaend= ”; } return $selavaend; }
  3. add_filter (‘wp_nav_menu’,’strip_empty_classes’); function strip_empty_classes($menu) { $menu = preg_replace(‘/ class=([“‘])(?!active).*?1/’,”,$menu); return $menu; }
  4. None of the above

46. ____________ can publish, edit, and delete posts and pages written by any user. They can upload some kinds of files, and they can write HTML without restrictions. They can manage links and categories, and they can moderate comments. Editors and administrators are also the only users allowed to read private posts and pages.

Answers:

  1. Contributor
  2. Author
  3. Editor
  4. Subscriber
  5. Administrator

47. Which of the following will show the most recent post (by date) from a custom taxonomy?

Answers:

  1. select * from wp_posts where ID in( select ID from ( select wp_posts.ID , wp_posts.post_date, d.name from wp_posts as a join wp_term_relationships as b on ( a.ID = b.object_id) join wp_term_taxonomy as c on (b.term_taxonomy_id = c.term_taxonomy_id) join wp_terms as d on (c.term_id = d.term_id) where c.taxonomy = ‘post-series’ group by d.name having (wp_posts.post_date = max(wp_posts.post_date)) )tmp)
  2. select * from wp_posts where ID in( select ID from ( select wp_posts.ID , wp_posts.post_date, d.name from wp_posts as a join wp_terms as d on (c.term_id = d.term_id) where c.taxonomy = ‘post-series’ group by d.name having (wp_posts.post_date = max(wp_posts.post_date)) )tmp)
  3. select * from wp_posts where ID in( select ID from ( select wp_posts.ID , wp_posts.post_date, d.name from wp_posts as a join wp_term_relationships as b on ( a.ID = b.object_id) join wp_term_taxonomy as c on (b.term_taxonomy_id = c.term_taxonomy_id) join wp_terms as d on (c.term_id = d.term_id) having (wp_posts.post_date = max(wp_posts.post_date)) )tmp)
  4. select * from wp_posts where ID in( select ID from ( select wp_posts.ID , wp_posts.post_date, d.name from wp_posts as a join wp_term_relationships as b on ( a.ID = b.object_id) join wp_terms as d on (c.term_id = d.term_id) where c.taxonomy = ‘post-series’ group by d.name having (wp_posts.post_date = max(wp_posts.post_date)) )tmp)

48. What are the correct steps in wordpress plugin development:

Answers:

  1. Step 1 – Create your file and let it be known as a plugin Step 2 – Create the objects of your plugin Step 3 – Adding your actions and filters Step 4 – Adding settings/options to your plugin Step 5 – Finishing the code
  2. Step 1 – Adding settings/options to your plugin Step 2 – Create your file and let it be known as a plugin Step 3 – Create the objects of your plugin Step 4 – Adding your actions and filters Step 5 – Finishing the code
  3. Step 1 – Create the objects of your plugin Step 2 – Adding settings/options to your plugin Step 3 – Create your file and let it be known as a plugin Step 4 – Finishing the code
  4. Step 1 – Create the objects of your plugin Step 2 – Adding settings/options to your plugin Step 3 – Finishing the code

49. What is the output of the following code?

<li>example 1

<li>example 2

<li>example 3

<li>example 4

$(document).ready(function(){
$(‘#sortable’).sortable({
update: function(event, ui) {
var newOrder = $(this).sortable(‘toArray’).toString();
$.get(‘saveSortable.php’, {order:newOrder});
}
});
});

Answers:

  1. Removes positions from data base based on the user input
  2. Saves sortable positions to data base based on the user input
  3. Adding new sortable positions from another data base
  4. Sorting out existing positions without updating the data base with the new user inputs

50. Which of the following is the correct way to assign a category to a WordPress post?

Answers:

  1. wp_set_post_categories($postId,$categories)
  2. wp_set_category($catId,$postId)
  3. By XML-RPC call to wpc.newPost
  4. This is not possible

51. Conditional tags can be used to _______________________.

Answers:

  1. get all comments from one post
  2. get all posts from one category
  3. change the content to be displayed
  4. None of the above: conditional tags are not available in WordPress.

52. Which of the following commands can change the ownership of WordPress directory to www-data (for Apache)?

Answers:

  1. sudo chown -Rf www-data *
  2. chown -Rf www-data *
  3. sudo crown -Df www-data *
  4. Alldo chown -Rf www-data *

53. How can a custom content filter be added?

Answers:

  1. By using add_action(‘the_content’,’my_custom_filter’)
  2. By using add_filter(‘the_content’,’my_custom_filter’)
  3. By using wp_filter(‘the_content’,’my_custom_filter’)
  4. By using add_action(‘content’,’my_custom_filter’)

54. How can a post ID be retrieved from the permalink?

Answers:

  1. Its not possible to retrieve the post ID from a permalink due to its structure.
  2. It can be retrieved by using a Regular Expression.
  3. wp_get_post_id($permalink)
  4. url_to_postid($permalink)

55. Which of the following is the correct way to redirect the default login and registration page URL to a custom login and registration page URL?

Answers:

  1. add_action(‘init’,’possibly_redirect’); function possibly_redirect(){ global $pagenow; if( ‘wp-login.php’ == $pagenow ) { return(‘Your custom url’); exit(); } }
  2. add_action(‘init’,’possibly_redirect’); function possibly_redirect(){ global $pagenow; if( ‘wp-login.php’ == $pagenow ) { wp_redirect(‘Your custom url’); exit(); } }
  3. add_action(‘init’,’possibly_redirect’); function possibly_redirect(){ global $pagenow; if( ‘wp-login.php’ == $pagenow ) { redirect(‘Your custom url’); exit(); } }
  4. add_action(‘init’,’possibly_redirect’); function possibly_redirect(){ global $pagenow; if( ‘wp-login.php’ == $pagenow ) { wp_return(‘Your custom url’); exit(); } }

56. How can a WordPress template be integrated inside a codeigniter framework using WordPress functions like wp_header,wp_footer,wp_sidebar?

Answers:

  1. Include the file wp-blog-header.php from WordPress installation directory to codeigniters index.php and create template inside codeigniter’s view.
  2. Include the file wp-settings.php from WordPress installation directory to codeigniters index.php and create template inside codeigniter’s view.
  3. Create template inside WordPress theme directory and include the file in codeigniter’s view.php file.
  4. It is not possible to integrate wordpress with codeigniter.

57. What is the first action you need to take for enabling the WordPress multisite (MS) feature?

Answers:

  1. Enable the WordPress multisite feature on admin panel
  2. Enable the Network feature
  3. Add this code to wp-config.php file: define( ‘WP_ALLOW_MULTISITE’, true );

58. Which of the functions below is required to create a new taxonomy?

Answers:

  1. add_taxonomy
  2. register_taxonomy
  3. create_taxonomy

59. Which of the following actions cannot be hooked in with add_submenu_page() function?

Answers:

  1. admin_submenu
  2. admin_menu
  3. user_admin_menu
  4. network_admin_menu

60. Which of the following is the correct way to filter the content for a few posts?

Answers:

  1. By using apply_filters(filter,postId)
  2. This is not possible in wordpress
  3. Can create filter for posts in a specific wordpress category
  4. Passing arguments into the_content()

61. What is the function of add_filter in WordPress?

Answers:

  1. It registers a filter for a tag.
  2. It removes line breaks from the pages list.
  3. It is a companion function to apply_filters().
  4. All of the above.

62. Which of the following code snippets will create plugins back-end page without showing it as menu item?

Answers:

  1. add_submenu_page with parent slug = null
  2. add_menu_page with parent slug = null
  3. add_submenu_page without parent slug = null
  4. add_menu_page without parent slug = null

63. ____________ can manage their own profiles, but can do virtually nothing else in the administration area.

Answers:

  1. Contributor
  2. Author
  3. Editor
  4. Subscriber
  5. Administrator

64. Are categories and tags available for pages?

Note: Categories must have distinct slugs. Even if two categories have different parents and would therefore have different permalinks, you can’t assign them the same slug.

Answers:

  1. Yes
  2. No

65. Which of the following is the correct way to get WordPress Post ID from the Post title?

Answers:

  1. $page = get_page_title( ‘About’ ); wp_pages( ‘exclude=’ . $page->ID );
  2. $page = get_page_by_title( ‘Home’ ); $page_id = $page->ID;
  3. $page = get_page_by_title( ‘About’ ); wp_pages( ‘exclude=’ . $page->ID );
  4. None of the above

66. Which of the following will correctly add custom mod rewrite rules to .htaccess from a WordPress plugin?

Answers:

  1. $custom_mod_rewrite = new custom_mod_rewrite; register_activation_hook( __FILE__, array($custom_mod_rewrite, ‘flush_rewrite_rules’)); register_deactivation_hook( __FILE__, array($custom_mod_rewrite, ‘flush_rewrite_rules’)); add_action(‘generate_rewrite_rules’, array($custom_mod_rewrite, “generate_rewrite_rules”)); class custom_mod_rewrite { function __construct() { $this->wp_rewrite = & $POST[“wp_rewrite”]; }}
  2. $custom_mod_rewrite = new custom_mod_rewrite; register_activation_hook( __FILE__, array($custom_mod_rewrite, ‘flush_rewrite_rules’)); register_deactivation_hook( __FILE__, array($custom_mod_rewrite, ‘flush_rewrite_rules’)); add_action(‘generate_rewrite_rules’, array($custom_mod_rewrite, “generate_rewrite_rules”)); class custom_mod_rewrite { function __construct() { $this->wp_rewrite = & $GLOBALS[“wp_rewrite”]; } }
  3. $custom_mod_rewrite = new custom_mod_rewrite; register_activation_hook( __FILE__, array($custom_mod_rewrite, ‘flush_rewrite_rules’)); register_deactivation_hook( __FILE__, array($custom_mod_rewrite, ‘flush_rewrite_rules’)); add_action(‘generate_rewrite_rules’, array($custom_mod_rewrite, “generate_rewrite_rules”)); class custom_mod_rewrite { function __construct() { $this->wp_rewrite = & $GLOBALS[“wp_rewrite”]; } function mod_rewrite_rules($rules) { return preg_replace(‘#^(RewriteRule ^.*/)?$plugin_name .*(http://.*) [QSA,L]#mi’, ‘$1 $2 [R=301,L]’, $rules); } }
  4. $custom_mod_rewrite = new custom_mod_rewrite; register_activation_hook( __FILE__, array($custom_mod_rewrite, ‘flush_rewrite_rules’)); register_deactivation_hook( __FILE__, array($custom_mod_rewrite, ‘flush_rewrite_rules’)); add_action(‘generate_rewrite_rules’, array($custom_mod_rewrite, “generate_rewrite_rules”)); class custom_mod_rewrite { function __construct() { $this->wp_rewrite = & $SESSION[“wp_rewrite”]; } }

67. Which of the following is the correct code to get an array of every image uploaded to a particular post?

Answers:

  1. $images =& get_children( ‘post_type=attachment&post_mime_type=image&post_parent=10’ );
  2. $images = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
  3. $images = get_post(7, ARRAY_A);
  4. It cannot be done

68. Which of the following will echo the base URL of a WordPress site?
Answers:

  1. <?php echo get_bloginfo(‘base_url’) ?>
  2. <?php echo get_bloginfo(‘url’) ?>
  3. <?php echo get_bloginfo(‘site_url’) ?>
  4. <?php echo get_website_url() ?>

69. Which of the following functions are used when adding CSS and jQuery codes on a WordPress plugin?

Answers:

  1. wp_register_style
  2. wp_enqueue_style
  3. wp_enqueue_script
  4. None of these.

70. In order to display a widget, the user must _________________.

Answers:

  1. set the “show property” of the desired widget to “true”
  2. drag the desired widget to the side ba
  3. add the desired widget to the post
  4. change the source code

71. Which conditional tag checks if the dashboard or the administration panel is attempting to be displayed by returning «true’ (if the URL being accessed is in the admin section) or «false» (for a front-end page).

Answers:

  1. my_admin()
  2. view_admin()
  3. is_admin()
  4. root_admin()

72. How can the class name of a sub-menu be changed in the wp_nav_menu?

Answers:

  1. By manually adding the class name in Appearance—>Menus
  2. WordPress does not support the ability to change the class name of a sub-menu in the wp_nav_menu.
  3. By adding the following code in functions.php: class UL_Class_Walker extends Walker_Nav_Menu { function start_lvl(&$output, $depth) { $indent = str_repeat(«\t», $depth); $output .= «\n$indent<ul class=\»level-«.$depth.»\»>\n»; } }
  4. By adding the following code in header.php: class UL_Class_Walker extends Walker_Nav_Menu { function start_lvl(&$output, $depth) { $indent = str_repeat(«\t», $depth); $output .= «\n$indent<ul class=\»level-«.$depth.»\»>\n»; } }

72. Which of the following is a Online Code Coloring Service?

Answers:

  1. Prettify
  2. SyntaxHighligherText
  3. XEdit Pad
  4. Collabedit

73. What is the name of theme file for a page with slug ‘about’?

Answers:

  1. page-slug-about.php
  2. page-about.php
  3. about.php

74. Who of the following persons can read a post locked by password?

Answers:

  1. Only administrators, editors and authors
  2. Registered users who knows password
  3. Anyone who knows a password

75. In this stock quote api for wordpress of yahoo http://download.finance.yahoo.com/d/quotes.csv?s=GOOG&f=ll, what does ‘ s’ stand for?

Answers:

  1. Stock Format
  2. Stock Variable
  3. Stock Symbol
  4. Stock Supplier

76. Which of the following is a quick way to move a WordPress website from one server to another?

Answers:

  1. Using migration plugin
  2. Copying wordpress files and database from source to destination server
  3. Using XML export through wp-admin interface
  4. Install new wordpress and copy theme and plugin directory

77. Which of the following will remove anchors from all nodes/levels except the 4th level nodes of a WordPress category?
Parent node (1st level)
—>Child node (2nd level)
—->3rd level node
——>4th level node

Answers:

  1. .cat-item a, .cat-item .cat-item a.hover {cursor: default;} .cat-item .cat-item a.hover {cursor: pointer;}
  2. .cat-item a, .cat-item .cat-item a {cursor: default;} .cat-item .cat-item a {cursor: pointer;}
  3. .cat-item a, .cat-item .cat-item .cat-item .cat-item a {cursor: default;} .cat-item .cat-item .cat-item a {cursor: pointer;}
  4. .cat-item a, .cat-item .cat-item a:hover {cursor: pointer;} .cat-item .cat-item a:hover {cursor: default;}

78. How can an <li> tag’s class and ID attributes be removed from menu items and page lists?

Answers:

  1. add_filter(‘nav_menu_css_class’, ‘my_css_attributes_filter’, 100, 1); add_filter(‘nav_menu_item_id’, ‘my_css_attributes_filter’, 100, 1); add_filter(‘page_css_class’, ‘my_css_attributes_filter’, 100, 1); function my_css_attributes_filter($var) { return is_array($var) ? array() : »; }
  2. add_filter(‘nav_menu_css_class’, ‘my_css_attributes_filter’, 100, 1); add_filter(‘nav_menu_item_id’, ‘my_css_attributes_filter’, 100, 1); function my_css_attributes_filter($var) { if(is_array($var)){ $varci= array_intersect($var, array(‘current-menu-item’)); $cmeni = array(‘current-menu-item’); $selava = array(‘selectedmenu’); $selavaend = array(); $selavaend = str_replace($cmeni, $selava, $varci); } else{ $selavaend= »; } return $selavaend; }
  3. add_filter (‘wp_nav_menu’,’strip_empty_classes’); function strip_empty_classes($menu) { $menu = preg_replace(‘/ class=([«\’])(?!active).*?\1/’,»,$menu); return $menu; }
  4. None of the above

79.How many built-in user roles does WordPress have?

Answers:

  1. 3
  2. 4
  3. 5
  4. 6

80. How can WordPress comments be saved in Markdown format?

Answers:

  1. <?php add_filter(«hook_comment_text’, ‘Markdown’); ?>
  2. WordPress does not support the Markdown format.
  3. <?php add_filter(‘comment_text’, ‘Markdown’); ?>
  4. <?php add_filter(‘comments’, ‘Markdown’); ?>

81.Which of the of the following code snippets removes the “Home” link from the “wp_nav_menu”?

Answers:

  1. <?php add_filter(«hook_comment_text’, ‘Markdown’); ?>
  2. WordPress does not support the Markdown format.
  3. <?php add_filter(‘comment_text’, ‘Markdown’); ?>
  4. <?php add_filter(‘comments’, ‘Markdown’); ?>

82. Which of the of the following code snippets removes the “Home” link from the “wp_nav_menu”?

Answers:

  1. <? php wp_nav_menu( array(‘menu’ => ‘news’, ‘show_home’ => false)); ?>
  2. <? php wp_nav_menu( array(‘menu’ => ‘news’, ‘show_home’ =0)); ?>
  3. In functions.php following code should be added:
    function page_menu_args( $args ){
    $args[‘show_home’] = False;
    return $args;
    }
    add_filter( ‘wp_page_menu_args’, ‘page_menu_args’);
    Plus additional snippet code:
    wp_nav_menu( array(‘echo’=>true));
    }
  4. $(“div.menu > u; li:first-child”).css(“display”,”none”);

82. Which of the following will change the default ordering of categories in the WordPress post edit page?

Answers:

  1. Adding ‘checked_ontop’ => FALSE to the args in wp_terms_checklist() in the functions.php file
  2. Disabling category ordering in the WordPress admin settings
  3. Setting category_ordering=false in the wp-config.php file
  4. Adding ‘category_ordering’ => FALSE to the args in wp_terms_checklist() in the functions.php file

83. Which of the following will make a custom query in a WordPress plugin?

Answers:

  1. <?php $wpdb->query(‘query’); ?>
  2. <?php $query = new WP_Query( ‘author=2,6,17,38’ ); ?>
  3. <?php wp_reset_query(); ?>
  4. <?php $wpdb->query(‘select * from my_plugin_table where foo = «bar»‘); ?>

84. Is the functions.php file required in each theme?

Answers:

  1. Yes
  2. No

85. In a WordPress multisite, how can a new blog site be added from the Network Admin panel?

Answers:

  1. do_action (‘wpmu_blog’, $blog_id, $user_id, $domain, $path, $site_id, $meta);
  2. define (‘WP_ALLOW_MULTISITE’, true);
  3. do_action (‘wpmu_blog’, $blog_id, $user_id, $domain, $path, $site_id, $meta);
  4. do_action (‘wpmu_new_blog’, $blog_id, $user_id, $domain, $path, $site_id, $meta);

86. Which of the following categories of persons can read a post locked by password?

Answers:

  1. Only administrators, editors and authors.
  2. Registered users who know a password.
  3. Anyone who knows a password.
  4. do_action (‘wpmu_new_blog’, $blog_id, $user_id, $domain, $path, $site_id, $meta);

87.Which deprecated functions are still in use in WordPress?

Answers:

  1. register_globals()
  2. magc_quotes()
  3. addslashers()
  4. get_permalink()

88. Which of the following is the best way to highlight the syntax on a blog created on wordpress.com?

Answers:

  1. {your code}
  2. [color:red] {your code} [/color]
  3. install syntax highlight plugin
  4. {your code}

89. How do you check a WordPress function does if you see it for the first time?

Answers:

  1. Browse the Codex.
  2. Look at the source code.]
  3. install syntax highlight plugin
  4. {your code}

90. What is the name of the table in database which stores custom fields data?

Answers:

  1. wp_custommeta
  2. wp_options
  3. wp_terms
  4. wp_postmeta

91. How you retrieve an array of all the post tags?

Answers:

  1. get_terms(‘post_tag’, array(‘hide_empty’ => false));
  2. get_terms(array(‘taxonomy’ => ‘post_tag’, ‘hide_empty’ => false));
  3. get_term();
  4. wp_terms()
  5. wp_terms_checklist();

92. When should the wp_kses function for Data Validation be run?

Answers:

  1. At the time of form submission
  2. Before the data is saved in the database.
  3. before the data is being rendered on the webpage

93. “X people have seen this post” should be output like this:

Answers:

  1. printf( _n( ‘%d person has seen this post.’, ‘%d people have seen this post.’, $view_count ), $view_count );
  2. printf( __( ‘%d people have seen this post.’ ), $view_count );
  3. echo _n( ‘One person has seen this post’, “$view_count people have seen this post.” );
  4. printf( _n( ‘%d person has seen this post.’, ‘%d people have seen this post.’ ), $view_count );
  5. printf( 1 == $view_count ? __( ‘%d person has seen this post.’ ) : __( ‘%d people have seen this post.’ ), $view_count );

94. What WordPress function would you use to retrieve the name of the current action?

Answers:

  1. current_filter
  2. current_action_name
  3. current_hook

95. What are the correct ways for displaying post title wrapped into H1 tag?

Answers:

  1. <?php the_title( ‘<h1>’, ‘</h1>’ ); ?>
  2. <h1><?php get_the_title(); ?>
  3. <?php the_title( ‘<h1>’, ‘</h1>’, ‘display_title’ ); ?>
  4. <h1>?php the_title(); ?></h1>

96. Display the current pagination number.

Answers:

  1. $page = get_page(‘1’);
    echo ‘Current page: ’ . $page->post_paged;
  2. $paged = get_query_var(‘paged’, 1);
    echo ‘Current page: ’ . $paged;
  3. $page = get_post(‘1’);
    echo ‘Current page: ’ . $page->post_paged;

97. Display the current pagination number.

Answers:

  1. $page = get_page(‘1’);
    echo ‘Current page: ’ . $page->post_paged;
  2. $paged = get_query_var(‘paged’, 1);
    echo ‘Current page: ’ . $paged;
  3. $page = get_post(‘1’);
    echo ‘Current page: ’ . $page->post_paged;

98. What is the WordPress way of adding a query variable to an URL

Answers:

  1. site_url(‘?’ . $foo . ‘=’ . $bar);
  2. home_url(‘$’ . $foo . ‘=’ . $bar);
  3. add_query_arg($foo, $bar, home_url());

99. When is it recommended to rebuild the $wp_rewrite object with the flush_rewrite_rules() function?

Answers:

  1. once in a while
  2. after every one hour
  3. on every custom post type page load
  4. after activatation and deactivation of a custom post types plugin

100. What is the difference between filters and actions?

Answers:

  1. An action is defined as a function that takes in some kind of input, modifies it, and then returns it whereas a filter is just a place where you call a function, and you don’t really care what it returns
  2. A filter is defined as a function that takes in some kind of input, modifies it, and then returns it whereas an action is just a place where you call a function, and you don’t really care what it returns
  3. There is no difference. Both are used for hooking into an action.

101. Which HTML tags are not allowed to be used in a post comment?

Answers:

  1. code
  2. form
  3. img
  4. strike
  5. table

102. Which of the following is the correct way to register shortcode?

Answers:

  1. function foobar_func ( $atts ){
    return “foo and bar”;
    }
    new_shortcode( ‘foobar’, ‘foobar_func’ );
  2. function foobar_func ( $atts ){
    return “foo and bar”;
    }
    insert_shortcode( ‘foobar’, ‘foobar_func’ );
  3. function foobar_func ( $atts ){
    return “foo and bar”;
    }
    register_shortcode( ‘foobar’, ‘foobar_func’ );
  4. function foobar_func ( $atts ){
    return “foo and bar”;
    }
    add_shortcode( ‘foobar’, ‘foobar_func’ );

103. If you need to store information temporarily, which WordPress system would you use:

Answers:

  1. Options
  2. Meta tables
  3. Transients
  4. The REST API

104. What is true about the_meta() function?

Answers:

  1. This is a function for displaying custom fields for the current post, known as the “post-meta” (stored in the wp_postmeta table).
  2. It formats the data into an unordered list.
  3. It may be used outside the loop.
  4. the_meta() will ignore meta_keys (i.e. field names) that begin with an underscore.

105. Is it possible to retrieve list of custom taxonomy terms with get_terms() function?

Answers:

  1. Yes
  2. No

106. Which WP global object is used to execute custom database queries?

Answers:

  1. $wpdb
  2. $wp_db
  3. $db_query
  4. $wp_query

107. What are WordPress hooks?

Answers:

  1. Setting options available to WordPress administrators.
  2. Security functions that run inside WordPress
  3. Group of plugins which control WordPress behavior.
  4. Ways to change the default behavior of WordPress.

108. Which from below are default post types in WordPress and are readily available to users or internally used by the WordPress installation by default:

Answers:

  1. Post
  2. Page
  3. Links
  4. Attachment
  5. Revision
  6. Comments
  7. Navigation menu

109. Which of the following is an example of a WordPress plugin that provides pagination capabilities?

Answers:

  1. Page Break
  2. Page Generator
  3. WP-PageNavi
  4. Page-list

110. Which of the following is not a WordPress role?

Answers:

  1. System
  2. Subscriber
  3. Administrator
  4. Editor

111. Is it possible to disable the trash and delete the posts immediatelly?

Answers:

  1. No.
  2. Yes, via a define in wp-config.php: define(‘EMPTY_TRASH_DAYS’, 0);
  3. Yes, via a define in wp-config.php: define(‘EMPTY_TRASH_DAYS’, 0);

112. Select all the WordPress supported audio formats.

Answers:

  1. aiff
  2. mp3
  3. ogg
  4. flac
  5. wma
  6. wav

113. Sometimes you might want to disable all the automatic background updates of WordPress, extensions, themes and languages. How would you accomplish that?

Answers:

  1. via a define in wp-config.php: define(‘AUTOMATIC_UPDATER_DISABLED’, true);
  2. with a filter: add_filter(‘automatic_updater_disabled’, ‘__return_true’);
  3. I’m using git, so I would use a special filter:
    add_filter(‘automatic_updates_is_vcs_checkout’, ‘__return_false’, 1);

114. How do you know if a WordPress action has been previously fired?

Answers:

  1. Using the has_action(‘my_action’) function.
  2. Using the did_action(‘my_action’) function.
  3. Using the current_filter function.

115. What is the correct way for displaying navigation menu called “Primary Menu”?

Answers:

  1. wp_nav_menu( array(
    ‘menu’ => ‘Primary Menu’
    ) );
  2. wp_navigation_menu( array(
    ‘menu’ => ‘primary-menu’
    ) );
  3. wp_navigation( array(
    ‘menu’ => ‘Primary Menu’
    ) );
  4. wp_menu( array(
    ‘menu’ => ‘primary-menu’
    ) );

116. How you determine if a script has been enqueued correctly?

Answers:

  1. has_enqueue_script(‘my-script-handle’);
  2. wp_script_is(‘my-script-handle’, ‘enqueued’);
  3. is_script_loaded(‘my-script-handle’);

117. Which of the following is incorrect possible value for $show attribute of bloginfo($show) function?

Answers:

  1. ‘name’
  2. ‘description’
  3. homeurl’
  4. ‘admin email’

118. How to display the value of a post meta field named my_custom?

Answers:

  1. $post_meta = get_post_meta($post->ID, ‘my_custom’, true);
    echo $post_meta;
  2. $post_meta = get_post_meta($post->ID);
    echo $post_meta;
  3. echo get_meta($post->ID, ‘my_custom’);

119. Is it possible to create posts programmatically?

Answers:

  1. No
  2. Yes, with wp_insert_post() function
  3. Yes, with wp_add_post() function
  4. Yes, with wp_create_post() function

120. What type of hook is wp_meta

Answers:

  1. Action Hook
  2. Filter Hook

121. Is it possible to bypass trash and force deletion with wp_delete_post() function?

Answers:

  1. No
  2. Yes

122. Retrieve all the post types that support thumbnails or excerpts.?

Answers:

  1. get_post_type(array(‘supports’ => array(‘thumbnail’, ‘excerpt’)), ‘names’, ‘or’);
  2. post_type_supports(‘post’, array(‘thumbnail’, ‘excerpt’), ‘or’);
  3. get_post_types_by_support(array(‘thumbnail’, ‘excerpt’), ‘or’);

123. What is the name of self-hosted version of WordPress?

Answers:

  1. WordPress.com
  2. WordPress.org
  3. Open Source WordPress
  4. WordPress online

124. Where can you change the Timezone used by WordPress in the dashboard?

Answers:

  1. In Settings > Media
  2. In Settings > General
  3. In Settings > Reading
  4. In Settings > Writing

125. Select all the default taxonomies in WordPress.

Answers:

  1. post_category
  2. post_tag
  3. link_category
  4. product_tag
  5. post_format
  6. category

126. Which files are a minimum required by a theme to function?

Answers:

  1. style.css and functions.php
  2. style.css and index.php
  3. index.php and functions.php
  4. index.php, functions.php and style.css

127. What is WordPress multisite?

Answers:

  1. Special version of WordPress that can support many sites and is not free.
  2. WP configuration feature that supports multiple sites.
  3. A WP plugin that supports multiple sites.
  4. A popular WP theme that supports multiple sites.

128. How do you enable the Network Setup menu item(enable Multisite) in WordPress?

Answers:

  1. Install WP MU plugin
  2. Activate WP Multisite in Settings menu
  3. Set WP_ALLOW_MULTISITE as true in wp-config.php
  4. WP MU has been discontinued as a separate project so there is no way to set up multisites in WP now

130. How would you extend the time of the WordPress login session?

Answers:

  1. add_filter( ‘auth_cookie_expiration’, ‘stay_logged_in_for_1_year’ );
    function stay_logged_in_for_1_year( $expire ) {
    return 31556926; // 1 year in seconds
    }
  2. add_filter(‘auth_cookie’, ‘stay_logged_in_for_1_year’);
    function stay_logged_in_for_1_year($expire) {
    return 31556926;
    }
  3. add_filter(‘secure_logged_in_cookie’, ‘stay_logged_in_for_1_year’);
    function stay_logged_in_for_1_year($expire) {
    return 31556926;
    }

131. Which of these are a part of WordPress API?

Answers:

  1. Theme Modification API
  2. Metadata API
  3. Theme Update API
  4. Settings API
  5. Options API
  6. Theme Customization API
  7. User API
  8. Update API

132. Which of these are a part of WordPress API?

Answers:

  1. Theme Modification API
  2. Metadata API
  3. Theme Update API
  4. Settings API
  5. Options API
  6. Theme Customization API
  7. User API
  8. Update API

133. Which concept does WordPress uses to control user access to different features?

Answers:

  1. Username
  2. Access tokens
  3. Role
  4. Cookies

134. Which constant is NOT recognized in wp-config.php?

Answers:

  1. WP_SITEURL
  2. WP_CONTENT_DIR
  3. WP_CONTENT_URL
  4. WP_HOME_URL

135. What is the default table prefix in WP?

Answers:

  1. _wp
  2. w_
  3. wp_
  4. wp-

136. Which is the most important file that should be deleted from your WordPress install directory once you’ve completed setup?

Answers:

  1. setup-example.xml
  2. wp_config_sample.php
  3. wp-config-sample.php
  4. wp-setup-sample.php

137. Display an Admin Notice in a Network Admin Dasboard of a WordPress multi site install.

Answers:

  1. function my_network_admin_notice() {
    echo ‘

    Network Admin Dashboard Notice!

    ’;
    }
    add_action(‘admin_notices’, ‘my_network_admin_notice’);

  2. function my_admin_notice() {
    echo ‘

    Network Admin Dashboard Notice!

    ’;
    }
    add_action(‘network_admin_notice’, ‘my_admin_notice’);

  3. function my_notice() {
    echo ‘

    Network Admin Dashboard Notice!

    ’;
    }
    add_action(‘network_admin_notices’, ‘my_notice’);

137. You need a single post meta value in a bigger post loop and you need it only one time, and you want it to be as fast as possible. How would you proceed?

Answers:

  1. Of course, get_post_meta($post->ID, ‘post_meta’, true); — пока это, помечать оценку.
  2. I would use a direct query like: $wpdb->get_var($wpdb->prepare(«SELECT meta_value from $wpdb->postmeta WHERE post_id = %d and meta_key = ‘post_meta’”, $post->ID));
  3. I would use a direct query like: $wpdb->get_results($wpdb->prepare(«SELECT * from $wpdb->postmeta WHERE meta_key = %s”, ‘post_meta’));

138. How do you enable debug mode in WP?

Answers:

  1. By going to Dashboard > Settings > General and then enable debug mode
  2. By setting WP_DEBUG as true in wp-config.php
  3. It is enabled by default

139. What are the default plugins installed in the WordPress?

Answers:

  1. Contact form7
  2. Akismet
  3. All in one SEO
  4. Hello Dolly

140. What are the default plugins installed in the WordPress?

Answers:

  1. wp_update_user
  2. wp_create_user
  3. register_new_user
  4. wp_insert_user

141. Which of the following functions check if current visitor is a logged in user?

Answers:

  1. is_visitor_logged_in ( );
  2. is_user_logged_in ( );
  3. if_user_logged_in ( );
  4. is_user_logged ( );

142. Which one of the following files is located in the root of your WordPress installation directory and contains your website’s setup details, such as database connection info?

Answers:

  1. setup.html
  2. wp-setup.php
  3. wp-config.php
  4. wp-install.php

143. What can the Contributor role do?

Answers:

  1. Moderate comments
  2. Publish posts
  3. Edit posts
  4. Edit pages

144. What is common to all these functions: next_post, previous_post, link_pages, the_author_url, wp_get_link?

Answers:

  1. They all return URLs
  2. They are all deprecated
  3. They all point to posts or post lists
  4. They all echo something

145. Pick the correct default Post Types readily available to users or internally used by the WordPress installation.

Answers:

  1. Post
  2. Page
  3. Blog
  4. Archive
  5. Category

146. Where can you set a static page as the front page in WP?

Answers:

  1. In wp-config.php
  2. In Dashboard->Settings->Reading
  3. In Dashboard->Settings->General
  4. In Dashboard->Appearance

147. How do you check if the current user has the role “administrator”?

Answers:

  1. current_user_can_do(‘manage_options’);
  2. is_admin();
  3. current_user_can(‘administrator’);
  4. current_user_can_do(‘manage’);
  5. in_array(‘administrator’, wp_get_current_user()->roles);

148. Which of the following is true about bloginfo(‘url’); function?

Answers:

  1. Displays URL of the active theme’s directory.
  2. Displays the “Site address (URL)” set in Settings > General. This data is retrieved from the “home” record in the wp_options table.
  3. Displays the current post URL.
  4. Displays the “WordPress address (URL)” set in Settings > General. This data is retrieved from the “siteurl” record in the wp_options table.

149. Clean up a comma-separated list of post ids. Example list:
1254,9930,10974,”192”,9930,192

Answers:

  1. array_map(‘absint’, ’1254,9930,10974,”192”,9930,192’);
  2. explode(1254,9930,10974,”192”,9930,192);
  3. wp_parse_id_list(1254,9930,10974,”192”,9930,192);

150. Clean up a comma-separated list of post ids. Example list:
1254,9930,10974,”192”,9930,192
Answers:

  1. array_map(‘absint’, ’1254,9930,10974,”192”,9930,192’);
  2. explode(1254,9930,10974,”192”,9930,192);
  3. wp_parse_id_list(1254,9930,10974,”192”,9930,192);

151. How many WordPress posts can you create?

Answers:

  1. WordPress recommends less than 10,000 posts.
  2. WordPress is limited to 1,000 posts.
  3. WordPress has not set any limit.
  4. WordPress is limited to 1,00,000 posts.

152. You need to include a link in a sentence. How can you do that?
1254,9930,10974,”192”,9930,192

Answers:

  1. _e( ‘Publish something using our <a href=»http://support.wordpress.com/post-by-email/»>Post by Email</a> feature.’ );
  2. printf( __( ‘Publish something using our <a href=»%s»>Post by Email</a> feature.’), ‘http://support.wordpress.com/post-by-email/’ );
  3. printf( __( ‘Publish something using our %s feature.’ ), sprintf( ‘<a href=»http://support.wordpress.com/post-by-email/»>%s</a>’, __( ‘Post by Email’ ) ) );

153. Assuming we are using ‘wp_’ as the database table prefix, in which table are all the custom fields related to a post stored?

Answers:

  1. wp_posts
  2. wp_postmeta
  3. wp_terms

154. Which is the default site update service that WordPress automatically notifies when you publish a new post?

Answers:

  1. http://rpc.pingomatic.com
  2. http://google.com
  3. http://ping.feedburner.com
  4. http://www.feedsubmitter.com

155. Which of the following is not a default image size in WP?

Answers:

  1. Small Size
  2. Medium Size
  3. Large Size
  4. Thumbnail Size

155. What is a permalink?

Answers:

  1. Permalinks are the permanent URLs to your individual weblog posts, as well as categories and other lists of weblog postings.
  2. The numeric IP address of your WordPress site.
  3. The complete URL of your WordPress site.
  4. A popular WordPress plugin.

156. How many WordPress themes can be installed in a single WordPress installation?

Answers:

  1. 1
  2. 10
  3. 100
  4. Unlimited

157. Arrange the following templates in decreasing order of priority from left to right for Site Front Page:
index.php
front-page.php
home.php

Answers:

  1. index.php, front-page.php, home.php
  2. front-page.php, home.php, index.php
  3. home.php, front-page.php, index.php
  4. front-page.php,index.php home.php

158. Which of the following files in a WP theme is NOT a file required by the theme review team for acceptance into the WordPress.org theme directory?

Answers:

  1. page.php
  2. style.css
  3. index.php
  4. comments.php
  5. screenshot.png

159. What database does WordPress use?

Answers:

  1. Notes
  2. PostgreSQL
  3. MySQL
  4. Oracle

160. Select all of the supported page statuses in WordPress.

Answers:

  1. draft (Draft)
  2. pending (Pending Review)
  3. private (Private)
  4. publish (Published)

161. Which of the following strings is not a default WordPress post format slug?

Answers:

  1. aside
  2. image
  3. quote
  4. status

162. Which hook can be used to update kses and TinyMCE to allow select new attributes for an HTML element?

Answers:

  1. tool_box
  2. tiny_mce_before_init
  3. tiny_mce_plugins
  4. htmledit_pre

163. Where plugins options are stored in WordPress?

Answers:

  1. They are stored in WordPress theme folder.
  2. They are stored in WordPress plugins folder.
  3. They are stored in WordPress.org and not on your site.
  4. They are stored in WordPress Database.

164. When adding a function to the “the_content” hook, where will you see changes?

Answers:

  1. On the blog list page.
  2. On the single post page.
  3. It depends on how your theme is set up.
  4. On the archive page.

165. Which standard WP class do you need to necessarily extend to create your widget?

Answers:

  1. WP_Widget
  2. WP_Widget_Form_Customize_Control
  3. WP_Customize_Control
  4. WP_Customize_Sidebar_Section

166. Which of the following is true about wp_mail() function?

Answers:

  1. A true return value does not automatically mean that the user received the email successfully.
  2. For this function to work, the settings SMTP and smtp_port (default: 25) need to be set in your php.ini file.
  3. The default content type allows using HTML.
  4. The function can handle only one email as $to parameter.

167. Which hook fires after WordPress has finished loading but before any headers are sent?

Answers:

  1. activate_wp_head
  2. init
  3. activate_header
  4. xmirpc_call

168. Which loop is used by default to fetch the posts and loop through them?

Answers:

  1. for loop
  2. while loop
  3. foreach loop

169. Pick the default template tag(s).

Answers:

  1. the_field()
  2. wp_title()
  3. wp_field()

170. Arrange the following templates in decreasing order of priority from left to right used to display the posts on a Category page.
index.php
category.php
archive.php
category-ID.php
category-slug.php

Answers:

  1. category-ID.php, category-slug.php, category.php, archive.php, index.php
  2. category-slug.php, archive.php, category.php, category-ID.php, index.php
  3. index.php, category.php, archive.php, category-ID.php, category-slug.php
  4. category-slug.php, category-ID.php, category.php, archive.php, index.php

171. Which function should be used to insert a post title into the title attribute of an HTML element?

Answers:

  1. get_the_title( );
  2. the_title_attribute( );
  3. the_title( );

172. Which of the following is/are NOT the default abstract methods available in the Walker class for menus?

Answers:

  1. start_lvl( )
  2. end_lvl( )
  3. start_li( )
  4. end_li( )

173. What does wp_rand() function?

Answers:

  1. Gets random post ID.
  2. Gets random category ID.
  3. Generates a random post ID for wp_insert_post() function.
  4. Generates a random number.

174. Is it possible to update posts programmatically?

Answers:

  1. Yes, with wp_edit_post( ) function.
  2. Yes, with wp_update_post( ) function.
  3. Yes, with wp_change_post( ) function.
  4. No.

175. Where do you change theme name and author details?

Answers:

  1. style.css file in the theme folder
  2. index.php file in the theme folder
  3. readme.txt file in the theme folder

176. What is the correct order of priority in decreasing order from left to right for Custom Post Type template files?

Answers:

  1. single-{post-type}-{slug}.php, single-{post-type}.php, single.php, singular.php, index.php
  2. single-{post-type}.php, single-{post-type}-{slug}.php, single.php, singular.php, index.php
  3. single-{post-type}.php, single.php, singular.php, single-{post-type}-{slug}.php, index.php
  4. single-{post-type}.php, single.php, singular.php, single-{post-type}-{slug}.php, index.php

177. Which default WP function can be used to assign different classes to the body element?

Answers:

  1. body_class( )
  2. get_body_classes( )
  3. get_theme_support( )
  4. sanitize_html_class( )

178. What is the name of theme file for a page with slug ‘about-us’?

Answers:

  1. about-us.php
  2. page-about-us.php
  3. page-about.php
  4. about-us-page.php

179. Which of the following is the correct way to display featured image of post?

Answers:

  1. echo get_the_post_thumbnail($page->ID, ‘thumbnail’);
  2. echo get_the_featured_image($page->ID, ‘thumbnail’);
  3. the_post_thumbnail($page->ID, ‘thumbnail’);
  4. the_featured_image($page->ID, ‘thumbnail’);

180. How will you check if a page exists for a given URL?

Answers:

  1. get_page_by_path( )
  2. get_page_url( )
  3. get_page_link( )
  4. get_page_uri( )

181. Which of these would be the correct way to output the escaped username in a sentence?

Answers:

  1. <?php scanf( __( ‘Howdy, %s’ ), $username ); ?>!
  2. <?php echo __( ‘Howdy’ ) . ‘, ‘ . $username; ?>!
  3. <?php printf( __( ‘Howdy, %s!’ ), $username ); ?>
  4. <?php _e( «Howdy, $username!» ); ?>
  5. <?php _e( ‘Howdy, %s!’, $username ); ?>

182.User Level 10 converts to _________?

Answers:

  1. Contributor
  2. Author
  3. Editor
  4. Subscriber
  5. Administrator

183.Which of the following snippets disable depreciated warnings in WordPress like this one ?
«Deprecated: Assigning the return value of new by reference is deprecated in /home//public_html/hub/wp-settings.php on line 647»

Answers:

  1. define(E_DEPRECATED, false);
  2. error_reporting(E_ALL ^ E_DEPRECATED);
  3. define(E_NOTICE, false);
  4. error_reporting(WP_DEBUG, true)
  5. Administrator

184.Select all the default post types in WordPress.

Answers:

  1. post
  2. page
  3. attachment
  4. revision
  5. nav_menu_item

185.Which of the following is the correct way for enabling support for Post Thumbnails?

Answers:

  1. add_theme_support( ‘thumbnails’ );
  2. add_support( ‘post-thumbnails’ );
  3. add_theme_support( ‘post-thumbnails’ );
  4. theme_support( ‘thumbnails’ );

186.Which function(s) can be used to programatically create a new user in WordPress?

Answers:

  1. wp_update_user
  2. wp_create_user
  3. register_new_user
  4. wp_insert_user

187.Which function(s) can be used to programatically create a new user in WordPress?

Answers:

  1. Blogger
  2. Author
  3. Subscriber
  4. Contributor