MySQL Basics: Key Concepts Explained
MySQL Basics: Key Concepts Explained
1. What is MySQL?
a) An operating system
b) A relational database management system (RDBMS)
c) A programming language
d) A web server
View Answer
Answer: b
Explanation: MySQL is a relational database management system (RDBMS) used for managing
and storing data.
Answer: b
Explanation: “MySQL” stands for “My Structured Query Language,” combining “My,” the co-
founder’s daughter’s name, with SQL (Structured Query Language).
Answer: a
Explanation: MySQL was originally developed by MySQL AB, a Swedish company.
Answer: c
Explanation: MySQL is a ‘relational’ DBMS. It is efficient at relating data in two different tables
and joining information from them. Hierarchical and Network DBMS are based on parent-child
relationships of records. Object-oriented DBMS use objects to represent models.
5. Which of the following best describes the purpose of MySQL?
a) To store and retrieve data
b) To create user interfaces
c) To build websites
d) To manage file systems
View Answer
Answer: a
Explanation: MySQL is used to store and retrieve data in structured formats through SQL
queries.
Answer: c
Explanation: MySQL uses SQL (Structured Query Language) to interact with the database.
Answer: a
Explanation: MySQL uses client-server architecture. The MySQL server program runs on the
machine where databases are stored. SQL is a query language used for querying the tables and
information retrieval.
Answer: a
Explanation: MySQL is commonly used as the database in the LAMP stack (Linux, Apache,
MySQL, PHP/Perl/Python).
9. How are identifiers quoted in MySQL?
a) double quotes
b) backticks
c) can’t be quoted
d) single quotes
View Answer
Answer: b
Explanation: An identifier is quoted within the backtick characters ‘`’. This allows use of any
character except a byte with value 0 or 255. Single quotes and double quotes are not allowed
when quoting identifier names.
Answer: c
Explanation: Column names and indexes are not case sensitive on any platform and neither are
column aliases. Unlike the standard SQL, the names of the log file groups are always case
sensitive.
a) database name
b) row name
c) table name
d) column name
View Answer
Answer: c
Explanation: The SELECT clause is used to retrieve information from some specified tables. It
follows a specified format for information retrieval. Here, ‘abc’ can be a column name. It must
be present in the table ‘xyz’.
12. Which storage engine enables to access tables from a MySQL server managed by another
server?
a) MyISAM
b) FEDERATED
c) EXAMPLE
d) InnoDB
View Answer
Answer: b
Explanation: There are many storage engines that are used in MySQL. By default, MyISAM is
used as the storage engine unless specified otherwise. FEDERATED enables access to a foreign
MySQL server.
13. What is data in a MySQL database organized into?
a) Tables
b) Networks
c) Objects
d) File systems
View Answer
Answer: a
Explanation: Since MySQL is an RDBMS, its data is organized in tables for establishing
relationships. A table is a collection of rows and columns, where each row is a record and
columns describe the features of records.
Answer: b
Explanation: The operator ‘DIV’ is used to perform integer divisions in MySQL. ‘//’ is used in
languages like Python to do the same. The operator ‘/’ performs floating point divisions and ‘\’
facilitates escape sequences.
15. Which of the following options tells MySQL to ask for entering the password?
a) -u
b) -p
c) -h
d) -e
View Answer
Answer: b
Explanation: The command ‘mysql -p’ (alternative form: –password) prompts for the password.
‘-h’ (alternative form: –host) specifies the host where the MySQL server is running. ‘-u’ is for
specifying the username.
16. Which statement can be used to specify the sql_mode system variable at runtime?
a) ASSIGN
b) SET
c) CHANGE
d) SPECIFY
View Answer
Answer: b
Explanation: The ‘SET’ statement can change the SQL mode at runtime. For example, the
statement SET sql_mode = ‘ANSI_QUOTES’ can be used by a client in its own session-specific
SQL mode.
17. The command to move the cursor to the beginning of line in MySQL input editor is?
a) Ctrl-E
b) Ctrl-A
c) Ctrl-D
d) Esc-a
View Answer
Answer: b
Explanation: Control-A moves the cursor to the beginning of the line. Ctrl-E moves the cursor to
the end of the line. Control-D deletes the character under the cursor, whereas Esc-a is not valid.
Answer: c
Explanation: In MySQL, ‘Views’ are treated a little differently than Oracle, PostgreSQL, and
SybaseSQL since they support materialized views, and MySQL does not use the materialized
view.
a) column name
b) server name
c) database name
d) table name
View Answer
Answer: d
Explanation: The ‘DELETE’ operation is being performed in the statement. The table names are
‘x’ and ‘y’. The column name is ‘col’. The rows from the left join of x and y get deleted
according to the condition given.
20. Which command is used for taking “server side help” in MySQL command line tool?
a) /h
b) /c
c) /e
d) None of the mentioned
View Answer
Answer: a
Explanation: /h represents help contents for MySQL.
21. What is the role of “CONSTRAINTS” in defining a table in MySQL?
a) Declaring Foreign Key
b) Declaring primary key
c) Restrictions on columns
d) All of the mentioned
View Answer
Answer: d
Explanation: Constraints are used to apply various restrictions and define key attributes on
columns when designing a table, such as primary key, foreign key, and other conditions.
Answer: c
Explanation: The ‘FROM’ clause in SQL specifies the table from which to retrieve data in a
SELECT statement.
23. Which data type is used to store data and time in MySQL?
a) Temporal data type
b) Char/Varchar
c) Text data type
d) Numeric data type
View Answer
Answer: a
Explanation: Temporal data types are used for storing Date, Time, Timestamp, or Datetime in
MySQL.
CREATE TRIGGER abc (...) (...) ON def FOR EACH ROW ghi;
a) trigger name
b) table name
c) trigger statement
d) update statement
View Answer
Answer: b
Explanation: The trigger creation construct in MySQL is the ‘CREATE TRIGGER’ construct. It
specifies components like the trigger name, the type of statement for which it is activated, and
the table name and statement.
25. To check how MySQL would execute a SELECT query, which statement is used?
a) EXPLAIN
b) SHOW
c) DISPLAY
d) TELL
View Answer
Answer: a
Explanation: In MySQL, by issuing an EXPLAIN statement, MySQL displays some information
about how it would execute a SELECT query without actually executing it. It is prefixed with the
query.
26. Which of the following are the valid “database datatypes” in MySQL?
a) Temporal
b) Numerical
c) All of the mentioned
d) Text
View Answer
Answer: c
Explanation: None.
27. What is the meaning of “EMPTY SET” in the following MySQL command?
a) Access denied
b) No values
c) Error
d) None of the mentioned
View Answer
Answer: b
Explanation: “EMPTY SET” means there were no values stored in the structure that belongs to
lname.
Answer: d
Explanation: mysql_upgrade is used after a MySQL upgrade operation. It checks tables for
incompatibilities and repairs them if necessary. It updates the grant tables with any changes that
have been made in newer versions of MySQL.
29. Which of the following can be used interchangeably with MYSQL_VERSION_ID?
a) MYSQL_VERSION_ID
b) MYSQL_ID
c) LIBMYSQL_VERSION
d) LIBMYSQL_VERSION_ID
View Answer
Answer: d
Explanation: The ‘LIBMYSQL_VERSION’ and ‘LIBMYSQL_VERSION_ID’ macros have the
same values as ‘MYSQL_SERVER_VERSION’ and ‘MYSQL_VERSION_ID,’ and the two sets
of macros can be used interchangeably.
30. Which mode prevents MySQL from performing a full check of date parts?
a) ALLOW_DATES_INVALID
b) STOP_DATES_CHECK
c) PREVENT_DATE_CHECK
d) ALLOW_INVALID_DATES
View Answer
Answer: d
Explanation: In MySQL, it is also possible to selectively weaken the strict mode in some places.
If the ALLOW_INVALID_DATES SQL mode is enabled, MySQL doesn’t perform full
checking of the date parts.
Answer: c
Explanation: For index processing, ‘MyISAM’ manages its own key cache, which is the most
important configurable resource for the MyISAM storage engine. It is used for index-based
retrievals and sorts.
Answer: a
Explanation: The in-place upgrade involves shutting down the old MySQL version, replacing the
old MySQL binaries or packages with the new ones, restarting MySQL on the existing data
directory, and running mysql_upgrade.
33. What enables read and execute access to all users outside of the MySQL group?
a) drwxrwxr-x
b) drwxrwxr-y
c) drwyrwyr-y
d) drwyrwyr-x
View Answer
Answer: a
Explanation: Some database directories have the proper permissions like ‘drwx’, which enables
read, write, and execute access to the owner but no access to anyone else. Other directories have
an overly permissive access mode like ‘drwxrwxr-x’.
Answer: b
Explanation: The server, mysqld, is the hub of a MySQL installation; it performs all
manipulation of databases and tables. On Unix, several related scripts are available to assist in
server startup.
35. Where does MySQL Enterprise Backup record details of each backup?
a) backup_history
b) backlog_history
c) history_backup
d) history_backlog
View Answer
Answer: a
Explanation: The restored data includes the ‘backup_history’ table, where ‘MySQL Enterprise
Backup’ records details of each backup. This table allows for future incremental backups using
‘–incremental-base=history:last_backup’.
Answer: c
Explanation: ADD is not an aggregate function. MySQL aggregate functions include COUNT,
MAX, MIN, AVG, and SUM.
37. Which classes do spatial data types in MySQL correspond to?
a) ClosedGIS
b) ClosedGSS
c) OpenGIS
d) OpenGSS
View Answer
Answer: c
Explanation: MySQL has spatial data types that correspond to OpenGIS classes. Some of them
that hold single geometry values are ‘GEOMETRY’, ‘POINT’, ‘LINESTRING,’ and
‘POLYGON’. Some can hold a collection of values.
Answer: b
Explanation: ‘mysql_fetch_row()’ returns a MYSQL_ROW value, a pointer to an array of
values. If the return value is assigned to a variable named row, each value within the row is
accessed as row[i].
Answer: c
Explanation: None.
40. Which MySQL clause is used to combine rows from two or more tables?
a) JOIN
b) COMBINE
c) MERGE
d) UNION
View Answer
Answer: a
Explanation: The JOIN clause is used to combine rows from multiple tables based on a related
column.
41. What will be the result of the following MySQL command?
SELECT emp_id,
‘ACTIVE’ AS STATUS,
emp_id * 3.14 AS emp_pi,
UPPER (lname) AS last_name
FROM employee;
Answer: b
Explanation: Status, emp_pi, last_name are “column aliases” and Keyword “AS” is optional.
42. What will be the output of the following MySQL statement “true AND Null”?
a) Null
b) True
c) None of the mentioned
d) Depend
View Answer
Answer: a
Explanation: None.
Answer: b
Explanation: “WHERE” is also used to filter the row values in MySQL.
44. Which of the following MySQL data types can hold large amounts of data such as text?
a) INT
b) ENUM
c) BLOB
d) VARCHAR
View Answer
Answer: c
Explanation: BLOB (Binary Large Object) is a data type in MySQL that can hold large amounts
of binary data, such as images or videos.
45. What does the function mysql_num_rows() return?
a) A pointer to the result set
b) The number of rows in a result set
c) The current row in a result set
d) The number of columns in a result set
View Answer
Answer: b
Explanation: The function mysql_num_rows() returns the number of rows in the result set.
46. What will be the order of sorting in the following MySQL statement?
Answer: c
Explanation: In the query, first “emp_id” will be sorted, then “emp_name” with respect to
“emp_id.”
Answer: a
Explanation: mysql_fetch_assoc() returns an associative array where the keys are the column
names.
48. Which privileges are required on the source server to use mysqldbcopy?
a) UPDATE
b) CREATE
c) SELECT
d) INSERT
View Answer
Answer: c
Explanation: To use the utility program ‘mysqldbcopy’, the user must have SELECT privileges
for the database(s) on the source server and have CREATE, INSERT, and UPDATE on the
destination server.
SQL
Answer: a
Explanation: SQL stands for Structured Query Language. It is a domain-specific language used
to manage and manipulate relational databases. SQL provides a standardized way to interact with
databases, enabling users to perform tasks such as querying, updating, and managing the
structure of databases.
Answer: d
Explanation: In SQL, “INCLUDE” is not a valid keyword. The correct keywords are:
“INCLUDE” is not a standard SQL keyword. SQL keywords are reserved words that have
specific meanings in the language, and “INCLUDE” is not recognized as one of them in standard
SQL syntax.
Answer: c
Explanation: The <> operator in SQL is used to compare two values for inequality. It checks if
the values on both sides are different.
4. What is the purpose of the SQL keyword “DISTINCT” in a SELECT statement?
a) To retrieve unique values from a column
b) To filter NULL values
c) To delete duplicate records
d) To sort the result set
View Answer
Answer: a
Explanation: The DISTINCT keyword is used to retrieve unique values from a specified column
in a SELECT query.
Answer: b
Explanation: SQL is not primarily designed for writing complex algorithms for data analysis.
Other languages like Python or R are more suitable for this task.
Answer: c
Explanation: RDBMS is the basis for SQL, and for all modern database systems such as MS
SQL Server, IBM DB2, Oracle, MySQL and Microsoft Access.
Answer: d
Explanation: A SQL statement begins with a SQL keyword and ends with a semicolon. Using
semicolon is the standard way to separate each SQL statement in database systems.
8. Which statement(s) are mandatory in a simple SQL SELECT statement?
a) Select, From
b) Select, OrderBy
c) Select, Where
d) Select, GroupBy
View Answer
Answer: a
Explanation: From statement contains the table name from which the required columns are to be
retrieved. So it is necessary along with Select statement, whereas others are optional.
Answer: c
Explanation: Inner join Selects records that have matching values in both the tables. It’s the
default join type, so if we just type JOIN without specifying any other conditions, an INNER
JOIN will be used.
Answer: b
Explanation: The CREATE command is used to create a database in SQL. The same command
can be used to create a table within the database. The INSERT command is used to insert data
inside the tables.
Answer: d
Explanation: In SQL, we can insert and delete rows in a view. We can perform insert and update
in an updatable view only. Read-only views are not updatable.
12. What is the full form of PL in PL/SQL?
a) Programming Language
b) Programming Logic
c) Procedural Language
d) Procedural Logic
View Answer
Answer: c
Explanation: PL in PL/SQL stands for Procedural Language. It is a block structured language
that enables developers to combine the power of SQL with procedural language.
Answer: a
Explanation: A trigger is automatically executed by the Oracle server whenever a specified event
occurs. A user can create and store a trigger and specify when to execute it but the its execution
is done by the server automatically.
14. Which of the following SQL statement selects only unique values from ‘section’ column of
table ‘school’?
a) SELECT section FROM school;
b) SELECT DISTINCT section FROM school;
c) SELECT * FROM school;
d) SELECT ALL section FROM school;
View Answer
Answer: b
Explanation: Distinct keyword along with Select clause returns only distinct values. All keyword
when used with select clause returns all values without eliminating the duplicates. * Results all
the fields of a table without eliminating duplicates.
15. Which SQL keyword is used to sort the data returned by a SELECT statement?
a) Group
b) Order
c) Group By
d) Order By
View Answer
Answer: d
Explanation: Order By clause is used to sort the retrieved data in ascending or descending order.
Group By clause is used to group the result-set by one or more columns. Order and Group are
not valid SQL commands.
16. The SQL LIKE operator is used in which of the following clause?
a) Having
b) Select
c) Where
d) Group by
View Answer
Answer: c
Explanation: The SQL LIKE operator is used in a WHERE clause to search for a specified
pattern in a column.
Answer: a
Explanation: Microsoft’s SQL Server is a relational database management system (RDBMS). It
was created largely to compete with the MySQL and Oracle databases. The standard SQL
(Structured Query Language) language, ANSI SQL is supported by SQL Server. SQL Server is a
highly secure server and does not allow any database file manipulation during the execution
process.
Answer: c
Explanation: Microsoft released its first version of SQL Server in the year of 1988. This version
was developed jointly by Microsoft and Sybase for the OS/2 platform.
3. Which of the following is a free database software running free SQL Server technology?
a) SQL Server Web
b) SQL Server Enterprise
c) SQL Server Workgroup
d) SQL Server Express
View Answer
Answer: d
Explanation: SQL Server Express Edition is a scaled down, free edition of SQL Server, which
includes the core database engine.
4. Which of the following companies originally worked together to create and market the first
version of SQL Server?
a) Sybase
b) Ashton-Tate
c) Microsoft
d) All of the Mentioned
View Answer
Answer: d
Explanation: First version of SQL Server was designed for the OS/2 platform and was developed
jointly by Microsoft and Sybase along with Ashton-Tate.
Answer: b
Explanation: Codenames for SQL Server 2005, 2008, 2008 R2, 2012, 2014 are Yukon, Katmai,
Kilimanjaro, Denali and Hekaton respectively.
advertisement
ADVERTISEMENT
6. Which was the first version of SQL Server to introduce in-memory capability?
a) SQL Server 2005
b) SQL Server 2008
c) SQL Server 2012
d) SQL Server 2014
View Answer
Answer: d
Explanation: SQL Server 2014 provides a new in-memory capability for tables that can fit
entirely in memory (also known as Hekaton).
7. Which of the following data type is not present in SQL Server?
a) geography
b) hierarchyid
c) boolean
d) bit
View Answer
Answer: c
Explanation: SQL Server doesn’t have a Boolean data type, at least not by that name. To store
True/False, Yes/No, and On/Off values, use the bit data type. It accepts only three values: 0, 1,
and NULL.
8. Which database is used by SQL Server Agent for scheduling alerts and jobs, and recording
operators?
a) temp
b) model
c) msdb
d) master
View Answer
Answer: c
Explanation: MSDB Database stores information related to database backups, DTS packages,
Replication, SQL Agent information, SQL Server jobs.
Answer: d
Explanation: In SQL Server we have two types of views-System Defined Views and User
Defined Views.
Answer: a
Explanation: The INFORMATION_SCHEMA views allow you to retrieve metadata about the
objects within a database. These views can be found in the master database under Views /
System Views and be called from any database in your SQL Server instance.
11. Which of the following joins are SQL server default?
a) Inner
b) Equi
c) Outer
d) None of the Mentioned
View Answer
Answer: a
Explanation: SQL inner joins are the default joins in SQL Server. Inner query joins only the rows
that are matching.
Answer: d
Explanation: In SQL Server, NOT NULL specifies that the column does not accept NULL
values.
13. Which of the reasons will force you to use the XML data model in SQL Server?
a) Order is inherent in your data
b) Your data is sparse or you do not know the structure of the data
c) Your data represents containment hierarchy
d) All of the Mentioned
View Answer
Answer: d
Explanation: In SQL Server, the XML data model is a good choice if you want a platform-
independent model in order to ensure the portability of the data by using structural and semantic
markup.
Answer: c
Explanation: Hybrid model may yield better performance in that you have more control over the
indexes created on the relational columns and locking characteristics.
15. Which of the following feature of SQL Server was used before XML technology for semi
structured data?
a) In memory database
b) Stored Procedure
c) Dynamic management views
d) None of the mentioned
View Answer
Answer: b
Explanation: You need to create a stored procedure to process incoming XML from a partner
before SQL Server 2005.
16. Which of the following language is used for procedural flow in SQL Server?
a) Control-of-flow language
b) Flow language
c) Control language
d) None of the mentioned
View Answer
Answer: a
Explanation: Transact-SQL provides special words called control-of-flow language that control
the flow of execution of Transact-SQL statements in SQL Server.
Answer: c
Explanation: Exception handling is possible in SQL Server using THROW. It generates an error
message and initiates error processing for the session.
18. Which of the following stored procedure is already defined in SQL Server?
a) System defined Procedure
b) CLR Stored Procedure
c) Extended Procedure
d) User Defined Stored Procedure
View Answer
Answer: a
Explanation: System defined Procedure is already defined in SQL Server. System defined
Procedure procedure starts with the sp_ prefix.
19. DML triggers in SQL Server is applicable to _____________
a) Update
b) Delete
c) Insert
d) All of the mentioned
View Answer
Answer: d
Explanation: In SQL Server we can create triggers on DML statements (like INSERT, UPDATE,
and DELETE) and stored procedures that perform DML-like operations.
Answer: d
Explanation: SQL Server user-defined functions are routines that accept parameters, perform an
action, such as a complex calculation, and return the result of that action as a value.
21. Which of the stored procedure is used to test the SQL injection attack?
a) xp_reg
b) xp_write
c) xp_regwrite
d) all of the mentioned
View Answer
Answer: c
Explanation: xp_regwrite writes an arbitrary value into the Registry (undocumented extended
procedure) and it is used to test the SQL injection attack.
22. Which is the default field terminator for bulk insert in SQL Server?
a) Brackets
b) Parenthesis
c) Full stop
d) Comma
View Answer
Answer: d
Explanation: In SQL Server, Field Terminator is used to delimit columns in the source file.
There are some cases where I have seen “|” also. “,” can be part of Name. So in that case the bulk
insert may fail.
23. Which of the following is the main feature of dotConnect for SQL Server?
a) Supports the latest versions of SQL Server
b) Extra data binding capabilities
c) Ability of monitoring query execution
d) All of the mentioned
View Answer
Answer: d
Explanation: dotConnect for SQL Server includes base-class-based provider model, provider
factories, connection string builder, metadata schemas, asynchronous commands, pooling
enhancements, batch update support, provider-specific types, server enumeration, database
change notification support and so on.
24. Which of the following is used to overcome the Replication in SQL Server?
a) Availability problems
b) Maintenance problems
c) Performance problems
d) All of the mentioned
View Answer
Answer: d
Explanation: Replication allows us to maintain the same database with multiple copies at
different locations.
25. When you _______ an Access table from a SQL Server, SSMA restores the original Access
table and its data.
a) unlink
b) import
c) link
d) all of the mentioned
View Answer
Answer: a
Explanation: If you have linked the Access tables to one SQL Server instance, and then you want
to change the links to another instance, you must relink the tables.
26. Which of the following SQL Server tools is used to enhance data management and
governance?
a) SSDT
b) OBEII
c) SSIT
d) All of the mentioned
View Answer
Answer: a
Explanation: SSDT stands for SQL Server Data Tools and is available for data management and
quality.
27. Backing up your SQL Server database is essential for _______ your data.
a) replication
b) protecting
c) preventing
d) none of the mentioned
View Answer
Answer: b
Explanation: SQL Server offers many options for creating backups.
28. Which of the following is the instance of SQL Server that is your production server in log
shipping?
a) secondary server
b) primary server
c) secondary database
d) primary database
View Answer
Answer: b
Explanation: Once the monitor server has been configured, it cannot be changed without
removing log shipping first.
Answer: d
Explanation: Database mirroring is a solution for increasing the availability of a SQL Server
database. Mirroring is implemented on a per-database basis and works only with databases that
use the full recovery model.
30. Which of the following is the biggest disadvantage of SQL Server Authentication mode?
a) Allows SQL Server to support Web-based applications where users create their own identities
b) Allows SQL Server to support older applications and applications provided by third parties
that require SQL Server Authentication
c) SQL Server Authentication cannot use Kerberos security protocol
d) None of the mentioned
View Answer
Answer: c
Explanation: Windows Authentication uses Kerberos security protocol.
31. Which of the following operation requires to run the SQL Server Setup on the node?
a) Update
b) Add
c) Remove
d) All of the mentioned
View Answer
Answer: d
Explanation: To update or remove a SQL Server failover cluster, you must be a local
administrator with permission to login as a service on all nodes of the failover cluster.
32. Which of the following tool is used for purpose of data auditing for SQL Server only?
a) Idera
b) ApexSQL
c) SQL Ninja
d) SQL Audit
View Answer
Answer: b
Explanation: ApexSQL Audit is a tool for auditing SQL Server data changes specifically for
Microsoft SQL Server.
Answer: d
Explanation: Microsoft SQL Server Profiler is a graphical user interface to SQL Trace for
monitoring an instance of the Database Engine or Analysis Services.
34. Which of the following catalog view is used for SQL Server Extended Events?
a) sys.server_event_session_actions
b) sys.server_sessions
c) sys.server_event_sess
d) all of the mentioned
View Answer
Answer: a
Explanation: sys.server_event_session_actions returns a row for each action on each event of an
event session.
Cloud Computing MCQ
1. What is Cloud Computing?
a) Cloud Computing means providing services like storage, servers, database, networking, etc
b) Cloud Computing means storing data in a database
c) Cloud Computing is a tool used to create an application
d) None of the mentioned
View Answer
Answer: a
Explanation: Cloud computing means providing services like storage, servers, database,
networking, etc. over the internet without the user managing it directly. The data stored can be
accessed by an authorized user anywhere anytime provided the user must have an internet
connection and a device.
Answer: c
Explanation: In the 1960s J.C.R. Licklider wanted to connect people and share data anytime
from anywhere, hence he invented Cloud Computing.
Answer: d
Explanation: In Public Servers the users share the hardware, storage, and networks. Private
Servers provide high security to the data stored through firewalls and internal hosting. Also, in
the private cloud, the user can customize their servers with add-ons. In Dedicated Servers, the
server completely belongs to a particular organization or a company.
Answer: d
Explanation: One of the important features is security, the data stored is secured and cannot be
accessed by unauthorized parties. In case the user exhausts the storage space allocated, the user
can buy extra storage for a less amount. The data stored can be accessed by any authorized user
anywhere anytime provided the user must have an internet connection and a device.
5. Which of the following is a type of cloud computing service?
a) Service-as-a-Software (SaaS)
b) Software-and-a-Server (SaaS)
c) Software-as-a-Service (SaaS)
d) Software-as-a-Server (SaaS)
View Answer
Answer: c
Explanation: Software as a Service, is the most widely used choice for enterprises. SaaS makes
use of the internet to offer apps to consumers that are controlled by a third-party vendor.
advertisement
ADVERTISEMENT
Answer: d
Explanation: Adobe Creative Cloud is used in the art sector. Paypal is an online payment
application. Google G Suite is the best storage and backup application used by google.
Answer: d
Explanation: Amazon Web Services (AWS), Dropbox, and Cisco WebEx are examples of cloud.
8. Applications and services that run on a distributed network using virtualized resources is
known as ___________
a) Parallel computing
b) Soft computing
c) Distributed computing
d) Cloud computing
View Answer
Answer: d
Explanation: Cloud computing refers to the delivery of services such as storage, servers,
databases, networking, and other functions through the internet without the need for the user to
manage them directly. These applications are accessed by common Internet protocols and
networking standards.
9. Which of the following is an example of a PaaS cloud service?
a) Heroku
b) AWS Elastic Beanstalk
c) Windows Azure
d) All of the above
View Answer
Answer: d
Explanation: PaaS stands for Platform-as-a-Service. In PaaS, the users receive hardware or
software tools from the users on the internet. AWS Elastic Beanstalk, Windows Azure, Heroku
are example of a PaaS service.
Answer: d
Explanation: IaaS stands for Infrastructure-as-a-Service. In IaaS, the users receive computing
resources like software or hardware tools virtually over the internet. DigitalOcean, Linode,
Rackspace are the example of an IaaS service.
11. Which of the following is the correct statement about cloud computing?
a) Cloud computing abstracts systems by pooling and sharing resources
b) Cloud computing is nothing more than the Internet
c) The use of the word “cloud” makes reference to the two essential concepts
d) All of the mentioned
View Answer
Answer: a
Explanation: Abstraction and Virtualization are the two essential concepts.
Answer: c
Explanation: Google has built mega data centres for its search engine.
13. Which of the following model attempts to categorize a cloud network based on four
dimensional factors?
a) Cloud Cube
b) Cloud Square
c) Cloud Service
d) All of the mentioned
View Answer
Answer: a
Explanation: Cloud Cube model is mainly used for secure collaboration.
14. Which of the following is the correct statement about cloud types?
a) Cloud Square Model is meant to show is that the traditional notion of a network boundary
being the network’s firewall no longer applies in cloud computing
b) A deployment model defines the purpose of the cloud and the nature of how the cloud is
located
c) Service model defines the purpose of the cloud and the nature of how the cloud is located
d) All of the mentioned
View Answer
Answer: b
Explanation: Four types of deployment models exist.
Answer: a
Explanation: The cloud creates a system where resources can be pooled and partitioned as
needed.
16. All cloud computing applications suffer from the inherent _______ that is intrinsic in their
WAN connectivity.
a) noise
b) propagation
c) latency
d) all of the mentioned
View Answer
Answer: c
Explanation: While cloud computing applications excel at large-scale processing tasks, if your
application needs large amounts of data transfer, it may not be the best model for you.
17. Which of the following architectural standards is working with cloud computing industry?
a) Web-application frameworks
b) Service-oriented architecture
c) Standardized Web services
d) All of the mentioned
View Answer
Answer: b
Explanation: These standards help to enable different business models that cloud computing
vendors can support, most notably Software as a Service (SaaS), Web 2.0 applications, and
utility computing.
18. Which of the following is the correct statement?
a) Cloud computing presents new opportunities to users and developers
b) Service Level Agreements (SLAs) is small aspect of cloud computing
c) Cloud computing does not have impact on software licensing
d) All of the mentioned
View Answer
Answer: a
Explanation: Because it is based on the paradigm of a shared multi-tenant utility.
19. What is the correct formula to calculate the cost of a cloud computing deployment?
a) CostCLOUD = Σ(UnitCostCLOUD / (Revenue + CostCLOUD))
b) CostCLOUD = Σ(UnitCostCLOUD / (Revenue – CostCLOUD))
c) CostCLOUD = Σ(UnitCostCLOUD x (Revenue – CostCLOUD))
d) None of the mentioned
View Answer
Answer: b
Explanation: Unit cost is usually defined as the cost of a machine instance per hour or another
resource.
20. Which of the following is the wrong statement about cloud computing?
a) Private cloud doesn’t employ the same level of virtualization
b) Data center operates under average loads
c) Private cloud doesn’t pooling of resources that a cloud computing provider can achieve
d) Abstraction enables the key benefit of cloud computing: shared, ubiquitous access
View Answer
Answer: a
Explanation: Capacity of the datacenter is fixed by the assets it has.
Answer: d
Explanation: Many of these protocols are standard Internet protocols.
Answer: b
Explanation: Microsoft’s [Link] Data Services Framework is another system for transferring
data using a RESTful transaction and standard HTTP commands.
Answer: d
Explanation: When applied to a number of users in a cloud computing system, these
requirements describe systems that must provision identities.
25. Cloud computing is a concept that involves pooling physical resources and offering them as
which sort of resource?
a) cloud
b) real
c) virtual
d) none of the mentioned
View Answer
Answer: c
Explanation: Cloud computing means providing services like storage, servers, database,
networking, etc. over the internet. It is a new model for provisioning resources, for staging
applications, and for platform-independent user access to services.
Answer: a
Explanation: Amazon Web Services (AWS), an Infrastructure as a Service (IaaS) offering that
allows users to rent virtual machines on Amazon’s own infrastructure, is one of the most
successful cloud-based enterprises.
27. Into which expenditures does Cloud computing shifts capital expenditures?
a) local
b) operating
c) service
d) none of the mentioned
View Answer
Answer: b
Explanation: The nature of the service provider and its connection with its client is changing as a
result of cloud computing.
Answer: c
Explanation: Cloud computing is differentiated by the idea that resources are virtual and infinite,
and that the user is shielded from the specifics of the actual infrastructure on which software
operates.
29. Which of the following is the most essential element in cloud computing by CSA?
a) Virtualization
b) Multi-tenancy
c) Identity and access management
d) All of the mentioned
View Answer
Answer: b
Explanation: Multi-tenancy refers to hosting shared among multiple customers. Multi-tenancy
introduces a variety of new security problems to cloud computing that must be addressed.
30. Which of the following monitors the performance of the major cloud-based services in real
time in Cloud Commons?
a) CloudWatch
b) CloudSensor
c) CloudMetrics
d) All of the mentioned
View Answer
Answer: b
Explanation: The Cloud Commons is a new online community founded by CA to promote
information exchange on cloud service and the SMI standard.
31. Which of the following model consists of the service that you can access on a cloud
computing platform?
a) Deployment
b) Service
c) Application
d) None of the mentioned
View Answer
Answer: b
Explanation: The sort of service that the service provider provides is described by the service
model. Three types of service provided are:
1) Platform-as-a-Service
2) Software-as-a-Service
3) Infrastructure-as-a-Service
32. Which of the following is the most important area of concern in cloud computing?
a) Scalability
b) Storage
c) Security
d) All of the mentioned
View Answer
Answer: c
Explanation: When your data goes to and is stored on systems that are no longer under your
control, you run the risk of it being intercepted or misused by outsiders. Only an authorized user
can access the save data.
33. Which of the following is the most refined and restrictive cloud service model?
a) PaaS
b) IaaS
c) SaaS
d) CaaS
View Answer
Answer: a
Explanation: The most refined and restrictive service model is when a service needs the client to
use the entire hardware/software/application stack.
Answer: b
Explanation: Virtualization is achieved by creating a virtual environment of storage devices and
server operating systems. Composability is the ability to build applications from component
parts.
35. How many phases are there in Cloud Computing Planning?
a) 1
b) 5
c) 3
d) 6
View Answer
Answer: c
Explanation: Strategy Phase, Planning Phase, and Deployment Phase are the three phases of
Cloud Planning.
Answer: d
Explanation: SaaS stands for Software-as-a-Service. In SaaS, the provider hosts the application
and is made available to the users. Google Workspace, Dropbox, Salesforce are examples of an
IaaS service.
Answer: a
Explanation: The abstraction layer abstracts and controls resources using a reference object,
making it easier for users to transfer programs to multiple clouds. The details of system
implementation from users and developers are abstracted by Cloud computing.
38. In which of the following service models the hardware is virtualized in the cloud?
a) NaaS
b) PaaS
c) CaaS
d) IaaS
View Answer
Answer: d
Explanation: Infrastructure-as-a-Service (IaaS) is an acronym for Infrastructure-as-a-Service.
Users of IaaS get computer resources such as software or hardware tools through the internet. In
this model, the service vendor owns the equipment: servers, storage, network infrastructure, and
so forth.
39. Which of the following is the Virtual machine conversion cloud?
a) Amazon CloudWatch
b) AbiCloud
c) BMC Cloud Computing Initiative
d) None of the mentioned
View Answer
Answer: c
Explanation: BMC Cloud Computing Initiative is used for Cloud planning, lifecycle
management, optimization, and guidance.
40. Which of the following is a workflow control and policy based automation service by CA?
a) CA Cloud Compose
b) CA Cloud Insight
c) CA Cloud Optimize
d) CA Cloud Orchestrate
View Answer
Answer: d
Explanation: CA Cloud Orchestrate service is workflow control and policy-based automation
tool. It automates IT processes for cloud deployments, including provisioning and configuration
of infrastructure and applications, management of cloud resources, orchestration of workflows
across hybrid and multi-cloud environments, and compliance enforcement through policy-based
automation..
41. An application that provides for transaction overflow in a reservation system is an example
of ____________
a) cloud bursting
b) cloud provisioning
c) cloud servicing
d) all of the mentioned
View Answer
Answer: a
Explanation: Most systems built to perform cloud bursting have a simple underlying design.
Answer: c
Explanation: The HTML tag <a> is used to create a hyperlink, which is a link to another web
page or resource. The <a> tag has two main attributes: href and target. The href attribute
specifies the URL of the linked resource, while the target attribute specifies whether the link
should open in a new browser window or tab.
Answer: b
Explanation: There are web components in HTML related technology which makes it possible to
essentially create and use custom elements as if it were regular HTML. You can also create
custom versions of standard HTML elements. Some of the elements are <shadow>, <content>,
<element>, <template>, <slot>.
advertisement
4. Which of the following programming languages is commonly used for server-side scripting in
web development?
a) HTML
b) CSS
c) JavaScript
d) PHP
View Answer
Answer: d
Explanation: HTML, CSS, and JavaScript play crucial roles in front-end development, focusing
on the visual aspects of web pages, while PHP serves as the primary language for server-side
scripting. It manages backend tasks such as database interactions, processing user input, and
generating dynamic content.
5. Which of the following is used to read a HTML page and render it?
a) Web server
b) Web matrix
c) Web browser
d) None of the mentioned
View Answer
Answer: c
Explanation: A web browser (commonly referred to as a browser) is a software application for
retrieving, presenting and traversing information resources on the World Wide Web.
6. Which of the following is a popular front-end framework for building user interfaces in
JavaScript?
a) Django
b) Angular
c) Flask
d) [Link]
View Answer
Answer: b
Explanation: Angular is a widely used front-end framework specifically designed for creating
dynamic and interactive user interfaces in JavaScript.
7. What application can one create even before the introduction of HTML5?
a) Forms
b) Browser based games
c) Web applications
d) Mobile applications
View Answer
Answer: a
Explanation: With the help of HTML5 and JavaScript it became possible to create excellent
mobile applications, browser based games, web applications and many more other applications.
Forms were already introduced before HTML5.
Answer: c
Explanation: For opening WebSocket we call WebSocket constructor. The syntax is
var conn=new WebSocket(‘[Link] ‘xmpp’]);
for using secure HTTP connections use https: ,ws: is the new URL scheme for connecting
WebSockets. There is wss: also.
Answer: a
Explanation: Images are also used for better presentation of webpage. Any image can be turned
into a link. Rather than putting text between the opening < a > tag and the closing < /a > tag, you
simply place an image inside these tags.
10. What is DOM?
a) Application programming interface
b) Hierarchy of objects in [Link]
c) Convention for representing and interacting with objects in html documents
d) None of the mentioned
View Answer
Answer: c
Explanation: The Document Object Model (DOM) is a cross-platform and language-independent
convention for representing and interacting with objects in HTML, XHTML, and XML
documents.
Answer: d
Explanation: Tables display information in rows and columns; they are commonly used to
display all manner of data that fits in a grid such as train schedules, television listings, financial
reports, and sports results.
Answer: b
Explanation: While a row is contained inside a < tr > element, each cell is then written inside the
row element using a < td > element which stands for table data. If you are looking at a web page
and want to know whether that page is using a table to control how the data is laid out, you can
always look at the source for that page.
Answer: a
Explanation: By using a <caption> element, rather than just describing the purpose of the table in
a previous or subsequent paragraph, you are directly associating the content of the table with this
description- and this association can be used by screen readers and by applications that process
web pages (such as search engines).
14. What are Forms in web programming?
a) They are matrices on web page
b) They are used to create Table data and its information
c) They allow you to enter data which can be processed to servers
d) They are the information filled by the server-side
View Answer
Answer: c
Explanation: Forms can look a lot like papers or database forms. A form is filled using text
boxes, chechboxes, radiobuttons. For example, applying/order a product from online or it’s a
google search result.
Answer: d
Explanation: Browser gets divided into panes by Frame, with each pane containing a separate
web page. The advantages are that they offer you where you can load and reload single panes
without having to reload the entire contents of the browser window.
Answer: a
Explanation: The <ol> tag is used to create an ordered list in a webpage. Ordered lists are lists
where the items have a specific order or sequence. The items in an ordered list are typically
numbered or lettered.
Answer: c
Explanation: WOFF is font format used in web pages. It was developed in 2009. It is essentially
OpenType or TrueType with compression and additional metadata. The goal is to support font
distribution from the server to client over the network with bandwidth constraints.
18. Which HTML tag is used to create a form?
a) <form>
b) <input>
c) <select>
d) <textarea>
View Answer
Answer: a
Explanation: The HTML tag used to create a form is <form>. It’s used to define an area where
users can input and submit data on a webpage. Inside the <form> tag, various input elements like
<input>, <select>, and <textarea> are used to collect information from users. When users fill in
the form and submit it, the data is sent to a server for processing or storage.
19. Which of the following property is used to control the space between the border and content
in a table?
a) border
b) padding
c) margin
d) resize
View Answer
Answer: b
Explanation: The padding property is used to control the space between the border and content in
a table.
Example: table{border: 4px solid black;}
20. Which of the following CSS Property controls how an element is positioned?
a) fix
b) set
c) static
d) position
View Answer
Answer: d
Explanation: Controls how an element is positioned. When set to absolute or fixed, the element
is removed completely from the normal flow of the document. When set to relative, the element
is moved relative to its position in the normal flow, but a space is left where it would normally
have been. The default value, static, means the element remains in the normal flow and is not
positioned.
21. Which CSS property can be used to set the image as border instead of the border style?
a) border-image-source
b) background-image-source
c) border-image
d) background-image
View Answer
Answer: a
Explanation: The border-image-source property specifies the path to the image to be used as a
border (instead of the normal border around an element).
22. Which of the following property defines labels for a list of items?
a) list-style-type
b) list-style-image
c) list-stylelist-style-type
d) none of the mentioned
View Answer
Answer: a
Explanation: Syntax:
list-style-type: disc | circle | square | decimal | decimal-leading-zero
23. Which of the following communicates with server-side CGI scripts through HTML form
submissions and can be written without the use of JavaScript?
a) Interactive Web Pages
b) Static Web Pages
c) Conditional Web Pages
d) All web pages
View Answer
Answer: a
Explanation: An interactive web page can dynamically vary its content based on user
preferences. Interactive web pages that communicate with server-side CGI scripts through
HTML form submissions were the original “web application” and can be written without the use
of JavaScript.
Answer: b
Explanation: Modern web applications can dynamically alter their own content without loading a
new document.
Answer: d
Explanation: Web applications based on jQuery use a portable, cross-browser equivalent to
querySelectorAll() named $().
26. Which is the storage that allows the caching of web pages and their associated resources?
a) Offline Web Applications
b) Cookies
c) Web Databases
d) FileSystem API
View Answer
Answer: a
Explanation: HTML5 defines an “Offline Web Applications” API that allows the caching of web
pages and their associated resources (scripts, CSS files, images, and so on). This is client-side
storage for web applications themselves rather than just their data, and it allows web apps to
install themselves so that they are available even when there is no connection to the Internet.
27. When does JavaScript code appear inline within an HTML file?
a) Between or Outside the “script” tag
b) Between the header tag
c) Outside the “script” tag
d) Between the “script” tag
View Answer
Answer: d
Explanation: JavaScript code can appear inline within an HTML file between the “script” tags.
Javascript can also be included from an external file specified by the src attribute of a “script”
tag.
Answer: b
Explanation: Event handlers allow JavaScript code to alter the behavior of windows, of
documents, and of the elements that make up those documents.
Answer: b
Explanation: [Link] is an open-source front-end JavaScript framework for building user
interfaces and single-page applications.
30. Which of the following bootstrap styles can be used to create a default progress bar?
a) .progress, .progress-bar
b) .link-progress-bar
c) .nav-progress
d) All of the mentioned
View Answer
Answer: a
Explanation: A progress bar can be used to display how far along in a process a user is. Progress
bars are available in a variety of styles in Bootstrap. To create a default progress bar, add
a .progress class to a <div> element
Answer: b
Explanation: JavaScript is a scripting language that adds interactivity and behavior to web pages.
It makes web pages more dynamic, responsive, and engaging by handling user input, updating
content dynamically, creating animations, and communicating with servers.
Answer: d
Explanation: React Native is built on a JavaScript based [Link] framework. This is a significant
benefit, given that JavaScript is such a widely used language.
Answer: c
Explanation: Bootstrap grid system has four classes. Xs, sm, md, lg. as is for phones having
screens less than 786px wide, sm is for tablets. Screens equal to or greater than 768px, md is for
small laptops, screen equal to or greater than 992px wide, lg is for laptops and desktops, Screens
equal to or greater than 1200px wide.
Answer: b
Explanation: The function keyword is used to define a function in JavaScript. Functions are
blocks of code that can be used to perform actions. They can take input parameters and return a
value.
Answer: d
Explanation: The width CSS property is used to specify the horizontal width of an element. It is a
dimension property, which means that it can be specified in different units, such as pixels, ems,
or percentages.
JavaScript MCQ
1. What is JavaScript?
a) JavaScript is a scripting language used to make the website interactive
b) JavaScript is an assembly language used to make the website interactive
c) JavaScript is a compiled language used to make the website interactive
d) None of the mentioned
View Answer
Answer: a
Explanation: JavaScript is a scripting language used along with HTML and CSS to make the
website interactive along. It is used both on the client-side and server-side.
Answer: a
Explanation: Although JavaScript is not an OOP (Object-Oriented Programming) language like
Java or PHP, it is object based language. The standard threesome of polymorphism,
encapsulation, and inheritance are the criteria for object orientation, and JavaScript fails to meet
them.
Answer: b
Explanation: A closure is a function that is enclosed with references to its lexical environment. A
closure allows an inner function to access the scope of an outside function. Closures are formed
every time a function is created in JavaScript, during function creation time.
<p id="demo"></p>
var txt1 = "Sanfoundry_";
var txt2 = "Javascriptmcq";
[Link]("demo").innerHTML = txt1 + txt2;
a) error
b) Sanfoundry_ Javascriptmcq
c) undefined
d) Sanfoundry_Javascriptmcq
View Answer
Answer: d
Explanation: The + operator in javascript acts as a concatenation operator when used with string.
The new string does not have any space between the two added strings.
<p id="demo"></p>
<script>
var js = 10;
js *= 5;
[Link]("demo").innerHTML = js;
</script>
a) 10
b) 50
c) 5
d) Error
View Answer
Answer: b
Explanation: The *= operator in javascript is a shorthand expression for the multiplication of a
particular number. It is a combination of two operators * and = .
Answer: a
Explanation: An array in JavaScript is an ordered list of values, each value is referred to as an
element, and it is identified by an index. An array can include values of many sorts and the
length of an array dynamically sized.
a) false
b) true
c) compilation error
d) runtime error
View Answer
Answer: b
Explanation: The == in JS convert different types of operands to the same type before making
the comparison whereas a strict comparison === results in true value if the operands are of the
same type and the contents match.
a) false
b) true
c) compilation error
d) runtime error
View Answer
Answer: a
Explanation: A === operator in JS is only true if the operands are of the same type and the
contents match. Two strings are strictly equal when they have the same sequence of characters,
same length, and same characters in corresponding positions. In this case, we are comparing an
integer and a string so it will be false.
Answer: d
Explanation: For functions expressed as expressions, the function name is optional in Javascript.
Sometimes function expressions are defined and used right away.
Answer: d
Explanation: JavaScript is a dynamic, loosely typed language. Variables in JavaScript aren’t tied
to any specific value type, and each variable can be assigned and reassigned to values of all the
types.
Answer: b
Explanation: The Client-side JavaScript code is embedded within HTML documents in four
ways :
12. What will be the output of the following JavaScript code snippet?
int a=1;
if(a!=null) // JavaScript not equal to Operators
return 1;
else
return 0;
a) 0
b) 1
c) compiler error
d) runtime error
View Answer
Answer: b
Explanation: != is not equal to the operator in Javascript. It gives a value of 1 if the two values
which are compared are not equal and give 0 if the two values are equal.
13. Which of the following object is the main entry point to all client-side JavaScript features
and APIs?
a) Position
b) Window
c) Standard
d) Location
View Answer
Answer: b
Explanation: All client-side JavaScript features and APIs are accessed through the Window
object. It represents a web browser window or frame, and the identifier window can be used to
refer to it.
14. What will be the output of the following JavaScript program?
function sanfoundry(javascript)
{
return (javascript ? “yes” : “no”);
}
bool ans=true;
[Link](sanfoundry(ans));
a) Compilation error
b) Runtime error
c) Yes
d) No
View Answer
Answer: c
Explanation: In javascript, “?” is called the ternary operator which is used for choosing one
choice from the given two choices. It is used instead of if else statement and makes the code
shorter.
a) short
b) 123.56
c) tall
d) 190
View Answer
Answer: a
Explanation: The ternary operator in javascript is used as a comparison operator which works on
three operands. The statement in the above code initializes type variable with the value short
which is returned through the function.
16. Which of the following can be used to call a JavaScript Code Snippet?
a) Function/Method
b) Preprocessor
c) Triggering Event
d) RMI
View Answer
Answer: a
Explanation: A function call to the element on which JavaScript is to be run can be used to
invoke JavaScript code. Other techniques include onclick, onload, and onsubmit, among others.
17. What will be the output of the following JavaScript function?
<p id="demo"></p>
<script>
function javascript()
{
// javacript abs() method
[Link]("demo").innerHTML = [Link](-7.25);
}
</script>
a) -7.25
b) 7.25
c) -7
d) 7
View Answer
Answer: b
Explanation: The javacript abs() method returns the absolute value of a number. The method is
found in the math library of Javascript.
a) 1
b) 10
c) 5
d) Error
View Answer
Answer: a
Explanation: Firstly the interpreter checks obj for property b. But it doesn’t find any property b
so it takes the value from outside the object within the JavaScript code snippet.
19. Which of the following explains correctly what happens when a JavaScript program is
developed on a Unix Machine?
a) will work perfectly well on a Windows Machine
b) will be displayed as JavaScript text on the browser
c) will throw errors and exceptions
d) must be restricted to a Unix Machine only
View Answer
Answer: a
Explanation: Because JS can run on a variety of operating systems, an application written for
UNIX will run just as well on Windows.
20. Which is a more efficient JavaScript code snippet?
Code 1 :
Code 2 :
var num=10;
while(num>=1)
{
[Link](num);
num++;
}
a) Code 1
b) Code 2
c) Both Code 1 and Code 2
d) Cannot Compare
View Answer
Answer: a
Explanation: Code 1 would be more efficient JS code. Infact second code will go into runtime
error as the value of num will never reach less than or equal to one.
function printArray(a)
{
var len = [Link], i = 0;
if (len == 0)
[Link]("Empty Array");
else
{
// do-while loop in javascript
do
{
[Link](a[i]);
} while (++i < len);
}
}
Answer: c
Explanation: The do/while statement creates a loop that executes a block of javascript code once,
before checking if the condition is true, then it will repeat the loop as long as the condition is
true. Hence the iterator traverses through the array and print them in normal order.
22. What happens in the following JavaScript code snippet?
var js = 0;
while (js < 10)
{
[Link](js);
js++;
}
a) An exception is thrown
b) The values of js are logged or stored in a particular location or storage
c) The value of js from 0 to 9 is displayed in the console
d) An error is displayed
View Answer
Answer: c
Explanation: In JavaScript, [Link] is a predefined function that accepts the value as an
argument. At the time of code execution, [Link] prints this value in the argument to the
console.
a) 2
b) 5
c) 555
d) error
View Answer
Answer: c
Explanation: for loop in Javascript first initializes the variable and later on checks for the
condition expression and after that execute the line of statements. The value of iterator i increase
until it reaches the value of length.
Answer: c
Explanation: JavaScript, like most current programming languages, employs lexical scoping.
This means that functions are performed with the variable scope in effect when they were
defined, rather than the variable scope in effect when they are invoked.
25. What is the basic difference between JavaScript and Java?
a) Functions are considered as fields
b) Functions are values, and there is no hard distinction between methods and fields
c) Variables are specific
d) There is no difference
View Answer
Answer: b
Explanation: Java is an object-oriented programming language, while JS is an object-oriented
scripting language. The main difference between JavaScript and Java is that functions are values,
while methods and fields are not clearly defined.
var quiz=[1,2,3];
var js=[6,7,8];
var result=[Link](js);
[Link](result);
a) 1, 2, 3, 6, 7, 8
b) 123
c) 1, 2, 3
d) Error
View Answer
Answer: a
Explanation: concat is a predefined function in the array library in Javascript. The concat
function is used to combine the value of two arrays.
i.e.1, 2, 3, 6, 7, 8
Answer: c
Explanation: For the most part, the JS Engine is used to interpret JavaScript. It’s used to parse
javascript and run it on a web page.
Answer: a
Explanation: The Lexical Environment is an object that is connected with every executing
function, code block, and the script as a whole in JavaScript. The value in scope is returned by
the code snippet above.
int a=0;
for(a;a<5;a++);
[Link](a);
a) 4
b) 5
c) 0
d) error
View Answer
Answer: b
Explanation: The value of a will increase until it equals 5, at which point the cursor will exit the
loop. Because there are no statements in the for loop, the value of a will only increase. As a
result, the result will be five.
30. Which of the following methods/operation does javascript use instead of == and !=?
a) JavaScript uses equalto()
b) JavaScript uses equals() and notequals() instead
c) JavaScript uses bitwise checking
d) JavaScript uses === and !== instead
View Answer
Answer: d
Explanation: The comma operator, bitwise operators, and the ++ and — operators are not
included in the subset. It also forbids the usage of == and!= due to the type conversion they do,
instead requiring the use of === and!==.
31. What will be the result or type of error if p is not defined in the following JavaScript code
snippet?
[Link](p)
32. What is the prototype represents in the following JavaScript code snippet?
a) Not valid
b) Prototype of a function
c) Function javascript
d) A custom constructor
View Answer
Answer: d
Explanation: All object instances have a constructor property that points to the constructor
function that created them. A custom constructor is a constructor which requires no arguments
and is created automatically by the compiler at the time of object creation if not created by the
user.
Answer: a
Explanation: JS code can change the behavior of windows, documents, and the elements that
make up those documents via event handlers.
Answer: b
Explanation: jQuery, which is used in web development, is one of the most popular frameworks.
JavaScript is a scripting language, not a framework, in this case.
35. Which of the following is the property that is triggered in response to JS errors?
a) onclick
b) onerror
c) onmessage
d) onexception
View Answer
Answer: b
Explanation: The Window object’s onerror property acts as an event handler, and it is triggered
when JavaScript problems occur. However, because it is called with various arguments, it isn’t a
genuine event handler.
function compare()
{
let sanfoundry=1;
let javascript="1";
if([Link]()===javascript)
return true;
else
return false;
}
a) runtime error
b) logical error
c) true
d) false
View Answer
Answer: c
Explanation: The toString() function can be used to convert a non-string (integer) to a string.
Only if the operands are of the same type and the contents match, then only the comparison is
true. In this case, both the operands to === operator are strings and have the same value “1”. So,
the result is true.
37. What will be the firstname and surname of the following JavaScript program?
var book = {
"main title": "JavaScript",
'sub-title': "The Definitive Guide",
"for": "all audiences",
author: {
firstname: "David",
surname: "Flanagan"
}
};
a) objects
b) property names
c) properties
d) property values
View Answer
Answer: b
Explanation: An item is contained within another object in the code sample above. The property
names are firstname and surname. The value of that property is an object in and of itself.
39. Consider the following JavaScript statement containing regular expressions and check if the
pattern matches.
a) [Link](pattern)
b) [Link](text)
c) text==pattern
d) [Link](pattern)
View Answer
Answer: b
Explanation: The pattern specified is applied to the text included in parenthesis. The test()
method checks a string for a match. If a match is found, this method returns true; otherwise, it
returns false.
PHP MCQ
1. What is PHP?
a) PHP is an open-source programming language
b) PHP is used to develop dynamic and interactive websites
c) PHP is a server-side scripting language
d) All of the mentioned
View Answer
Answer: d
Explanation: PHP is an open-source server-side scripting language that is used to build dynamic
and interactive web pages or web applications.
Answer: b
Explanation: PHP was originally created by Rasmus Lerdorf in 1994.
3. What does PHP stand for?
a) PHP stands for Preprocessor Home Page
b) PHP stands for Pretext Hypertext Processor
c) PHP stands for Hypertext Preprocessor
d) PHP stands for Personal Hyper Processor
View Answer
Answer: c
Explanation: PHP previously stood for Personal Home Page now stands for “Hypertext
Preprocessor”.
Answer: d
Explanation: Every section of PHP code starts and ends by turning on and off PHP tags to let the
server know that it needs to execute the PHP in between them.
5. Which of the following is the correct way to add a comment in PHP code?
a) #
b) //
c) /* */
d) All of the mentioned
View Answer
Answer: d
Explanation: In PHP, /* */ can also be used to comment just a single line although it is used for
paragraphs. // and # are used only for single-line comments.
advertisement
Answer: a
Explanation: To run a PHP file on the server, it should be saved as [Link]
<?php
$x = 10;
$y = 20;
if ($x > $y && 1||1)
print "1000 PHP MCQ" ;
else
print "Welcome to Sanfoundry";
?>
a) no output
b) Welcome to Sanfoundry
c) 1000 PHP MCQ
d) error
View Answer
Answer: c
Explanation: Expression evaluates to true.
Output:
1000 PHP MCQ
Answer: b
Explanation: A variable in PHP can not start with a number, also $this is mainly used to refer
properties of a class so we can’t use $this as a user defined variable name.
<?php
$fruits = array ("apple", "orange", array ("pear", "mango"),"banana");
echo (count($fruits, 1));
?>
a) 6
b) 5
c) 4
d) 3
View Answer
Answer: a
Explanation: function count() will return the number of elements in an array. The parameter 1
counts the array recursively i.e it will count all the elements of multidimensional arrays.
11. What will be the output of the following PHP program?
<?php
function multi($num)
{
if ($num == 3)
echo "I Wonder";
if ($num == 7)
echo "Which One";
if ($num == 8)
echo "Is The";
if ($num == 19)
echo "Correct Answer";
}
$can = stripos("I love php, I love php too!","PHP");
multi($can);
?>
a) Correct Answer
b) Is The
c) I Wonder
d) Which One
View Answer
Answer: d
Explanation: The stripos() function finds the position of the first occurrence of a string inside
another string. In this case it returns 7.
12. Which of the following PHP functions can be used for generating unique ids?
a) md5()
b) uniqueid()
c) mdid()
d) id()
View Answer
Answer: b
Explanation: The function uniqueid() is used to generate a unique ID based on the microtime
(current time in microseconds). The ID generated from the function uniqueid() is not optimal, as
it is based on the system time. To generate an ID which is extremely difficult to predict we can
use the md5() function.
<?php
class Example
{
public $name;
function Sample()
{
echo "Learn PHP @ Sanfoundry";
}
}
?>
a) function sample()
b) echo “This is an example”;
c) public $name;
d) class Example
View Answer
Answer: c
Explanation: Above code is an example of ‘classes’. Classes are the blueprints of objects.
Classes are the programmer-defined data type, which includes the local methods and the local
variables. Class is a collection of objects which has properties and behaviour.
<?php
define("GREETING", "PHP is a scripting language");
echo $GREETING;
?>
a) $GREETING
b) no output
c) PHP is a scripting language
d) GREETING
View Answer
Answer: b
Explanation: Constants do not need a $ before them, they are referenced by their variable names
itself.
15. A function in PHP which starts with __ (double underscore) is known as __________
a) Default Function
b) User Defined Function
c) Inbuilt Function
d) Magic Function
View Answer
Answer: d
Explanation: PHP functions that start with a double underscore – a “__” – are called magic
functions. They are functions that are always defined inside classes, and are not stand-alone
functions.
16. How many functions does PHP offer for searching and modifying strings using Perl-
compatible regular expressions.
a) 10
b) 7
c) 8
d) 9
View Answer
Answer: c
Explanation: The functions are preg_filter(), preg_grep(), preg_match(), preg_match_all(),
preg_quote(), preg_replace(), preg_replace_callback(), and preg_split().
17. Which of the following web servers are required to run the PHP script?
a) Apache and PHP
b) IIS
c) XAMPP
d) Any of the mentioned
View Answer
Answer: b
Explanation: To run PHP code you need to have PHP and a web server, both IIS, XAMPP and
Apache are web servers. You can choose either one according to your platform.
18. What will be the output of the following PHP code snippet?
<?php
$url = "phpmcq@[Link]";
echo ltrim(strstr($url, "@"),"@");
?>
a) phpmcq@[Link]
b) php@[Link]
c) phpmcq@
d) [Link]
View Answer
Answer: d
Explanation: The strstr() function returns the remainder of a string beginning with the first
occurrence of a predefined string.
19. Which of the following PHP functions can be used to get the current memory usage?
a) memory_get_usage()
b) memory_get_peak_usage()
c) get_peak_usage()
d) get_usage()
View Answer
Answer: a
Explanation: memory_get_usage() returns the amount of memory, in bytes, that’s currently being
allocated to the PHP script. We can set the parameter ‘real_usage’ to TRUE to get total memory
allocated from system, including unused pages. If it is not set or FALSE then only the used
memory is reported. To get the highest amount of memory used at any point, we can use the
memory_get_peak_usage() function.
20. Which one of the following PHP function is used to determine a file’s last access time?
a) filetime()
b) fileatime()
c) fileltime()
d) filectime()
View Answer
Answer: b
Explanation: The fileatime() function returns a file’s last access time in Unix timestamp format
or FALSE on error.
21. What will be the output of the following PHP code?
<?php
$x = 5;
$y = 10;
function fun()
{
$y = $GLOBALS['x'] + $GLOBALS['y'];
}
fun();
echo $y;
?>
a) 5
b) 10
c) 15
d) Error
View Answer
Answer: b
Explanation: The value of global variable y does not change therefore it’ll print 10;
Answer: a
Explanation: PHP recognizes constructors by double underscore followed by the construct
keyword. Its syntax is function __construct ([ argument1, argument2,…..]) { Class Initialization
code }.
23. The developers of PHP deprecated the safe mode feature as of which PHP version?
a) PHP 5.3.1
b) PHP 5.3.0
c) PHP 5.1.0
d) PHP 5.2.0
View Answer
Answer: b
Explanation: This happened because safe mode often creates many problems as it resolves,
largely due to the need for enterprise applications to use many of the features safe mode disables.
24. What will be the value of the variable $input in the following PHP program?
<?php
$input = "PHP<td>stands for</td>Hypertext<i>Preprocessor</i>!";
$input = strip_tags($input,"<i></i>");
echo $input;
?>
Answer: a
Explanation: Italic tags <i></i> might be allowable, but table tags <td></td> could potentially
wreak havoc on a page.
25. Which of the following variables does PHP use to authenticate a user?
i) $_SERVER['PHP_AUTH_USER'].
ii) $_SERVER['PHP_AUTH_USERS'].
iii) $_SERVER['PHP_AUTH_PU'].
iv) $_SERVER['PHP_AUTH_PW'].
Answer: b
Explanation: $_SERVER[‘PHP_AUTH_USER’] and $_SERVER[‘PHP_AUTH_PW’] store the
username and password values, respectively.
Answer: c
Explanation: PDO stands for PHP Data Object. The PDO class provides a common interface to
different database applications.
27. What will be the output of the following PHP program?
<?php
$a = 100;
if ($a > 10)
printf("PHP Quiz");
else if ($a > 20)
printf("PHP MCQ");
else if($a > 30)
printf("PHP Program");
?>
a)
PHP Quiz
PHP MCQ
PHP Program
b) PHP Quiz
c) No output
d) PHP MCQ
View Answer
Answer: b
Explanation: In if else if one condition is satisfied then no other condition is checked.
i) for loop
ii) while loop
iii) do-while loop
iv) foreach loop
a) Only iv)
b) i) and ii)
c) i), ii) and iii)
d) i), ii), iii) and iv)
View Answer
Answer: d
Explanation: All are supported looping statements in PHP as they can repeat the same block of
code a given number of times, or until a certain condition is met.
Answer: a
Explanation: A backslash is used so that the dollar sign is treated as a normal string character
rather than prompt PHP to treat $x as a variable. The backslash used in this manner is known as
the escape character.
30. Which version of PHP introduced the advanced concepts of OOP?
a) PHP 6
b) PHP 4
c) PHP 5
d) PHP 5.3
View Answer
Answer: c
Explanation: Advanced concepts of OOP were introduced in PHP version 5.
<?php
$x = 4;
$y = 3
$z = 1;
$z = $z + $x + $y;
echo "$z";
?>
a) 15
b) 8
c) 1
d) $z
View Answer
Answer: b
Explanation: Normal addition of variables x, y and z occurs and result of 8 will be displayed.
<?php
$a = "$winner";
$b = "/$looser";
echo $a,$b;
?>
a) /
b) $looser
c) /$looser
d) $winner/$looser
View Answer
Answer: a
Explanation: Since variables $winner and $looser is not defined we only see / as output.
33. Which one of the following is the default PHP session name?
a) PHPSESSIONID
b) PHPIDSESS
c) PHPSESSID
d) PHPSESID
View Answer
Answer: c
Explanation: PHPSESSID is the default PHP session name. You can change this name by using
the [Link] directive.
<?php
$mcq = 1;
switch(print $mcq)
{
case 2:
print "HTML";
break;
case 1:
print "CSS";
break;
default:
print "JavaScript";
}
?>
a) error
b) 1HTML
c) 1JavaScript
d) 1CSS
View Answer
Answer: d
Explanation: Print returns 1, thus it gives case 1.
<?php
define("VAR_NAME","test");
${VAR_NAME} = "value";
echo VAR_NAME;
echo ${VAR_NAME};
?>
a) testtest
b) testvalue
c) error, constant value cannot be changed
d) test
View Answer
Answer: b
Explanation: ${VAR_NAME} creates a new variable that is not same as VAR_NAME.
36. Which PHP function displays the web page’s most recent modification date?
a) getlastmod()
b) get_last_mod()
c) lastmod()
d) last_mod()
View Answer
Answer: a
Explanation: The function getlastmod() gets the time of the last modification of the main script
of execution. It returns the value of the page’s last modified header or FALSE in the case of an
error.
<?php
$i = 5;
while (--$i > 0 && ++$i)
{
print $i;
}
?>
a) 555555555…infinitely
b) 54321
c) error
d) 5
View Answer
Answer: a
Explanation: As it is && operator it is being incremented and decremented continuously in PHP.
<?php
function constant()
{
define("GREETING", "Welcome to Sanfoundry",true);
echo greeting;
}
?>
a) GREETING
b) Welcome to Sanfoundry
c) ERROR
d) greeting
View Answer
Answer: b
Explanation: By default, constants are case sensitive in php. But the third parameter in define(),
if set to true, makes constants case insensitive.
39. Which variable is used to collect form data sent with both the GET and POST methods?
a) $_BOTH
b) $REQUEST
c) $_REQUEST
d) $BOTH
View Answer
Answer: c
Explanation: In PHP the global variable $_REQUEST is used to collect data after submitting an
HTML form.
<?php
$php = array("Array", "Function", "Strings", "File");
echo pos($php);
?>
a) Function
b) File
c) Strings
d) Array
View Answer
Answer: d
Explanation: The pos() function returns the value of the current element in an array, and since no
operation has been done, the current element is the first element.
Answer: b
Explanation: ?: is known as ternary operator. If condition is true then the part just after the ? is
executed else the part after : .
CSS MCQ
1. What is CSS?
a) CSS is a style sheet language
b) CSS is designed to separate the presentation and content, including layout, colors, and fonts
c) CSS is the language used to style the HTML documents
d) All of the mentioned
View Answer
Answer: d
Explanation: CSS is a style sheet language that stands for Cascading Style Sheet and is used to
style HTML documents. CSS is mainly designed to separate the presentation and content,
including layout, colors, and fonts.
Answer: d
Explanation: <style> </style> tag is used to embed CSS in HTML page, while <script> </script>
is used to embed JS in HTML. <!DOCTYPE html> is HTML5 declaration.
3. Which of the following CSS selectors are used to specify a group of elements?
a) tag
b) id
c) class
d) both class and tag
View Answer
Answer: c
Explanation: Class selectors are used to specify a group of elements. Id selector specifies a
particular unique element.
4. Which of the following has introduced text, list, box, margin, border, color, and background
properties?
a) HTML
b) PHP
c) CSS
d) Ajax
View Answer
Answer: c
Explanation: CSS is a style sheet language that stands for Cascading Style Sheet. CSS has
introduced text, list, box, margin, border, color, and background properties.
5. Which of the following CSS framework is used to create a responsive design?
a) django
b) rails
c) larawell
d) bootstrap
View Answer
Answer: d
Explanation: Bootstrap is a free and open-source collection of tools for creating websites and
web applications. It contains HTML- and CSS-based design templates for typography, forms,
buttons, navigation and other interface components, as well as optional JavaScript extensions. It
aims to ease the development of dynamic websites and web applications.
6. Which of the following CSS selector is used to specify a rule to bind a particular unique
element?
a) tag
b) id
c) class
d) both class and tag
View Answer
Answer: b
Explanation: For binding a particular unique element, id selectors are used. While for a group of
elements, class selector can be used.
7. Which of the following type of HTML tag is used to define an internal style sheet?
a) <script>
b) <link>
c) <class>
d) <style>
View Answer
Answer: d
Explanation: <style> tag is used to define an internal style sheet in HTML document.
8. Which of the following CSS property is used to make the text bold?
a) text-decoration: bold
b) font-weight: bold
c) font-style: bold
d) text-align: bold
View Answer
Answer: b
Explanation: The font-weight property is used for setting the thickness and boldness of the font.
It is used to define the weight of the text. The available weight depends on the font-family,
which is used by the browser.
9. What will be the output of following CSS code snippet?
h1 {color: "green";}
a) nothings happen
b) error occurs
c) heading becomes dark-green
d) heading becomes green
View Answer
Answer: a
Explanation: Output of the above code snippet won’t happen as the declaration syntax is wrong.
The correct declaration is : h1 { color: green; } which will yield an output. In CSS, we don’t
write the value in double quotes.
10. Which of the following CSS style property is used to specify an italic text?
a) style
b) font
c) font-style
d) @font-face
View Answer
Answer: c
Explanation: font-style property is used to specify an italic text. font-style property has three
values (normal, italic & oblique).
Answer: b
Explanation: In this case, we should see the browser continue to parse the value of color as “red
text-decoration: underline” before it sees a closing semicolon. The font-style property that
follows would then be used. Because the color property has an illegal value, it should be ignored.
12. Which of the following are the CSS Extension Prefixes for Webkit?
a) -chrome
b) -web
c) -o-
d) -webkit
View Answer
Answer: d
Explanation: Browser sometimes adds prefixes to non-standard CSS properties. CSS Extension
prefix for Webkit is -webkit which is supported by almost all ios browsers. -o is used by opera
where as -moz is used by firefox browser.
13. Which of the following is the correct syntax to link an external style sheet in the HTML file?
a) <link rel=”stylesheet” href=”[Link]” />
b) <link rel=”stylesheet” src=”[Link]” />
c) <style rel=”stylesheet” src=”[Link]” />
d) <style rel=”stylesheet” link=”[Link]” />
View Answer
Answer: a
Explanation: HTML file must contain a reference to the external style sheet file. External style
sheet files are defined within the <link> element and it should be inside the <head> section. href
attribute specifies the URL of the linked resource.
14. Which of the following is the first CSS specification to become an official W3C
Recommendation?
a) CSS level 2
b) (X)HTML CSS
c) CSS level 1
d) CSS level 2.1
View Answer
Answer: c
Explanation: The first CSS specification to become an official W3C Recommendation is CSS
level 1, published on December 17, 1996. Håkon Wium Lie and Bert Bos are credited as the
original developers.
15. Which of the following function defines a linear gradient as a CSS image?
a) gradient()
b) linear-gradient()
c) grayscale()
d) image()
View Answer
Answer: b
Explanation: linear-gradient() function defines a linear gradient as a CSS image. Creating a
linear gradient function we should define minimum of two color stops. color stops will tell the
browser which colors to use in the gradients for smooth transitions.
16. Which of the following CSS property can be used to set the image as a border instead of the
border style?
a) background-image-source
b) background-image
c) border-image-source
d) border-image
View Answer
Answer: c
Explanation: The border-image-source property specifies the path to the image to be used as a
border (instead of the normal border around an element).
17. Which of the following CSS property defines the different properties of all four sides of an
element’s border in a single declaration?
a) border-collapse
b) border-width
c) padding
d) border
View Answer
Answer: b
Explanation: The border-width property sets the width of an element’s four borders. This
property can have from one to four values.
18. Which of the following is the correct way to apply CSS Styles?
a) in an external CSS file
b) inside an HTML element
c) inside the <head> section of an HTML page
d) all of the mentioned
View Answer
Answer: d
Explanation: We can style the document using CSS in three different ways i.e embed, inline and
external. An inline CSS means applying styles rules directly to the HTML element. In embed, we
declare or write all the needed style in <style></style> tag in the head section of the HTML
document. We can create an external style sheet and provide its link to the document.
19. Which of the following CSS property sets the font size of text?
a) font-size
b) text-size
c) text
d) size
View Answer
Answer: a
Explanation: CSS Syntax:
font-size: length | percentage | larger | smaller | xx-small | x-small |
small | medium | large | x-large | xx-larger | inherit
20. Which of the following is not the property of the CSS box model?
a) margin
b) color
c) width
d) height
View Answer
Answer: b
Explanation: CSS box model include height, width, padding, margin and border. All text-fields
have complete support for every property related to CSS box model. Browser relies on system
default styles when displaying these widgets.
21. Which of the following CSS property sets what kind of line decorations are added to an
element, such as underlines, overlines, etc?
a) text-decoration
b) text-style
c) text-decoration-line
d) text-line
View Answer
Answer: c
Explanation: The text-decoration-line property defines the type of line decorations that are added
to an element, such as underlines, overlines, etc.
22. Which of the following CSS property specifies the look and design of an outline?
a) outline-style
b) outline-format
c) outline-font
d) none of the mentioned
View Answer
Answer: a
Explanation: The outline-style CSS property is used to set the style of the outline of an element.
An outline is a line that is drawn around elements, outside the border edge, to make the element
stand out.
23. What will be the output of the following CSS code snippet?
span {
border: 1px solid red;
outline: green dotted thick;
}
a) All span elements will have a green thick border and a red outline
b) All span elements will have a red border and a green dotted outline
c) All span elements will have a outer green dotted border and an inner red border
d) All span elements will have an outer red border and inner green dotted border
View Answer
Answer: c
Explanation: The border property creates the inner border, while the outline sets the outer border.
24. Which of the following CSS property sets the shadow for a box element?
a) set-shadow
b) box-shadow
c) shadow
d) canvas-shadow
View Answer
Answer: b
Explanation: box-shadow property sets the shadow for a box element.
CSS Syntax:
box-shadow: none | inherit
25. Which of the following CSS property is used to set the color of the text?
a) text-decoration
b) pallet
c) colour
d) color
View Answer
Answer: d
Explanation: The color property is used to set the color of the text. In CSS, colors can also be
specified using RGB values, RGBA values, HSL values, HEX values, etc.
26. Which of the following CSS Property controls how an element is positioned?
a) static
b) position
c) fix
d) set
View Answer
Answer: b
Explanation: Position property controls how an element is positioned. When set to absolute or
fixed, the element is removed completely from the normal flow of the document. When set to
relative, the element is moved relative to its position in the normal flow, but a space is left where
it would normally have been. The default value, static, means the element remains in the normal
flow and is not positioned.
27. Which of the following CSS selector selects the elements that are checked?
a) :checked
b) E ~ F
c) ::after
d) none of the mentioned
View Answer
Answer: a
Explanation: :checked selector selects the elements that are checked.
Example: :checked {color: blue;}
28. Which of the following is an appropriate value for the overflow element?
a) scroll
b) hidden
c) auto
d) all of the mentioned
View Answer
Answer: d
Explanation: Overflow of a div or a container can have the following values:
visible|hidden|scroll|auto|initial|inherit
29. Which of the following CSS property is used to specify table borders in CSS?
a) table:border
b) table
c) border
d) none of the mentioned
View Answer
Answer: c
Explanation: In CSS, border property is used to specify table borders.
Example:
table{border: 7px solid black;}
30. Which of the following property is used to align the text in a table?
a) text-align
b) align
c) text
d) none of the mentioned
View Answer
Answer: a
Explanation: In CSS, text-align property is used to align the text in a table.
Example:
table{text-align: left;}
31. Which of the following CSS Property sets the stacking order of positioned elements?
a) y-index
b) z-index
c) x-index
d) all of the mentioned
View Answer
Answer: b
Explanation: z-index property sets the stacking order of positioned elements.
Syntax:
z-index: auto|number|initial|inherit;
div {
border-width:5px;
border-style:dotted solid double dashed;
}
a) Box having dotted bottom outline, solid right outline, double top outline and dashed left
outline
b) Box having dotted bottom outline, solid left outline, double top outline and dashed left outline
c) Box having dotted top outline, solid right outline, double bottom outline and dashed left
outline
d) Box having dotted top outline, solid left outline, double bottom outline and dashed right
outline
View Answer
Answer: c
Explanation: The shorthand run in clockwise direction.
33. Which of the following property allows a marquee to be used in the case of a text-overflow?
a) overflow-marquee
b) overflow-style
c) overflow-text
d) none of the mentioned
View Answer
Answer: b
Explanation: overflow-style is a CSS property that allows a marquee to be used in the case of a
text-overflow.
Syntax:
overflow-style: auto | marquee-block
34. Which of the following CSS property defines the space between cells in a table?
a) border-spacing
b) border-style
c) border
d) none of the mentioned
View Answer
Answer: a
Explanation: border-spacing property defines the space between cells in a table.
Syntax:
border-spacing: non-negative length(s) | inherit
35. Which of the following CSS3 property can be used to allow line breaks within words?
a) line-break
b) line-wrap
c) word-wrap
d) word-break
View Answer
Answer: d
Explanation: word-break property can be used to allow line breaks within the words.
Syntax:
HTML MCQ
1. What is HTML?
a) HTML describes the structure of a webpage
b) HTML is the standard markup language mainly used to create web pages
c) HTML consists of a set of elements that helps the browser how to view the content
d) All of the mentioned
View Answer
Answer: d
Explanation: HTML is the standard markup language mainly used to create web pages. HTML
describes the structure and layout of a webpage. HTML consists of a series of elements that
helps the browser how to display content easily.
Answer: b
Explanation: Timothy John Berners-Lee (TimBL) is known as the father of HTML. He is a
British computer scientist, best known as the inventor of the World Wide Web.
Answer: a
Explanation: HTML stands for “HyperText Markup Language”. HTML is the standard markup
language mainly used to design and create web pages and web applications.
Answer: d
Explanation: The correct syntax of HTML5 doctype is <!doctype html>, doctype is the very first
thing to write in HTML5. <!doctype html> or <!DOCTYPE HTML> both are same because
‘doctype’ keyword is not case sensitive.
5. Which of the following is used to read an HTML page and render it?
a) Web server
b) Web network
c) Web browser
d) Web matrix
View Answer
Answer: c
Explanation: A web browser (commonly referred to as a browser) is a software application for
retrieving, presenting and traversing information resources on the World Wide Web. A web
server process, store and display output to the client as per their request. Web matrix is a
discontinued cloud-connected website builder and HTML editor for Windows.
6. Which of the following is not a difference between HTML and XHTML?
a) Charset in both html and xhtml is “text/html”
b) Tags and attributes are case-insensitive in HTML but not in XHTML
c) Special characters must be escaped using character entities in XHTML unlike HTML
d) Charset in html is “text/html” where as in xhtml it is “application/xml+xhtml”
View Answer
Answer: a
Explanation: HTML is case insensitive while XHTML is case sensitive. In XHTML, special
characters can be escaped using character entites but not in HTML. Charset in HTML is
“text/html” where as it is “application/xml+xhtml” for XHTML.
7. Which of the following tag is used for inserting the largest heading in HTML?
a) head
b) <h1>
c) <h6>
d) heading
View Answer
Answer: b
Explanation: Headings in HTML starts from <h1> to <h6> in which <h1> heading is the largest
one and <h6> is smallest one among those. The heading tags are <h1> <h2> <h3> <h4> <h5>
and <h6> that are used for the creations of headings.
Answer: d
Explanation: The Document Object Model is a cross-platform and language-independent
application programming interface that treats an HTML, XHTML, or XML document as a tree
structure. A document can be viewed as a logical tree with help of DOM Model.
Answer: a
Explanation: Metadata is information about data. The meta tag provides metadata/meta
information about the HTML document. Metadata will not be displayed on the page. Metadata is
present in head. The body tag defines document’s body. A title tag is an HTML element which
specifies the title of a web page.
10. Which element is used to get highlighted text in HTML5?
a) <u>
b) <mark>
c) <highlight>
d) <b>
View Answer
Answer: b
Explanation: The <mark> element is used to highlight a section of text. It is useful for quoting a
text or if one wants to bring attention to the text. The <b> tag is used to make text/paragraph
bold. <u> tag is used to underline the text you wanted.
<p>This is the example.<mark> I like this dog. </mark></p>
Answer: c
Explanation: <video> tag is used to display video clips in HTML5. Multiple media resources for
media elements is specified by <source> tag. Text track for media elements i.e. <audio> &
<video> is provided by <track> tag in HTML5. There is no such thing as slider tag in HTML5.
Answer: b
Explanation: Browser ignores comment in a code. There are always two types of command i.e.
single line command and multiple line command. If one wants to add a comment in code, add the
text between these characters <!…..comment….>. It will not visible in the user’s browser.
13. Which of the following elements in HTML5 defines video or movie content?
a) <video>
b) <movie>
c) <audio>
d) <media>
View Answer
Answer: a
Explanation: The media to which linked document is optimized is given by <media> tag. Before
HTML5, videos could only be played with a plug-in (like flash). The HTML5 video element
specifies a standard way to embed a video in a webpage. As like <video> elements, <audio>
element contains additional files or streams like music, recording, etc.
14. Which of the following is not the element associated with the HTML table layout?
a) alignment
b) color
c) size
d) spanning
View Answer
Answer: b
Explanation: There are three elements in HTML table layout i.e. size, spanning and alignment.
Layout type can be achieved by setting Rows elements layout attribute to Fixed or Auto. Auto
attribute relies on browser compatibility whereas fixed layout relies on developer specification.
Answer: a
Explanation: For styling HTML5, CSS i.e Cascading Style Sheet is used. It is style sheet
language and designed to describe presentation of its content including layouts, colors and fonts.
CSS can control the layout of multiple webpages.
16. Which HTML tag is used for making character appearance bold?
a) <u>content</u>
b) <b>content</b>
c) <br>content</br>
d) <i>content</i>
View Answer
Answer: b
Explanation: By enclosing words in the tags <b>and</b> we can make characters appear bold.
<i> element is for content in italics, <u> is for underlined content, <br> is for vertical breaking.
Answer: c
Explanation: In HTML, <img> tag is used to insert an image in HTML page. Image tag has two
attributes (src and Alt).
–> Src attribute is used to specify the image path.
–> Alt attribute is used to specify the alternate text for the image.
18. HTML is a subset of ___________
a) SGMT
b) SGML
c) SGME
d) XHTML
View Answer
Answer: b
Explanation: HTML is a subset of SGML. SGML (Standard Generalized Markup Language) is a
standard for specifying a document markup language or tag set.
Answer: c
Explanation: The forward-slash (/) is used to indicate the closure of a tag within HTML.
20. Which of the following HTML code will make an image clickable?
a)
b)
<img src="[Link]
<a href="[Link] Home Page</a>
</img>
c)
d)
<a href="[Link]
src="[Link] /></a>
View Answer
Answer: d
Explanation: <a> tag defines a hyperlink, which is used to link from one page to another page.
Suppose if we want an image to be clickable then it should go inside <a> Tag.
21. Among the following, which is the HTML paragraph tag?
a) <p>
b) <pre>
c) <hr>
d) <a>
View Answer
Answer: a
Explanation: <p> tag is used for paragraph in HTML.
22. In HTML, which attribute is used to create a link that opens in a new window tab?
a) src=”_blank”
b) alt=”_blank”
c) target=”_self”
d) target=”_blank”
View Answer
Answer: d
Explanation: Add the target=”_blank” attribute in the Anchor tag. target=”_blank” attribute
makes a link open in a new window tab.
Answer: c
Explanation: <em> element indicates emphasis, browser will show the contents of <em> element
in italic. A section which is quoted from another source is specified by <blockquote>. The
<abbr> defines abbreviation. We used <q> element for shorter quote. Browser put quote around
<q> element.
<p>This is a <q>black dog</q>.</p>
24. Which of the following HTML tag is used to create an unordered list?
a) <ol>
b) <ul>
c) <li>
d) <ll>
View Answer
Answer: b
Explanation: <ul> tag is used to create the unordered list items in an HTML document. By
default, unordered list items will display in a bulleted format.
Different types of unordered list Attribute Values are:
Disc
Circle
Square
None
Syntax: <ul> Unordered List Items </ul>
Answer: a
Explanation: <em> element indicates emphasis, browser will show the contents of <em> element
in italic. We used <q> element for shorter quote. Browser put quote around <q> element. A
section which is quoted from another source is specified by <blockquote>. For using,
abbreviation or acronym <abbr> element is helpful. A title element is to be used with abbr.
<p>The <abbr title=”Doctor”>Dr.</abbr> is on the way.</p>
26. Which of the following HTML tag is used to add a row in a table?
a) <th>
b) <td>
c) <tr>
d) <tt>
View Answer
Answer: c
Explanation: In HTML, <tr> tag is used to create a row in the table. <th> tag is used to set the
header cell of a table.
Answer: d
Explanation: The contact details for author of a page is specified by <address> attribute. The
content is often displayed in italics,
e.g.
<address>
<a href="[Link]
</address>
28. Which of the following tag is used to create a text area in HTML Form?
a) <textarea> </textarea>
b) <text></text>
c) <input type=”text” />
d) <input type=”textarea” />
View Answer
Answer: a
Explanation: The text area tag (<textarea>) is used in a form to declare a text area element. It
allows the user to enter text in multiple rows.
Answer: a
Explanation: <strong> element shows the importance of text/paragraph between it’s tags. <em>
element indicates emphasis, browser will show the contents of <em> element in italic. <ins>
element shows the content that has been inserted, usually it has underline. <del> element shows
text that has been deleted from, usually it has a line through the content.
<p>This is <del>not</del> for deletion </p>
Answer: d
Explanation: The correct syntax for a web address is scheme://[Link]:port/path/filename,
where scheme is for https or http, prefix is for domain like www, domain denotes domain name,
port defines port number, path defines path at server, filename is for name of the document.
Answer: b
Explanation: <select> element is used to create a drop-down list in HTML Forms. It is mainly
used to collect user input. Option tags are used within the <select> element to define available
options from the drop-down list.
Answer: a
Explanation: <ol> tag is used to create the numbered list or ordered list items in an HTML
document. An ordered list can be numerical or alphabetical order. <li> tag is used to define each
list item.
Syntax: <ol> Ordered List Items </ol>
Answer: c
Explanation: <input type=”checkbox”> is used to create a checkbox in HTML Form.
Checkboxes allow a user to select one or more options of a limited number of choices.
b)
c)
d)
<a>[Link]
View Answer
Answer: a
Explanation: An anchor tag (<a>) and href attribute are used to create a hyperlink in HTML.
Answer: d
Explanation: .html or .htm extensions are used to save the HTML file.
Answer: b
Explanation: In HTML, <br> tag is used to create a blank line. <b> tag is used to specify the
bold text. <em> tag is used to define the emphasized text.
37. Which HTML tag is used to convert the plain text into italic format?
a) <b>
b) <p>
c) <i>
d) <a>
View Answer
Answer: c
Explanation: In HTML, <i> tag is used to convert the plain text into italic format.
Answer: d
Explanation: To create a break between themes-such as a change of topic in a book or a new
scene in a play-you can add a horizontal rule between sections using <hr/> tag
Answer: a
Explanation: An iframe is equivalent to a window that has been cut into our page, it is created
using <iframe> element. Src, height, width attribute are essentially used inside of this. Src
attribute specifies the URL of the page which is to be shown. Height and width specify the height
and width of an iframe in pixels.
40. Which works similar to <b> element?
a) <blockquote>
b) <strong>
c) <em>
d) <i>
View Answer
Answer: b
Explanation: The words are written inside <strong> can be said with strong emphasis. Browser
shows contents written inside <strong> element in bold.
Example:
<p>1000 <strong>HTML</strong> MCQs.</p>
Answer: b
Explanation: In HTML, underline tag (<u>) is used to display the underlined text.
Example: HTML stands for <u>HyperText Markup Language</u>.
42. Which attribute specifies a unique alphanumeric identifier to be associated with an element?
a) type
b) article
c) id
d) class
View Answer
Answer: c
Explanation: HTML is Hyper Text Markup Language that is used to create web pages and
applications. The id attribute is most used to point to a style in a style sheet, and by JavaScript
(via the HTML DOM) to manipulate the element with the specific id. Class is a name given to
HTML elements that can be used by CSS and JavaScript for styling web pages. A self-contained
content is called an attribute.
43. Which of the following is an HTML specification used to add more information to HTML
tags?
a) Modifydata
b) Minidata
c) Macrodata
d) Microdata
View Answer
Answer: d
Explanation: The Microdata spec provides a standardized syntax for additional semantic markup
to your web pages to enhance the machine readability of your web pages. The planning for
distribution center operation is offered by minidata. Macrodata and Modifydata are not any terms
related to HTML5.
Answer: d
Explanation: We can host our videos through YouTube and can easily embed them into our
website. <iframe> tag will be used for YouTube videos.
E.g. <iframe width=”670” height=”612” src= “[Link] </iframe>
45. Which of the following HTML element is used for canvas graphics?
a) <css>
b) <paint>
c) <canvas>
d) <graphic>
View Answer
Answer: c
Explanation: CSS i.e. Cascading Style Sheet is a scripting language. Canvas graphics are
introduced in HTML5. Element used for canvas graphics is <canvas>. The HTML canvas
element is used to draw graphics, on the fly, via scripting (usually JavaScript).