Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1.

In UNIX, the name of the option file is __________(a) .my.cnf(b) .my.ini(c) .my.opt(d) .my.opcThis question was posed to me in semester exam.This intriguing question comes from Interacting with MySQL topic in portion General MySQL Use of MySQL

Answer»

The CORRECT option is (a) .my.cnf

The best I can explain: Under Unix, an option file is set up by creating a file named ‘~/.my.cnf’ in the home directory. ‘C:\my.ini’ is the option file that is setup in WINDOWS. An option file stores the connection parameters.

2.

The connection parameters for setting up MySQL can be stored in an option file to save typing the names every time a connection is established.(a) True(b) FalseI had been asked this question in examination.I'd like to ask this question from Interacting with MySQL in chapter General MySQL Use of MySQL

Answer»

The correct choice is (a) True

The best explanation: Every TIME MYSQL is invoked, connection parameters like hostname, username and password are REQUIRED. To save typing these parameters all the time, they can be saved in an option FILE instead and executed when setting up the connection.

3.

Which option prints output in table-format when MySQL is run interactively?(a) -t(b) -tf(c) -p(d) -pfThis question was posed to me in semester exam.I want to ask this question from Interacting with MySQL topic in section General MySQL Use of MySQL

Answer»

Right answer is (a) -t

The explanation: MySQL produces OUTPUT in tab-delimited FORMAT when it is run in BATCH mode. Suppose a table-format output is desired, the -t option is used along with the mysql command. -tf is not a valid option.

4.

To execute the contents of a query file ‘exec.sql’ by feeding it to mysql, which command is used?(a) mysql exec.sql > sampdb(b) mysql sampdb < exec.sql(c) mysql exec.sql(d) mysql execThis question was addressed to me by my school principal while I was bunking the class.I'm obligated to ask this question of Interacting with MySQL in portion General MySQL Use of MySQL

Answer» RIGHT choice is (B) mysql sampdb < exec.sql

The best I can EXPLAIN: mysql QUERIES can be run after placing the queries in a file, and then executing it by feeding it to mysql. By default, mysql PRINTS output in a tab-delimited format when it is running in noninteractive mode.
5.

Suppose run_me.sh is a script file. Which command is used to make it executable?(a) chmod +e run_me.sh(b) chmod +a run_me.sh(c) chmod +y run_me.sh(d) chmod +x run_me.shI got this question in an internship interview.This intriguing question comes from Interacting with MySQL topic in chapter General MySQL Use of MySQL

Answer»

The correct choice is (d) chmod +x run_me.sh

For explanation: The command ‘chmod +x file_name’ MAKES a SCRIPT FILE executable. MYSQL supports reading from a script file and executing queries from it. Before a script is RUN, it is necessary for it to be made executable.

6.

MySQL can be used to execute script files.(a) True(b) FalseI have been asked this question in final exam.This key question is from Interacting with MySQL topic in chapter General MySQL Use of MySQL

Answer»

Right ANSWER is (a) True

The explanation: MySQL is capable of reading input from a FILE in batch MODE. This is also known as the non-interactive mode. A lot of TYPING and time can be saved when commands are stored in a file and EXECUTED from a file.

7.

On UNIX, statements entered in ‘MySQL’ are saved in which file?(a) .mysql_queries(b) .queries(c) .mysql_history(d) .historyThis question was addressed to me in final exam.This interesting question is from Interacting with MySQL topic in chapter General MySQL Use of MySQL

Answer» RIGHT CHOICE is (c) .mysql_history

Explanation: Statements ENTERED in ‘MYSQL’ are stored in the file named ‘.mysql_history’. This file is located in the home directory itself. The SQL statements can be directly pasted into this file.
8.

What does Control-_ do in MySQL input editor?(a) copies to clipboard(b) pastes from clipboard(c) undoes last change(d) deletes the current lineI had been asked this question in a job interview.The question is from Interacting with MySQL topic in chapter General MySQL Use of MySQL

Answer»

The correct choice is (c) undoes last change

For explanation: Control-_ undoes the last change that was made. This can be REPEATED. The mysql INPUT editor has a VARIETY of COMMANDS to facilitate editing while providing inputs to the command LINE itself.

9.

The command to move the cursor to the beginning of line in MySQL input editor is?(a) Ctrl-A(b) Ctrl-E(c) Ctrl-D(d) Esc-aThis question was posed to me by my college director while I was bunking the class.This interesting question is from Interacting with MySQL topic in portion General MySQL Use of MySQL

Answer»

The correct OPTION is (a) Ctrl-A

For explanation I would SAY: 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.

10.

SHOW DATABASES lists the databases in the server to which you are connected.(a) True(b) FalseThis question was addressed to me during an online interview.My question is from MySQL Setup topic in section General MySQL Use of MySQL

Answer»

The correct choice is (a) True

