You are on page 1of 4

Fundamentals-II

HTML/JS/RDBMS/SQL
1) Which of the following is correct way to declare variable
x=10
var x=10
2) Consider a table named Employee with columns EmployeeId, EmployeeName
and DepartmentCode. Display EmployeeId and EmployeeName of
department 10 or 20.
SELECT EmployeeId, EmployeeName FROM Employee WHERE
DepartmentCode=10 OR DepartmentCode=20;
SELECT EmployeeId, EmployeeName FROM Employee IN (10,20);
3) Consider the following Code:
<table>
<tr> <th colspan=3> Employee Details </th> </tr>
<tr> <th> Employee Name</th> <th> Details
</th></tr>
<tr> <td> Jack </td> <td> LKM </td> </tr>
<tr> <td> Ace </td> <td rowspan=2> Delivery</td>
</tr>
<tr> <td> Justin </td> </tr>
</table>
How many cells are present in the table?
8
4) Consider two tables. Account (AccNo [Primary key], AccOpenDate, Balance)
and Transaction(TranId[Primary key], AccNo[Foreign key], TranDate,
TranAmount, TranType).
Display values with transaction Not after 31st December,2016.
SELECT * FROM Account WHERE AccNo NOT IN (SELECT AccNo FROM
Transaction Where TranDate>31/12/2016 );
5) Consider a table which has a constraint COMPOSITE PRIMARY KEY. Choose the
correct syntax to assign the constraint.
CREATE TABLE table_name (column1, column2,, CONSTRAINT CR_PKEY
PRIMARY KEY(column1,column2));
*composite primary key Constraint declaration should always be at
the end*
6) Consider two tables Employee(EmpNo, EmpName, Salary, DeptCode) and
Department(DeptCode, DeptName). Display Employee Name and Department
Name.
SELECT e.EmpName, d.DeptName FROM Employee e INNER JOIN
Department d ON e.DeptCode=d.DeptCode;

7) Consider a table Student (StuId, StuName, Email, Percentage). Display the


table records with Percentage column in descending (Highest to Lowest)
order. Also the students name should be displayed alphabetically.
SELECT * FROM Student ORDER BY Percentage DESC, StuName;

8) Which of the following is/are correct statement(s) about Correlated


Subqueries?
(i)
Subquery column reference Column in Main Query
(ii)
Subquery is executed only once.
Only (i)

9) Consider the following code:


First Name: <input textfield="text" id="first" />
alert(Hello+jsfirstname);
<script>
function Hello()
{
var jsfirstname= //Line1
}
</script>
What should be the code line in place of //Line1 to get the alert saying Hello
with the first
name?
document.getElementById("first").value;
10)
Consider two tables Item(ItemCode, ItemPrice, Quantity, VendorId) and
Vendor(VendorId, VendorName, PhoneNo). Table Item has 10 row entries and
Vendor has 5.How many rows will be displayed if following query is run:
SELECT * FROM Item CROSS JOIN Vendor;
50

11)
Choose the true statement(s):
(i)
Checkbox can multiselect options.
(ii)
Get method is default form of Submission method.
Both (i) and (ii)

12)
(i)
(ii)

What is correct about JavaScript?


JS is case sensitive
JS is defined only in head tag

(iii) JS is defined in both head and body tags


(iv) JS is used for Client side validations
Only (i),(iii)and(iv)
13)
Following code is defined in head tag
<style>
.myclass{
background-color:Cyan;
color:blue;
}
</style>
How to call the formatting in body?
<h1 class=myclass> Welcome</h1>

14)
To only delete all rows from table EMP, which of the following
statement(s) are to be used?
(i)
DROP TABLE EMP
(ii)
DELETE TABLE EMP
(iii) TRUNCATE TABLE EMP
Only (ii) and (iii)

15)
What is the correct syntax to call an external CSS file?
<link rel=stylesheet type=text/css href=MyFile.css>

16)
What is the correct syntax to add a column to existing table?
ALTER TABLE table_name ADD column_name datatype;

17)
Consider table Student(StudentId, Name, Email, UniversityCode) of
which StudentId is a primary key of the table Student, Name column has a
NOT Null constraint, Email is a unique key and UniversityCode is a foreign key
to an already existing table University. Which of these columns will accept
Null values?
Email and UniversityCode
18)
Display a name from table Emp having only 3 letters starting from A
and ending in e.
SELECT Name FROM Emp LIKE A_e;
19)
Which is a correct ALERT statement?
alert(This is an Alert);
20)
Consider a table Emp with attributes as EmpNo, EmpName, Salary and
DeptCode. Display Average of salary of each department.

SELECT AVG(SALARY) FROM Emp GROUP BY DeptCode.

You might also like