Class XII – Information Technology [802]
CBSE TERM – 2 Examination Question Paper with Solution 2021-22
[Question Paper with Solution | Date: 04-06-2022]
SECTION – A
(Employability Skills)
1. Write about any two interpersonal skills you know?
Answer: (a) Listening (b) Positive body language (c) Positive attitude (d) Stress management
(Write any two)
2. What is Initiative?
Answer: Initiative is the ability to take charge and act in a situation before others.
3. Write the full form of ILO?
Answer: International Labour Organization.
4. What do you understand by the ‘environment quality’?
Answer: ‘Environmental quality is a set of properties and characteristics of the environment, either generalized or local, as they impinge on human beings and other organisms.
5. Explain perseverance and efficiency.
Answer: Perseverance is the ability to continue to do something, even when it is difficult.
Efficiency: Efficiency is the ability to do things well, successfully, without wasting time.
6. What do you mean by ‘adapting to the effects of climate changes’?
Answer: It means, we are preparing ourselves for the worst of the environmental changes and take measures to curb our ways to undo climate changes.
SECTION – B
(Subject Specific Skills)
7. Write the operator used to access members of a class object?
Answer: . (dot operator)
8. Java compiler translates the Java program into ______.
Answer: bytecode
9. Expand the term JVM?
Answer: Java Virtual Machine
10. What is a method?
Answer: Method is the collection of set of statements, which can perform specific tasks.
11. How many primitive data types does Java support in all?
Answer: Eight ( byte, short, int, long, float, double, char, Boolean)
12. What is the size of a Boolean variable in Java?
Answer: 1 Bit
13. Write the use of database management in Railways?
Answer: Uses of database management in Railways: –
- For storing information about train details such as arrival time, departure time, fares, passenger capacity, number of bookings.
- For keeping track of online and offline reservations.
14. How do the following two codes differ:
(a) System.out.print(“Hello World!”);
(b) System.out.println(“Hello World”);
Answer: The first statement (a) print the Hello World and leaves the cursor at the same position. While the second statement (b) print the Hello World and move the cursor to the new line.
15. Identify the errors in the following code and write the corrected code:
public class IFDemo{
public static void main(String [] args) {
int percentage = 55;
String day = “ “;
if percentage >= 40)
System.out.println(“PASSED”) }
else:
{ System.out.Println(“FAILED”);}
Answer: Errors are corrected and underlined
public class IFDemo{
public static void main(String [] args) {
int percentage = 55;
String day = “ “;
if ( percentage >= 40) //missing of (
{ // start curly braces
System.out.println(“PASSED”) ;
}
else
{
System.out.println(“FAILED”); // println should be used.
}
} // missing of }
} // missing of }
16. Differentiate between Short and String data type?
Answer: Short is the wrapper class of short data type. It is used to manage and manipulate short integer type value.
Eg. Short st = new Short(25);
String is a class which is used to create string in java. It provide methods for manipulating string.
Eg. String name = www.mycstutorial.in;
17. Write a method in Java that accepts two numbers as parameters and returns the greater number.
Answer:
int Greatest( int a, int b) { if( a > b) { return a; } else { return b; } } OR int Greatest( int a, int b) { int greater; if( a > b) { greater = a; } else { greater = b; } return greater; }
18. What will be the value of b after the execution of the following code? Also, identify the logical operator being used in the code:
int b = 20; if ((b > 10) && (b < 15)) b = 15; else b = 10;
Answer: Value of b after the execution of program:
10
Logical operator being used in the program is : logical and &&
19. Consider the following class:
Write a command to create a constructor of the above class that initializes the data members of class.
Answer:
public class Stud { // data members .. //Cosntructor Stud( String rno, String sname, String address, double m ){ Rno = rno; Sname = sname; Address = address; marks = m; } // void display( ){ … } }
20. (a) Name the package to be imported in Java to take input form the user at run time.
Answer: java.util package
(b) Consider the following two declarations and differentiate between them:
int a = 50;
Integer b = new Integer(50);
Answer : In the first declaration, an int variable is declared and initialized with the value 50. Where as in the second declaration, an object of the class Integer is instantiated and initialized with the value 50.
The variable a is a memory location and the variable b is a reference to a memory location that holds an object of the class Integer.
21. Write a program in Java to print the average of the first ten numbers.
Answer:
class Average {
public static void main(String[] args) {
int total = 0;
for(int count = 1; count <= 10; count++) {
total = total + count;
}
double average = total / 10;
System.out.println(“Average of 1st ten numbers : “ + average);
}
}
22. (a) Explain wait( ) method in Java threads.
Answer: wait( ) method :- A thread can enter a wait state by invoking the wait() method.
(b) Explain setPriority() method in Java and give the range of priority levels.
Answer : setPriority( ) method in java is used to change the priority level of thread.
The priority levels can range from 1 to 10.
SECTION – C
(Competency-Based Questions)
23. Write the method in Java to accept a string as a parameter from the user and print whether a string contains the characters ‘old’ or not.
Answer:
void checkCotainsOld ( String str) {
if(str.contains(‘old’)){
System.out.println(str + “contains old”);
}
else {
System.out.println(str + “does not contains old”);
}
}
24. Consider the following string variable:
String str1 = “Hello” ;
String str2 = “morning” ;
Write the code statements in Java:
(a) To convert the first letter of string variable ‘str1’ into uppercase.
(b) To display combined length of string str1 and str2.
(c) To display the index value of the first occurrence of letter ‘e’ in str1.
(d) To display str1 and str2 after joining them.
Answer:
(a)
str1 = str1.replace(Character.toString(str1.charAt(0)), Character.toString(str1.charAt(0)).toUpperCase());
System.out.println(str1);
(b) System.out.println(str1.concat(str2).length());
(c) System.out.println(str1.indexOf(‘e’));
(d) str3 = str1.concat(str2)
System.out.println(str3)
25. How are database management concepts helpful in Telecommunications?
Answer: Database Management concepts helpful in Telecommunications in following ways –
(i) For storing information regarding communication networks, customers, call records, and their bills.
(ii) For storing information about the plans offered and plans subscribed by the users.
26. An Airlines company is making a database of its flights and staff. The staff table includes : Emp_id, Emp_name, Emp_dob, E_sal. Give the details of Flight table with its schema.
Answer: Flight Table
Schema : Flight (Flight_Number, Flight_From, Fligh_To, Flight_capacity, Flight_Fare)
Name | Type | Remarks |
Flight_Number | INT(10) | Flight Number, Primary Key |
Flight_From | VARCHAR(30) | Flight Departure from |
Flight_To | VARCHAR(30) | Flight Destination |
Flight_capacity | INT(10) | Seating capacity of flight |
Flight_Fare | DECIMAL(10,2) | Fare of ticket |