Explanation: The ‘SHOW DATABASES’ command is used to DISPLAY the LIST of the databases that are being managed by the server to which connection is ESTABLISHED. This list WOULD vary from server to server.

11.

To see the table structure, which of the following SQL commands is issued?(a) DESCRIBE tbl_name(b) VIEW tbl_name(c) SELECT TABLE tbl_name(d) SELECT tbl_nameI got this question by my college professor while I was bunking the class.Origin of the question is MySQL Setup topic in chapter General MySQL Use of MySQL

Answer»

Right OPTION is (a) DESCRIBE tbl_name

To elaborate: The ‘DESCRIBE’ command is issued to SEE the structure of the table ‘tbl_name’. It SHOWS the structure in the FORMAT: Field-Type-Null-Key-Default-Extra. The ‘VIEW’ and ‘SELECT’ commands are used to see the CONTENTS of the table.

12.

Suppose you want to select a database named ‘sampledb’ as the default database. Which of the following commands do you use?(a) SELECT DATABASE()(b) SELECT DATABASE sampledb(c) USE DATABASE sampledb(d) USE sampledbThis question was posed to me in exam.Asked question is from MySQL Setup topic in portion General MySQL Use of MySQL

Answer» RIGHT choice is (d) USE sampledb

Easiest explanation: ‘USE sampledb’ selects sampledb as the DEFAULT database. Initially, ‘SELECT DATABASE();’ command displays ‘NULL’, SINCE no database is selected by default. The other TWO are not valid commands.
13.

The query ‘SELECT NOW()’ shows the current _____________(a) table(b) time only(c) date only(d) date and timeThis question was addressed to me during an interview.I'm obligated to ask this question of MySQL Setup in division General MySQL Use of MySQL

Answer»

Correct choice is (d) date and time

The BEST explanation: SELECT NOW() is an SQL query. It SHOWS both the current date and the current time. It is generally DISPLAYED in the format ‘yyyy-mm-dd hh-mm-ss’. For EXAMPLE, 2009-04-21 11-51-36.

14.

Which of the following options tells mysql to ask for entering the password?(a) -e(b) -p(c) -u(d) -hThis question was addressed to me by my college director while I was bunking the class.My question is taken from MySQL Setup topic in portion General MySQL Use of MySQL

Answer»

The correct answer is (b) -P

Best 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.

15.

MySQL client runs on the machine containing the databases and servers connect to the client over a network.(a) True(b) FalseThis question was addressed to me in a national level competition.My query is from MySQL Setup topic in chapter General MySQL Use of MySQL

Answer»

The correct ANSWER is (B) False

For EXPLANATION: MySQL operates using a client/server ARCHITECTURE. It is the server that runs on the machine and not the client. The clients CONNECT to the MySQL server to request information from the database(s).

16.

Which clause is used to sort query elements?(a) GROUP(b) GROUP BY(c) ORDER(d) ORDER BYI got this question in a national level competition.The origin of the question is MySQL Setup topic in division General MySQL Use of MySQL

Answer»

Correct ANSWER is (d) ORDER BY

The explanation is: An ‘ORDER BY’ clause specifies the sort order. The data is SORTED in ascending order by DEFAULT. To sort in descending order, the keyword DESC is APPENDED to the ‘ORDER BY’ clause. ‘GROUP BY’ is used to group the query RESULTS according to the criteria.

17.

What does comparing a known value with NULL result into?(a) zero(b) a positive value(c) a negative value(d) nullI got this question by my school principal while I was bunking the class.This key question is from MySQL Setup in chapter General MySQL Use of MySQL

Answer»

Correct answer is (d) null

For explanation: In MySQL, NULL is not comparable to other known values. It will RESULT in a NULL when COMPARED to any value. The following STATEMENT would result in four NULLS: ‘SELECT NULL = 0, NULL < 0, NULL <> 0, NULL > 0’.

18.

The NULL value also means ___________(a) value equal to zero(b) unknown value(c) negative values(d) a large valueI have been asked this question by my college director while I was bunking the class.My enquiry is from MySQL Setup topic in chapter General MySQL Use of MySQL

Answer»

The correct ANSWER is (b) unknown value

The EXPLANATION is: The NULL value in MYSQL is a SPECIAL value. It represents ‘no value’ or an ‘unknown value’. A NULL value can’t be compared like NORMAL known values since it gives undesirable results.

19.

Which operator is used to perform integer divisions in MySQL?(a) /(b) \(c) DIV(d) //I had been asked this question in semester exam.This interesting question is from MySQL Setup topic in chapter General MySQL Use of MySQL

Answer»

Right answer is (C) DIV

The EXPLANATION is: 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 ‘\’ is FACILITATES escape sequences.

20.

The special database that always exists after setting up MySQL in a computer is __________(a) sampdb(b) mysql(c) information_schema(d) readme_dbThis question was posed to me in homework.I would like to ask this question from MySQL Setup topic in portion General MySQL Use of MySQL

