1. Which one of the following Connection interface methods will undo the changes made on database?
Choose the right option.
1. public abstract void cancel() throws java.sql.SQLException;
2. public abstract void rollback() throws java.sql.SQLException;
3. public abstract void undo() throws java.sql.SQLException;
4. public abstract void invalidate() throws java.sql.SQLException;
2. commit() method is defined —————– interface.
Choose the right option to fill up the blank.
1. Connection
2. Statement
3. PreparedStatement
4. ResultSet
3. Which method supports to return the streams of both ASCII and Unicode characters introduced with JDBC 2.0 version?
Choose the right option.
1. getUnicodeStream()
2. getStream()
3. getByteStream()
4. getCharacterStream()
4. Which result set attribute do not reflect the changes made through Java in the underlying database when it is open without throwing exceptions like SQLException or BatchUpdateException etc?
Choose the right option.
1. TYPE_FORWARD_ONLY
2. TYPE_BACKWARD_ONLY
3. TYPE_SCROLL_INSENSITIVE
4. TYPE_SCROLL_SENSITIVE
5. Choose the best JDBC practice(s) for JDBC coding?
1. Minimize the size of result sets retrieved from database
2. Avoid database meta data methods to the maximum
3. 1 and 2
4. none of the above
6. Calling doPost() from doGet() and calling doGet() from doPost() makes the code ———-.
Choose the right option to fill up the blank.
1. to throw exceptions
2. not to compile
3. to terminate the servlet execution by the container
4. deadlock
7. Which object is used to send account holders photo to client by a servlet?
PrintWriter out = response.getWriter();
ServletOutputStream sos = response.getOutputStream();
(where response is an object of ServletResponse interface)
Choose the right option.
1. out
2. sos
3. anyone above
4. none above
8. Observe the following html and servlet code snippets and choose the right answer.
a) HTML file:
b) Servlet file service() method:
public void service(ServletRequest req, ServletResponse res) throws
ServletException, IOException
{
String str1 = req.getParameter("t1");
String str2 = req.getParameter("t2");
}
1. does not compile as HTML hidden fields cannot be read with getParameter() method as HTTP 1.1 and HTTPS prevents.
2. compiles but throws exception
3. hidden tags do not exist in html
4. compiles and executes successfully
9. What is the return type of getParameterValues(String fieldName) method where req is an object of ServletRequest interface. Choose the right option to fill up the blank.
——— names = req. getParameterValues(String fieldName); // this is blank
1. List
2. Set
3. Enumeration
4. String[]
10. Fill up the blank with the return type from the following options.
ServletContext ctx = getServletContext();
———– xyz = ctx. getResourceAsStream(String path);
1. InputStream
2. Reader
3. String
4. Enumeration
11. Which one is a right Cookie constructor? Choose the right option.
1. Cookie(String itemName, String itemQuantity)
2. Cookie(String itemName, int itemQuantity)
3. Cookie(String itemName, double itemQuantity)
4. Cookie(String itemName, float itemQuantity)
12. RequestDispatcher’s include() method is capable to include the content of the following resources.
Choose the right option.
1. HTML file and JSP page
2. Servlet
3. Servlet, JavaBean, HTML file
4. 1 and 2
13. Choose the right option which is true to fill up the blank.
getAttribute(String) is a method of ——————–.
1. HttpSession
2. ServletContext
3. 1 and 2
4. none of above
14. What is the meaning of the following URL? Choose the right encoding option.
http://www.herohonda.com/new%20catalogue.htm
1. Client wants “new catalogue htm” file from servlet
2. Client wants “new_catalogue htm” file from servlet
3. Client wants “new/catalogue htm” file from servlet
4. none of above
15. Choose the right option for the return type to fill up the blank.
———– xyz = cookie.getSecure(); // where cookie is an object of Cookie
1. String
2. boolean
3. int
4. none above
16. Choose the right option to retrieve the value of the Cookie object cookie.
1. int xyz = cookie.getValue();
2. double xyz = cookie.getValue();
3. Object xyz = cookie.getValue();
4. String xyz = cookie.getValue();
17. Which is NOT part of sql JSTL tags?
1. sql:query
2. sql:param
3. sql:dateParam
4. sql:transactionParam
18. Which one of the following options follows jSP Expression syntax.
1. Today of <%= java.util.Date() %> interest is <%= p*t*r/100 %>
2. <H3> <U> No of visits: </U> </H3> <%= ++counter %>
3. Perimeter of circle with radius <%= radius %> is <%= Math.ceil(2*Math.PI*radius) %>
4. 1, 2 and 3
19. Find the error line in the following snippet of JSTL code. Choose the right option.
1. <body>
2. <c:set var=”price” scope=”session” value=”${40}”/>
3. <c:if test price > 20}”>
4. <p> <c:out value=”{price}”/> <p>
5. </c:if>
6. </body>
1. 2
2. 3
3. 4
4. 5
20. Which one of the following options is true to execute the code successfully?
<%!
Calendar cal;
public void jspInit() // line 1
{
// instantiate cal
}
public void _jspService(request, response) // line 2
{
// use cal
}
public void jspDestroy() // line 3
{
// close cal
}
%>
1. The JSP code translates successfully
2. error exists in line 1
3. error exists in line 2
4. error exists in line 3
21. Choose the option that is FALSE.
1. A process is an instance of a running program.
2. A process is identified by a maximum 4-digit PID number.
3. At any point of time, no two processes with the same PID exist.
4. Unix tracks the process by its PID number.
22. Choose the best option that is true.
1. ‘kill’ is a signal to terminate a process.
2. ‘Ctrl+C’ is a signal to terminate a process.
3. 1 and 2
4. none above
23. Which are the fields of ‘top’ Unix command?
1. PID, USER
2. PR, RES
3. 1 and 2
4. none above
24. ‘whoami’ Unix command is deprecated and replaced by ———-. Choose the right option.
1. id -un
2. id -user
3. 1 and 2
4. none above
25. Which grep command recognizes the meta characters like + and ? etc.
Choose the best option that is true.
1. grep –E
2. egrep
3. 1 and 2
4. none above
26. Choose the best option that is true regarding the following grep Unix command.
grep -c ‘hello’ /temp/Demo.txt
1. displays each line where the word hello exists in the file
2. displays only line numbers where the word hello exists in the file
3. displays the count of how many times the word hello is repeated in the file
4. none above
27. Choose the best option that is true regarding the following cut Unix command.
echo ‘abc’ | cut –complement -c 1
1. echoes bc
2. echoes a
3. nothing is echoed
4. none above
28. Choose the best option that is true regarding the following uniq Unix command.
uniq -D Demo.txt
1. displays non-repeated lines
2. displays only repeated lines
3. 1 and 2
4. none above
29. Choose the best option that is true regarding the following egrep command.
egrep -w hello Demo.txt
1. displays all the lines containing the whole word hello
2. displays all the lines that contain h, he, hel, hell or hello
3. displays the number of lines (line-count) that contain the word hello
4. none of above
30. Choose the option that is FALSE.
1. Associative array is created in only in PL/SQL block
2. Varray is only dense
3. Associative array subscript is string or integer
4. Number of elements in nested table are bounded
31. Choose the right option for the blank in the following associative array to compile successfully.
DECLARE
TYPE marks IS TABLE OF NUMBER INDEX BY VARCHAR2(20);
student marks;
BEGIN
student('Rao') := 55;
student('Yadav') := 65;
student('Reddy') := 75;
------------------------------- -- blank here
END;
Which option prints Rao ?
1. dbms_output.put_line(student.FIRST);
2. dbms_output.put_line(student(‘rao’));
3. dbms_output.put_line(student(student.FIRST));
4. dbms_output.put_line(student(student.FIRST));
32. Choose the right option for the blank to create a Varray.
declare
type month1 is varray(13) of VARCHAR2(20);
month2 month1;
begin
----------------------------------------------- -- blank here
FOR i IN month2.first .. month2.last LOOP dbms_output.put_line(month2(i)); END LOOP;
end;
1. month2 := month1(‘Jan’,’Feb’,’Mar’,’Apr’,’May’,’Jun’,’Jul’);
2. month1 := month2(‘Jan’,’Feb’,’Mar’,’Apr’,’May’,’Jun’,’Jul’);
3. month2 := month2(‘Jan’,’Feb’,’Mar’,’Apr’,’May’,’Jun’,’Jul’);
4. none above
33. Choose the right option for the blank that prints all the records of Customers table.
DECLARE
TYPE custom1 IS RECORD
(
abc Customers.cname%TYPE,
def Customers.ccost%TYPE
);
TYPE custom2 IS TABLE OF custom1;
custom3 custom2;
BEGIN
--------------------------------- -- blank here
for i in custom3.first .. custom3.last
LOOP dbms_output.put_line(custom3(i).abc || ' ' || custom3(i).def); END LOOP;
END;
1. SELECT cname, ccost BULKCOLLECT INTO custom3 FROM Customers;
2. SELECT cname, ccost BULK COLLECT INTO custom3 FROM Customers;
3. SELECT cname, ccost BULK_COLLECT INTO custom3 FROM Customers;
4. none above
34. Choose the right option that fits in the blank to iterate all through the records of Customers.
declare
type bulktab1 is varray(200) of Customers%rowtype;
bulktab2 bulktab1;
cursor my_cursor is select cname, ccost, caddress from Customers;
begin
open my_cursor;
fetch my_cursor bulk collect into bulktab2;
close my_cursor;
for i in bulktab2.first .. bulktab2.last loop
dbms_output.put_line(------------------------); -- blank here
end loop;
end;
1. bulktab2[i].cname || ‘,’ || bulktab2[i].ccost || ‘,’ || bulktab2[i].caddress
2. bulktab2(i).Customers.cname || ‘,’ || bulktab2(i).Customers.ccost || ‘,’ || bulktab2(i).Customers.caddress
3. bulktab2.cname(i) || ‘,’ || bulktab2.ccost(i) || ‘,’ || bulktab2.caddress(i)
4. bulktab2(i).cname || ‘,’ || bulktab2(i).ccost || ‘,’ || bulktab2(i).caddress
35. Choose the right option that fits in the blank to iterate all through the records of Employee.
DECLARE
type table_employee is table of Employee%rowtype;
table_employee1 table_employee;
cursor empcursor is select * from Employee;
BEGIN
OPEN empcursor;
LOOP
FETCH empcursor BULK COLLECT INTO table_employee1 LIMIT 200;
----------------------------------- -- blank here
BEGIN
DBMS_OUTPUT.PUT_LINE('Rows affected: ' || table_employee1.COUNT);
FORALL i IN 1 .. table_employee1.COUNT
INSERT INTO Employee VALUES table_employee1(i);
END;
END LOOP;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('Errors in processing: ' || SQL%BULK_EXCEPTIONS.COUNT);
END;
1. EXIT WHEN table_employee1.count = 0;
2. EXIT WHEN table_employee.count = 0;
3. EXIT WHEN empcursor.count = 0;
4. none above
36. Choose the right option that evaluates to FALSE from the following.
1. SQL guarantees database consistency.
2. Classic Query Engine is one of the components of SQL.
3. SQL is flexible because it allows the structure of database to change dynamically even when users are accessing database contents.
4. CASE statements does not allow for conditional logic in SQL statements.
37. Which one of the following options renames Employee table in Oracle.
1. rename Employee Emp
2. rename Employee to Emp
3. modify Employee Emp
4. modify Employee to Emp
38. Choose the right option for the following select statement in Oracle.
select * from Employee where empid is null;
1. does not compile
2. compiles but prints empid column as null
3. compiles but displays ‘no rows selected’
4. none above
39. Choose the right option that is true for the following roles and privileges.
create role manager; — Line 1
grant create table, create view TO manager; — Line 2
revoke create from manager; — Line 3
1. Line 2 raises compilation error
2. Line 3 raises compilation error
3. no errors in the code
4. none above
40. It is required to get all dmart_employees, with matching or without matching, with dmart_departments table. Which one of the following options is the best one to prefer?
table dmart_employees: first_name, dept_id, empsalary
table dmart_departments: dept_id, dept_name
1. SELECT first_name, dept_name FROM dmart_employees de LEFT OUTER JOIN dmart_departments dd ON (de.dept_id=dd.dept_id);
2. SELECT first_name, dept_name FROM dmart_employees de RIGHT OUTER JOIN dmart_departments dd ON (de.dept_id=dd.dept_id);
3. SELECT first_name, dept_name FROM dmart_employees de FULL OUTER JOIN dmart_departments dd ON (de.dept_id=dd.dept_id);
4. none above
SOLUTIONS
1. 2 | 2. 1 | 3. 4 | 4. 3 | 5. 3 |
6. 4 | 7. 2 | 8. 4 | 9. 4 | 10. 1 |
11. 1 | 12. 4 | 13. 3 | 14. 1 | 15. 2 |
16. 4 | 17. 4 | 18. 4 | 19. 3 | 20. 3 |
21. 2 | 22. 3 | 23. 3 | 24. 1 | 25. 3 |
26. 3 | 27. 1 | 28. 2 | 29. 1 | 30. 4 |
31. 1 | 32. 1 | 33. 2 | 34. 4 | 35. 1 |
36. 4 | 37. 2 | 38. 3 | 39. 2 | 40. 1 |