CL 12 INFO TECH, SQP-Term-II
CL 12 INFO TECH, SQP-Term-II
MAX. TIME ALLOWED: 1&1/2 Hours (90 min) MAX. MARKS :30
General Instructions:
Water pollution is in its alarming state. This has given rise to the need of
water quality technician to help monitor the water quality and treat it.
2
Q.5 Write any four steps that green jobs can take to reduce greenhouse gas 2
emission.
Q.8 In java who is the responsible to convert .java. File to .class. File? 1
a) Compiler b) interpreter
c) Converter d) JRF
a) Compiler
Wrapper classes provide a way to use primitive data types (int, Boolean,
etc.…) as objects.
c) 2 d) 4
a) 0
In java, getter and setter are two conventional methods that are used for
retrieving and updating value of a variable.
= is an assignment operator.
== is a comparison operator
For example, int a =10; will assign a value 10 to variable a whereas a = =
10 will check whether the value of a is 10.
1. try – a try block surrounds the part of the code that can generates
exception (s)
2. catch – the catch blocks follow a try block. A catch blocks contains
the exception handler – specific code that is executed when the
exception occurs.
Q.16 Write four benefits of online shopping? 2
Int p;
P=14;
do
{
P=p-2;
System. out. display(p);
}
While(p>=2);
Exit control loop.
5
Q.18 Define control flow? What are the 3 types of control flow statement 2
supported by java programming language.
Q.20 Give three differences between while loop and do while loop. 3
While loop
1. A while loop is an entry-controlled loop
2. Body of loop may never be executed
3. The variables in the test condition must be initialized prior to
entering the loop structure.
Do while loop
1. A do-while loop is an exit control loop
2. Body of loop is executed at least once
3. It is not necessary to initialize the variables in the test condition
prior to entering the loop structure.
Q.21 Write a java program to display the values from 1 to 10 using For loop. 3
A variable is placeholder for data that can change its value during program
execution. Technically, a variable is the name for a storage location in the
computer’s internal memory.
1. the first character must be a letter or an underscore (_). you cannot use a
number as the first character.
2. the rest of the variable name can include any letter, any number, or the
underscore. You can’t use any other Characters, including spaces, symbols, and
punctuation marks.
3. java is a case – sensitive language. variable names written in capital letters
differ from variable name with the same spelling but written in small letters. E.g.,
variable named Interest _Rate is treated as an entirely different variable than
one named interest _rate.
4. there’s no limit to the length of variable.
(1 mark for definition.2 marks for correct rule)
7
Q.24 What is the purpose of default in a switch statement? explain with the 2+2
help of an example.
When none of the case values are equal to the expression of switch
statement then default case is executed. In the example below, value of
number is 4 so case 0, case 1and case2 are not equal to number. hence
print1n statement of default case will get executed printing “value of
number is greater than two” to the console.
Example:
Q.25 What are four main OOP concept in java and what are the benefits of 2+2
object-oriented programming?
1) Inheritance
2) Encapsulation
3) Abstraction
4) Polymorphism
Benefits-
1) Re-useability
2) Data redundancy
3) Code maintenance
4) Security
5) Design benefits
6) Better productivity.