Answer»

The correct option is (c) information_schema

Easy explanation: After installation of MySQL, ‘information_schema’ is the special DATABASE that always exists. ‘mysql’ can be SEEN depending on ACCESS RIGHTS. It holds the grant tables. ‘sampdb’ and ‘readme_db’ do not exist by default.

21.

Which of the following clauses is used to display information that match a given pattern?(a) LIKE(b) WHERE(c) IS(d) SAMEThis question was posed to me in an interview for job.Question is from MySQL Setup topic in chapter General MySQL Use of MySQL

Answer»

The correct option is (a) LIKE

For explanation I WOULD say: The ‘LIKE’ CLAUSE filters information that match a GIVEN PATTERN. ‘WHERE’ clause selects information that is specified by a condition. ‘IS’ is used to match the exact condition specified.

22.

In MySQL databases, the structure representing the organizational views of the entire databases is ____________(a) Schema(b) View(c) Instance(d) TableI got this question by my school teacher while I was bunking the class.This question is from Basic Database Terminology topic in division General MySQL Use of MySQL

Answer» CORRECT option is (a) Schema

Explanation: The schema in a database gives a BLUEPRINT of the structure. A VIEW is an OBJECT that can be generated with a query. A table is a COLLECTION of records. An instance is analogous to a class object.
23.

The MySQL server used in its client/server architecture is _______________(a) mysqla(b) mysqlb(c) mysqlc(d) mysqldThis question was posed to me during a job interview.I would like to ask this question from Basic Database Terminology topic in chapter General MySQL Use of MySQL

Answer»

Right option is (d) mysqld

Best explanation: mysqld is the MYSQL server program. It serves the incoming client REQUESTS by accessing the database. The others are not VALID MySQL programs. MySQL IMPLEMENTS a client/server architecture WHEREIN mysqld is the server program.

24.

Which is the MySQL instance responsible for data processing?(a) MySQL client(b) MySQL server(c) SQL(d) Server daemon programI got this question in an interview for job.This question is from Basic Database Terminology in division General MySQL Use of MySQL

Answer»

Correct ANSWER is (b) MYSQL server

To explain: 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.

25.

How is communication established with MySQL?(a) SQL(b) Network calls(c) A programming language like C++(d) APIsI had been asked this question during an internship interview.The question is from Basic Database Terminology in section General MySQL Use of MySQL

Answer»

Correct ANSWER is (a) SQL

Explanation: SQL is the standard language for RDBMS systems like MYSQL. SQL queries facilitate QUICK information retrieval from tables and other ELEMENTARY operations required to MAINTAIN an RDBMS system.

26.

What represents a ‘tuple’ in a relational database?(a) Table(b) Row(c) Column(d) ObjectThis question was posed to me in an interview.I need to ask this question from Basic Database Terminology in chapter General MySQL Use of MySQL

Answer»

Correct answer is (b) Row

The EXPLANATION: Each row in a table represents a record. A TUPLE is a collection of attribute values that MAKES a record unique. A tuple is a unique entity whereas attribute values can be duplicate in the table.

27.

What represents an ‘attribute’ in a relational database?(a) Table(b) Row(c) Column(d) ObjectThis question was posed to me in an interview for job.Question is taken from Basic Database Terminology in portion General MySQL Use of MySQL

Answer»

The CORRECT OPTION is (c) Column

To explain I would say: Each column in a table represents a feature (ATTRIBUTE) of a record. Table stores the information for an entity whereas a row represents a record. OBJECT has no relevance in an RDBMS.

28.

MySQL is freely available and is open source.(a) True(b) FalseThis question was posed to me in a job interview.My question comes from Basic Database Terminology in section General MySQL Use of MySQL

Answer» RIGHT option is (a) True

The explanation is: MySQL is free and open SOURCE. It’s source CODE is available for USE and is freely downloadable. It includes the MySQL SERVER, the world’s most popular open source database, and MySQL Cluster, a real-time, open source transactional database.
29.

What is data in a MySQL database organized into?(a) Objects(b) Tables(c) Networks(d) File systemsThe question was asked in unit test.This key question is from Basic Database Terminology topic in portion General MySQL Use of MySQL

Answer» RIGHT answer is (b) Tables

Easy explanation: Since MYSQL is an RDBMS, it’s data is organised in tables for ESTABLISHING relationships. A table is a collection of rows and columns, where each row is a record and columns DESCRIBE the feature of records.
30.

Which type of database management system is MySQL?(a) Object-oriented(b) Hierarchical(c) Relational(d) NetworkI got this question by my college professor while I was bunking the class.I'd like to ask this question from Basic Database Terminology in division General MySQL Use of MySQL

Answer»

The CORRECT answer is (c) Relational

To EXPLAIN: 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.