12 - IT - PA2 - 2024-25 - Answerkey
12 - IT - PA2 - 2024-25 - Answerkey
Page 1 of 6
St. Mary’s School Dahod
6. In a java program Rajat wants to use a variable to store the quantity of an item which may be in whole
numbers or decimals. Write a suitable java statement to declare the variable for the above mentioned purpose.
Answer: He can use float or double type of variable. double num; or float num;
7. Write the output of the following SQL queries: SELECT INSTR(‘INTERNATIONAL’,
‘NA’); Answer:6
Q3.Answer any 6 out of the given 7 questions
1. Java is also a general-purpose programming language for developing programs that are easily usable and
portable across different ____.
a) Tables b) Stands c) Platforms d) Libraries
2. How can we write comments in Java programs.
a) Two forward slashes(//) b) /* and */ c) Both a) and b) d) None of
these
3. What data type has a fixed length in the database.
a) Varchar(n) b) Char(n) c) Longvarchar(n) d) None of the above
4. You have a table called "employees" with columns "department" and "salary." You want to find the highest
salary in each department and display the results in descending order of salary. Which SQL clauses should
you use for this query?
a) GROUP BY, HAVING, ORDER BY b) GROUP BY, ORDER BY
c) HAVING, ORDER BY d) HAVING, GROUP BY
5. _________ website provides a single window access to information and services being provided by the
various Indian Government entities.
a) india.gov.in b) goidirectory.nic.in c) data.gov.in d) None of the above
6. Which of the following is an invalid variable declaration?
a) my_string_1 b) 1st_string c) mystring1 d) _mystring1
7. This portal is a one point source to access all Indian Government websites at all levels and from all sectors.
Name the portal___________.
Q4. Answer any 5 out of the given 6 questions
1. Programs written in Java are compiled into __________ Language.
a) Machine b) Assembly c) C++ d) Java
2. The _________is used to execute a block of code matching one value out of many possible values.
a) If Statement b) Switch Statement c) For Statement d)None of the
above
3. Choose the correct command for the table GARMENTS for following purpose. To delete the record with
GCode as 116
a) Delete * from GARMENT where GCode=’116’;
b) Delete from GARMENTS where GCode =116;
c) Delete from GARMENT where GCode =116;
d) Delete from GARMENT where GCode is ’116’;
4. Saumya had previously created a table named ‘Product’ in a database using MySQL. Later on she forgot the
table structure. Suggest her suitable MySQL command through which she can check the structure of the already
created table.
5. Observe the given statements carefully:
a) SELECT * FROM club WHERE salary between 20000 and 30000;
b) SELECT * FROM club WHERE salary IN ( 20000, 30000);
c) SELECT * FROM club WHERE salary >= 20000 and salary <=30000;
d) SELECT * FROM club WHERE salary = 20000 OR salary = 30000;
Make pairs of the equivalent SQL statements given above (which give the same output) and place each
pair in a group.
6. What will be the output of the following code?
int a = 10; int b = 20;
System.out.println(a + b + " is the sum.");
a)30 is the sum. b) 10 + 20 is the sum. c) 1020 is the sum d) error
Page 2 of 6
St. Mary’s School Dahod
Q5. Answer any 5 out of the given 6 questions
1. Give the following code what will be the output of value1?
class AssignmentOperator {
public static void main(String[] args)
{
int value1 = 12, value2 = 24;
value1 += value2;
System.out.println("value1 = " + value1);
}
}
2. Write a program using while loop that prints the number from 1 to 5.
public class WhileLoopExample1 {
public static void main(String[] args) {
_____________
3. Give the output select length(Concat(concat(“inform”,”atics”),”practices”));
4. Give the output select substr(‘ABCDEFG’,3,4) ”Subs”;
5. Underline the errors and write the correct code?
num1, num2 = 10, 45
While num1 % num2 == 0
num1+= 20
num2+= 30
Else: print('hello')
6. A web application is a program that is stored on a ___________
Q6. Answer any 5 out of the given 6 questions
1. Java binary files are actually in a form called_________ that is not specific to any operating system..
a) Bytes b) Binary numbers c) Byte codes d) Byte
2. What are the various operations that need to be performed on a database _____.
a) Defining a database b) Sharing the database
c) Manipulating the database d) All of the above
3. In Java a group of related classes is known as ________
a) Group b) Package c) Method d) None of the above
4. Which of the following SQL queries is used to retrieve rows from the "customers" table where the "email"
column contains NULL values?
a) SELECT * FROM customers WHERE email = NULL;
b) SELECT * FROM customers WHERE email IS NOT NULL;
c) SELECT * FROM customers WHERE ISNULL(email);
d) SELECT * FROM customers WHERE email IS NULL;
5. Creating a strong password is vital. A strong password has:
a) 6-8 Alphanumeric characters b) Special symbols
c) Only numbers d) Both a and b
6. What does the break keyword do in a loop?
a) Terminates the loop b) Skips the current iteration
c) Jumps to the next iteration d)Returns a value from the loop
SECTION B
Answer any 3 out of the given 5 questions on Employability Skills
Page 3 of 6
St. Mary’s School Dahod
a) How many times the above given loop will run and what will be the value of ctr, immediately after
exiting from the loop.
b) Out of entry controlled or exit controlled loop, above given loop will come under which category and why?
Q13. If the variable num1 is equal to 5 and the variable num2 is equal to 10 , how would you evaluate the
logical expression((num1!=5)||(num2==10))&&(num1==5)?show the steps of the evaluation.
Q14. What is the purpose of India Web Directory website?
Q15.A) While creating the table Student last week, Ms. Sharma forgot to include the column Game_Played.
Now write a command to insert the Game_Played column with VARCHAR data type and 30 size into the
Student table?
B) In Marks column of ‘Student’ table, for Rollnumber 2, the Class Teacher entered the marks as 45.
However, there was a totalling error and the student has got her marks increased by 5. Which MySQL
command should she use to change the marks in ‘Student’ table.
Q16.A) SELECT MID(‘HONESTY WINS’,3,4);
B) SELECT RIGHT(CONCAT(‘PRACTICES’,’INFORMATICS’),5);
Answer any 2 out of the given 3 questions
Q17.Write a program to calculate and print the sums of even and odd integers of the first n natural numbers
using a while loop.
Q18. What are the Limitations of using DBMS Approach?
High Cost: The cost of implementing a DBMS system is very high. It is also a very time
consuming process which involves analyzing user requirements, designing the database
specifications, writing application programs and then also providing training.
Security and Recovery Overheads: Unauthorized access to a database can lead tothreat to
the individual or organization depending on the data stored. Also the data must be regularly
backed up to prevent its loss due to fire, earthquakes, etc. Hence the DBMS approach is
usually not preferred when the database is small, well defined, less frequently changed and
used by few users.
Page 4 of 6
St. Mary’s School Dahod
a) With reference to the above given table, give query for generating following output
Cust_Name
Dhashmesh
Sanya
Ishaan
b) Give the output of : Select Cust_Name, Open_Bal from Customer order by
Open_bal;
c) Pranay has given the following command to obtain Highest Opening Balance of each City
d) Display the first two letters of each customer’s name.
Q23. What are the advantages of online reservation system?
Q24. Table: Sales
Page 5 of 6
St. Mary’s School Dahod
a) Write a query to find the total quantity sold for each product.
SELECT Product, SUM(Quantity) AS TotalQuantity
FROM Sales
GROUP BY Product;
b) Write a query to find the total revenue generated by each salesperson\
SELECT Salesperson, SUM(Quantity * Price) AS TotalRevenue FROM Sales GROUP BY Salesperson;
c) Write a query to find the products where the total quantity sold exceeds 20
SELECT Product, SUM(Quantity) AS TotalQuantity FROM Sales GROUP BY Product HAVING
SUM(Quantity) > 20;
d) Write a query to group the sales by category and find the total quantity sold for each category.
SELECT Category, SUM(Quantity) AS TotalQuantity FROM Sales GROUP BY Category;
Page 6 of 6