CBSE Class 12 Information Technology Question Paper PDF is now available for download. CBSE conducted the Class 12 Information Technology examination on March 13, 2024, from 10:30 AM to 1:30 PM. The question paper consists a total of 24 questions divided among 2 sections.
Candidates can use the link below to download the CBSE Class 12 Information Technology Question Paper with detailed solutions.
CBSE Class 12 Information Technology Question Paper 2024 with Answer Key
| CBSE Class 12 2024 Information Technology Question Paper with Answer Key | Check Solution |
CBSE Class 12 2024 Information Technology Questions with Solutions
SECTION A
(Multiple Choice Type Questions)
Question 1(a):
A ______ is a group of words that communicate a complete meaning.
View Solution
Solution: A sentence is a fundamental unit of language that conveys a complete thought, idea, or feeling. It typically contains a subject and a predicate, expressing a coherent and independent message. Understanding the role of a sentence is crucial in effective communication.
Question 1(b):
In the acronym 'SMART' to set goals, the letter ‘S' implies ______.
View Solution
Solution: In the context of goal setting, the acronym SMART stands for Specific, Measurable, Achievable, Relevant, and Time-bound. 'Specific' means the goal should be well-defined and clearly stated, leaving no room for ambiguity. It is a vital part of making a goal easily understandable and actionable.
Question 1(c):
______ is a state of feeling upset, annoyed and hopeless.
View Solution
Solution: Stress, depression, and similar states of emotional distress involve experiencing feelings of upset, annoyance, and hopelessness. These emotional states can significantly impact productivity, mental well-being, and overall performance. Understanding and addressing these feelings is essential to maintain a positive work environment.
Question 1(d):
In a spreadsheet, the ______ shows the location of selected cell.
View Solution
Solution: In a spreadsheet application, the 'Name Box' displays the cell address or name of the currently selected cell. It's typically located near the top-left corner of the worksheet. The name box helps users easily navigate the worksheet and also identify the specific location of data they are currently looking at.
Question 1(e):
A/An ______ entrepreneur is a type of entrepreneur who creates a new market for his services or provides a service in an existing market.
View Solution
Solution: A service entrepreneur is a person who creates an enterprise centered around providing intangible services, rather than physical goods, to customers. This might include businesses that focus on consultation, technical support, etc., and aim to provide these services either in a new or existing market. The focus is on value creation through the provision of labor, skills and expert knowledge, and not physical products.
Question 1(f):
______ farming is the process by which we can grow plants in an environmental friendly way.
View Solution
Solution: Organic, eco-friendly, green, or hydroponic farming are all methods of agriculture that prioritize environmental sustainability and minimizing negative impacts on ecosystems. These practices focus on growing plants without synthetic pesticides or fertilizers, using methods that conserve water and other resources, and often focus on reducing carbon emissions.
Question 2(a):
______ is produced by processing data.
View Solution
Solution: Data in its raw form is often unstructured and meaningless on its own. Processing data, which involves converting it to a meaningful and usable form, generates information. This means organizing, analyzing and structuring data into a context, giving it value and relevance.
Question 2(b):
How many primitive data types are supported by Java?
OR
byte, short, int, long, float, double, char, boolean
View Solution
Solution: Java supports 8 primitive data types, which are the basic building blocks for representing data in the programming language. These include byte, short, int, long (used for integers), float, double (used for floating-point numbers), char (used for single characters) and boolean (used to represent true or false). Understanding these is crucial for writing programs in Java, as they determine the kind of values a variable can store.
Question 2(c):
Which one of the following commands is used to delete the table from the database?
View Solution
Solution: In SQL (Structured Query Language), the DROP command is specifically used to remove a table along with its data and schema, from a database. It is a Data Definition Language (DDL) command used to remove complete tables, and once a table is dropped, it cannot be recovered. The DELETE command is used to remove data within the table, not the table itself.
Question 2(d):
______ method in Java is used to concatenate the specified string at the end of the given string.
View Solution
Solution: The “concat()” method is a built-in function in Java String class which allows strings to be combined. Specifically, it takes another string as input and adds it to the end of the existing string object on which it is called. Understanding this method is crucial for manipulating strings in Java.
Question 2(e):
NeGD stands for
View Solution
Solution: The acronym NeGD stands for National e-Governance Division. It's a key division within the Ministry of Electronics and Information Technology, responsible for supporting e-governance initiatives in India. Understanding its role is vital in the context of ICT enablement by the Indian government.
Question 2(f):
What is the advantage of Java Virtual Machine?
OR
Once a program is compiled into bytecode, it can run on any platform.
OR
It translates the byte code into machine code and then executes it.
View Solution
Solution: Java Virtual Machine (JVM) provides a platform-independent environment for running Java bytecode. Once the Java program is compiled, it produces bytecode. This bytecode can be run on any system that has the JVM installed, which makes Java a highly portable programming language. This portability is the single biggest advantage of the JVM and is used in creating all kinds of applications.
Question 2(g):
In which phase of web based application development, will the feasibility of the project be checked?
View Solution
Solution: The feasibility of a web application is checked in the 'Requirement Definition Phase', where project scope, objective and viability are analyzed. This phase comes before the detailed design, where all the functional and non-functional requirements of a project are analyzed and documented.
Question 3(a):
Write any two logical operators in Java.
View Solution
Solution: Logical operators in Java perform logical operations on Boolean expressions. && (AND) returns true only if both operands are true. || (OR) returns true if either of the operands is true. ! (NOT) is a unary operator that reverses a boolean value (i.e., if it is true, NOT will return false and vice versa).
Question 3(b):
State True or False. “Java is not a portable language.”
OR
Java is a portable language.
OR
Portable
View Solution
Solution: Java is actually known for its portability, which means that Java code can be written once and run on multiple operating systems like Windows, macOS, Linux etc. This is achieved because of the Java Virtual Machine (JVM), which converts the byte-code of Java to machine-specific code.
Question 3(c):
The ______ aggregate function in SQL is used to find the average of all the values for an attribute in a table.
View Solution
Solution: The AVG function in SQL is specifically used to find the average value of a particular numerical attribute (column) in a table. It helps provide insights into the central tendency of data. The MAX function gives the maximum value, MIN the minimum value, and COUNT gives the number of rows.
Question 3(d):
Name any two educational websites.
- www.ncert.nic.in
- www.coursera.org
- www.w3schools.com
- www.khanacademy.org
- www.eagetutor.com
- www.udacity.org
- www.edx.org
- www.gcflearnfree.org
View Solution
Solution: There are many websites that are designed to cater to education. Websites like NCERT provide access to Indian textbooks, while other sites like Coursera, Khan Academy, and W3Schools provide different kinds of free courses.
Question 3(e):
In SQL, ______ constraint is used to restrict the values within a range in a relation.
View Solution
Solution: In SQL, the CHECK constraint is used to set the data within a range. This way, you can control the data values that can be added to a table. It allows you to specify certain conditions that must be met by the data in a column. For example, checking for a minimum or maximum value, or a specific format.
Question 3(f):
In a web application development process, data connectivity between front-end interface and back-end database happens in the ______ phase.
View Solution
Solution: In the software development lifecycle, the Implementation phase is when the actual code is written and the connections between the front-end and back-end components are established. This includes data connectivity between the user interface and the database, which allows data to be retrieved, manipulated and stored in the application.
Question 3(g):
The ______ statement in Java is used to execute a block of code matching one value out of many possible values.
View Solution
Solution: The switch statement in Java is used to select and execute a particular block of code based on the value of a variable. It provides an efficient way to handle multiple cases based on variable values. Other options like if with ‘OR' or if... else if... else can also be used, though ‘switch’ provides a more structured solution for such cases.
Question 4(a):
Which of the following ICT enabled services have not been set up by the Indian Government?
View Solution
Solution: The Indian government has initiated several ICT-enabled services to make life easier for the citizens. Registration of birth and death certificates, submission of RTI applications are some of the many services that are enabled via ICT. Purchasing of movie tickets is mainly in the private sector.
Question 4(b):
Sohan has created a table, STUDENT in RDBMS. He now wants to add another field, PERCENTAGE, which is of type integer, to the table. Write the command that will help Sohan to complete his task.
Alter table student add percentage int;OR
Alter table student add percentage integer;OR
Alter table studentOR
Add percentage integer/int
View Solution
Solution: The ALTER TABLE command in SQL is used to modify the structure of an existing table. This question requires the user to use the ALTER TABLE command along with the ADD keyword to add a column of integer type in the database.
Question 4(c):
Name any two ICT tools that can be used for e-Governance.
View Solution
Solution: Many ICT tools are used in e-Governance, including devices and networks. Mobile phones with internet access can be used for citizen portals. Broadband provides connectivity, while desktops and laptops allow public officials to maintain databases.
Question 4(d):
______ method of Arrays class in Java helps us to search for a specific element in the array.
View Solution
Solution: The binarySearch() method of the Arrays class in Java is a very efficient searching method that uses a divide-and-conquer approach. This method is much faster than linear search (find or search).
Question 4(e):
The number of rows in a relation is called the ______ of a relation.
View Solution
Solution: In relational database terminology, the cardinality refers to the number of rows (or tuples) in a table (relation). Cardinality defines the size and scale of your data.
Question 4(f):
Predict the output : System.out.print(“Hello”); System.out.println(“Java”);
OR
Hello
Java
View Solution
Solution: The statement “System.out.print(“Hello”);” will print “Hello” on the screen. The statement “System.out.println(“Java”);” will print “Java” on the next line.
Question 5(a):
Name any two domains where database applications may be used.
- Hospital
- School
- Banking
- Government sector
- Education
- Companies
- e-Commerce
- Airlines
- Railways
- Telecommunications
- Hotels
View Solution
Solution: Database systems are used extensively in various domains to store, manage, and retrieve data. They are a core component of almost all software applications. Hospitals need it to manage patient records, schools to handle student databases, banks to maintain accounts and transactions, and e-commerce to manage inventory and customer data.
Question 5(b):
To show the structure of created table in the database, ______ command is used.
View Solution
Solution: In SQL, the DESC (or DESCRIBE) command is used to display the structure of a table including column names, data types, constraints and keys. It's an important command to view metadata of tables.
Question 5(c):
______ keyword is used to create a new class in Java program.
View Solution
Solution: The 'class' keyword in Java is used to declare a class, which is a blueprint for creating objects. It acts as a template for data and methods.
Question 5(d):
Write the SQL command to display all the details of teachers from the table "Teacher" whose salary is greater than 15000.
Select * from Teacher where salary > 15000 ;OR
Select * from Teacher where salary > 15000
View Solution
Solution: The SQL SELECT statement with the WHERE clause allows filtering rows based on specific conditions. This is used to select all details from the “Teacher" table where the value of the 'salary' is greater than 15000.
Question 5(e):
OOP stands for
View Solution
Solution: The acronym OOP stands for Object-Oriented Programming, a programming paradigm that uses concepts like classes, objects, inheritance, and polymorphism to structure software.
Question 5(f):
Which keyword helps to make a data member of a class visible only within the class?
View Solution
Solution: The 'private' keyword is used in Java to restrict the visibility of a class member (variables or methods) to within the class itself. This means it cannot be accessed directly from outside the class, and promotes encapsulation and data hiding.
Question 6(a):
Which of the following is a valid variable declaration?
View Solution
Solution: In programming languages such as Java, valid variable names must begin with a letter, a dollar sign ($), or an underscore (_). It cannot contain spaces or special characters, except the dollar and underscore symbols. Therefore, ‘yesno’ is a valid variable name.
Question 6(b):
While creating a table in MYSQL database, Sudha wants to set the value for the field Age as 0. This value will be inserted if no value of age is given by the user. Suggest a constraint that Sudha can use to complete her task.
View Solution
Solution: The DEFAULT constraint in SQL is used to set a default value for a column. If no value is provided for the column during insertion, it will automatically use this default value.
Question 6(c):
Name the national portal which provides a single window access to information and services being provided by various government entities.
OR
india.gov.in
OR
india.gov
View Solution
Solution: The National Portal of India, accessible at www.india.gov.in, serves as a single window access for all government-related information and services. This is a part of the government's effort to bring all digital initiatives into a common online platform.
Question 6(d):
What will be the output of the Java code given below?
int a = 20;
int b = 30;
a += b;
System.out.println(a);
View Solution
Solution: In the Java code, integer variables “a” and “b” are declared and initialized as 20 and 30 respectively. The ‘+=’ operator means that the value of 'a' will be updated to 'a + b', i.e. 20 + 30, and the output will be 50, which will be printed on the console with the command 'System.out.println(a)'.
Question 6(e):
Which one of the following is not a DML command?
View Solution
Solution: Data Definition Language (DDL) commands like CREATE, ALTER, DROP are responsible for structuring the database schema. Data Manipulation Language (DML) commands like INSERT, SELECT and DELETE are used to manipulate and manage data. Hence, SELECT, INSERT and DELETE are all DML commands, while CREATE is not.
Section B
(Subjective Type Questions)
Answer any 3 out of the given 5 questions on Employability Skills. Answer each question in 20 30 words
Question 7:
Write any two ways to maintain positive attitude.
View Solution
Solution:
- Start the day with a morning routine: Developing a daily morning routine which includes activities like positive affirmations, smiling and listing the tasks you plan to accomplish for the day will help you start your day with a more positive outlook.
- Feed the mind with positivity: Always read motivating books, or listen to music with uplifting lyrics or watching inspirational movies. Avoid negative content.
- Be proactive: A proactive person decides how one must feel regardless of what may be going around or what the day may bring.
- Focus on solutions, not problems: One should focus on the solutions, and view problems as challenges to solve, not roadblocks that cannot be crossed.
- Learn from failures: People with positive attitude focus on the positives, even in negative events. They think about what could have been better and work towards their goals.
- Focus on the present moment: Negativity often stems from anxiety about the past and future events. By practicing mindfulness, and focusing on the present, this can be avoided.
- Move towards your goals and dreams: A person with positive attitude is always actively working on achieving their goals, and is cheerful and works hard.
Question 8:
What are the different stages of active listening? Write the names of any four stages.
View Solution
Solution:
- Receiving: The initial stage involves paying attention to the words and non-verbal cues being transmitted by the speaker, and avoiding any kind of interruptions or distractions.
- Understanding: In this step, the listener tries to understand the meaning, context, and intent of the speaker's message. The aim is to clearly grasp what they mean.
- Remembering: During the remembering phase, the listener retains the key points and details from the conversation. This requires effort and focus, to be able to understand the message correctly.
- Evaluating: In the evaluating stage, the listener analyzes the content and the meaning and tries to understand what the speaker was trying to convey. It also means analyzing any bias in the message.
- Responding / Feedback: This stage involves offering appropriate responses to the speaker, and it can be verbal and non-verbal. Feedback shows your engagement.
Question 9:
How can we reduce greenhouse gas emission?
View Solution
Solution:
- Buy energy-efficient appliances: Using energy-efficient appliances will reduce the overall energy needs, and contribute to reduced greenhouse gases as a result.
- Conserve energy: Using electricity and other forms of energy judiciously in your daily life can help in reducing greenhouse gas emissions, and will also reduce your energy bill.
- Reduce household waste: Reducing household waste is a very important step. Recycling and reusing materials will reduce landfill waste, which produces methane, a potent greenhouse gas.
- Plant more trees: Trees absorb carbon dioxide (CO2), which is a major greenhouse gas. Planting more trees helps in reducing this greenhouse gas from the atmosphere.
- Reduce the use of fossil fuels: The burning of fossil fuels like coal, petrol and natural gas, is the major reason for greenhouse gas emission. Reduced usage of vehicles and encouraging public transport can help in this regard.
- Use CNG: Using compressed natural gas (CNG) is more eco-friendly than using traditional petrol and diesel, as it produces lesser harmful gases.
- Choose renewable energy: Shifting to renewable sources of energy like solar, wind and hydro power will also greatly reduce our dependency on fossil fuels.
Question 10:
Write any two benefits of goal setting by an entrepreneur.
View Solution
Solution:
- Motivation and Completion: Setting goals helps an entrepreneur in creating a pathway to complete what they have started. Clear goals create motivation and give a clear direction to work.
- Makes one work harder: With clear and achievable goals, an entrepreneur will be motivated to work harder and diligently to reach the desired milestone.
- Provides Clarity and Focus: Goals give entrepreneurs a focused direction by providing clear objectives and purpose, thereby reducing distractions.
- Help in measurement: Goals provide metrics to measure progress, and help an entrepreneur understand whether they are moving in the right direction.
- Give direction: Clear goals help them stay on track and act as the north star for them.
Question 11:
Write the steps to save a presentation in LibreOffice Impress.
View Solution
Solution:
- Click on the File Menu: Start by clicking on the File menu option on the menu bar.
- Select Save or Save As Option: Select the "Save" option if it's a first-time save or if you want to overwrite the existing file, or use the “Save As” option from the drop-down menu if you wish to save the document as a new file.
- Click on Save Icon: You can also select the save icon, which is available in the toolbar, to perform the same steps.
- CTRL+S Shortcut: Alternatively, you can also use the shortcut keys by pressing the Control button (CTRL) along with 'S' on the keyboard.
- The Save As dialog box appears: Once you click on any of the above options, a 'Save As' dialog box will appear.
- Select folder and name the file: In the ‘Save As’ dialog box, select the folder where you want to save your file, and then write the file name.
- Click on the Save Button: Finally, press the ‘Save’ button.
Question 12:
Give the output of the following code segment:
public class test {
public static void main(String[] args) {
int num = 5;
while (num > 1) {
System.out.println("**" + num * num);
--num;
}
}
}
**25
**16
**9
**4
View Solution
Solution: The code segment defines a ‘while’ loop that executes as long as the value of the variable 'num' is greater than 1. Inside the loop, it prints a string with asterisks followed by the square of the current value of num. After printing, it decrements ‘num’.
Question 13:
What is DBA? Write any one responsibility of DBA.
View Solution
Solution:
What is DBA? DBA stands for Database Administrator. A Database Administrator is a professional who is responsible for managing, maintaining, and securing an organization's database systems. DBAs are crucial in ensuring data availability, integrity, and security by managing all aspects of the databases.
Responsibility of a DBA: One key responsibility of a DBA is to administer the database and the database management system (DBMS). This includes various aspects of the day-to-day management, maintenance and support of the underlying software and the actual databases. This may include tasks such as setting up the database initially, configuring the software, and overseeing database operations to ensure they are running efficiently.
Question 14:
Differentiate between CHAR(n) and VARCHAR(n) data types of MySQL. Give examples to support your answer.
View Solution
Solution:
CHAR(n): The CHAR(n) data type in MySQL is used to store fixed-length character strings, where 'n' specifies the length of the string. It reserves the specified number of characters even if the actual stored string is shorter than that. It is mainly used when all data entries will be of the same length.
Example: A good example would be storing a fixed-length ID such as a product code, which is always 5 characters. If you define it as CHAR(5) then any data that has a length less than 5 will also allocate the same space.
VARCHAR(n): VARCHAR(n) is a variable-length data type in MySQL. It stores variable character strings up to 'n' characters. It only allocates the space which is required to store the actual string, rather than fixed space.
Example: A good example would be to store names, which can vary in lengths. If a name has 10 characters, only 10 characters will be stored by the database.
Question 15:
Aalam wants to create a database to manage the purchase and sale of items in his departmental store. The ITEMS table in the database contains information of all items that he sells in his store. Give details of ITEMS table along with its schema.
View Solution
Solution:
Schema of the ITEMS Table:
A schema is the structure of a database and this defines how the data will be organized.
Table Name: ITEMS
Columns (with Data Types and Constraints):
- Item_Code: INT(10), Primary Key: A unique identifier for each item, set as an integer with a maximum of 10 digits. This also acts as a primary key, meaning this value will be unique, and will be the key identifier for the row.
- Item_Name: CHAR(20)/VARCHAR(20): The name of the item is stored as a string with a maximum of 20 characters. It can be a fixed length or a variable length data type, depending on preference.
- Price: INT(10): The price of the item is stored as integer.
- Qty: INT(10): The quantity of the item available is stored as integer.
- Details: The ITEMS table will contain complete information of all the items sold at the store, and will also facilitate managing the store inventory and sales data.
Question 16:
Differentiate between while loop and do while loop in Java.
View Solution
Solution:
while loop:
The 'while' loop is an entry-controlled loop, meaning that the condition is checked before the execution of the code body. This means that if the condition is initially false, the code block within the loop will not execute even once.
It continues to execute a block of code as long as a specified condition remains true. If the initial condition is false, the while loop code body will never execute.
Example:
int i = 0;
while (i < 5) {
System.out.println(i);
i++;
}
do-while loop:
The 'do-while' loop is an exit-controlled loop, which ensures that the loop will always execute at least once, as the condition is checked at the end of the loop block.
It executes a block of code at least once and then repeats as long as a specified condition is true. This makes it appropriate when you want a particular block to always execute once at least.
Example:
int i = 0;
do {
System.out.println(i);
i++;
} while (i < 5);
Use code with caution.
Question 17:
Complete the following code in JAVA, that prints the number (either 0 or 1) in words:
public class word
public static void main (string[] args)
int number = 0;
(number)
case 0 : system.out.println(“ZERO”); ;
case 1: system.out.println(“ONE”);
break; : system.out.println(“NEITHER ZERO NOR ONE”);
View Solution
Solution:
public class word {
public static void main(String[] args) {
int number = 0;
switch (number) {
case 0:
System.out.println("ZERO");
break;
case 1:
System.out.println("ONE");
break;
default:
System.out.println("NEITHER ZERO NOR ONE");
}
}
}
The code block was missing a keyword before the curly braces. The correct keyword is `switch`.The
case 0 block was missing a break; statement to ensure that the program does not continue to the next case if this is already true.The
default case was also missing.
Question 18(a):
Vikrant has given the following query but it has errors. Rectify the errors and underline the correction made. Select name, age from teacher where name "_a%";
Select name, age from teacher where name like '_a%';
View Solution
Solution: The error is that the "=" sign should be replaced with the 'like' keyword to do pattern matching on the name field. The corrections are shown with underlines.
Question 18(b):
Explain the GROUP BY clause in SQL with an example.
View Solution
Solution:
Explanation: The GROUP BY clause in SQL is used to group rows that have the same values in one or more columns, particularly when used with aggregate functions (like COUNT, SUM, AVG, MIN, MAX) on other columns. The GROUP BY clause combines the rows based on a common attribute. This allows to perform calculations and retrieve specific information about each group.
Example: To find the number of teachers teaching in each department, the following query can be used:
SELECT Dept_No, Count(*)
FROM Teacher
GROUP BY Dept_No;
In this example, all the rows from the Teacher table are grouped based on their respective department numbers, and the number of teachers is then counted for each group using the COUNT aggregate function.
Question 19:
State the applications of database management systems in the field of education.
View Solution
Solution:
- Storing Staff Information: Database systems are used for storing and managing information about teaching and non-teaching staff, including their personal data, qualifications and roles within the institution. This helps in keeping an organized record of the staff members.
- Storing Details of Infrastructure: Databases are essential for tracking information about physical assets and resources, such as classrooms, labs, libraries and hostels, and their maintenance. This helps in keeping a record of all of the infrastructure.
- Student Data Management: They can be used to manage all kinds of student data such as personal details, attendance, academic records, fee details, and various aspects of student life. This provides a centralized database for student information.
- Performance Tracking: They are also used to track student performance, manage grades and generate detailed reports, which can help in analyzing the performance and identifying areas where students might require extra support.
- Personalized Learning and Communication: Databases also facilitate personalized learning experiences, as the system can collect learning data, and also improve communication with students, parents and staff. This leads to overall better student results.
- Data of Alumni Members: It can also be used to store and manage the data of alumni and help in building an alumni network.
Question 20(a):
Read the given Java code carefully and give the output:
public class StringDemo {
public static void main(String[] args) {
String myString = "Welcome Java";
System.out.println(myString.toUpperCase());
System.out.println(myString.indexOf('o'));
System.out.println(myString.contains("come"));
}
}
WELCOME JAVA
4
true
View Solution
Solution: The code initializes a String variable “myString” with the value “Welcome Java”. The first 'println' statement uses the 'toUpperCase()' method, which converts all characters in the string to uppercase and prints “WELCOME JAVA”. The second 'println' statement uses the ‘indexOf(‘o’)’ method, which returns the first occurrence of the character ‘o’ in the string “Welcome Java”. The index starts from 0, and the output will be 4. The third 'println' statement uses the 'contains(“come”)' method, which checks whether the given string contains a substring called “come”. Since “Welcome” contains “come” in it, the output is true.
Question 20(b):
Consider the following string in Java: String quote = “Stay Safe”; Write a statement to replace “Safe” with “Secure”.
quote.replace("Safe", "Secure");
View Solution
Solution: The command for replacing the string is: quote.replace("Safe", "Secure"); This statement will replace all instances of “Safe” with “Secure” in the string object 'quote'.
Question 21(a):
Write a program in Java to display area of a rectangle. Note: Assign any imaginary values to the variables used in the program.
View Solution
Solution:
public class AreaRect {
public static void main(String[] args) {
int l = 20, b = 30, area;
area = l * b;
System.out.println("Area of rectangle is " + area);
}
}
The program declares integer variables “l” and “b” and initializes them with some values and then calculates the area of the rectangle using the formula area = length * breadth. The result will be displayed to the user using the println() command.
Question 21(b):
What is the difference between = and == operator in Java? Give example to support your answer.
View Solution
Solution:
= (Assignment Operator): The single equals sign “=” is an assignment operator. It is used to assign a value on its right to the variable on its left.
Example:
b = 20;
In this case, the value 20 will be assigned to variable 'b'.== (Relational / Comparison Operator): The double equals sign “==” is a relational or comparison operator. It is used to compare two values and checks if they are equal. It returns true if two values are equal, and it returns false if the values are unequal.
Example:
5 == 5;
This code will return true, as the values on both sides are equal.
Question 22(a):
Give one difference between a webinar and a video tutorial.
View Solution
Solution:
Webinar: Webinars are live, real-time lectures where users can participate in the session, ask questions, and interact with the presenter in real time. It offers the possibility of real-time interaction with the presenter.
Video Tutorial: Video tutorials are pre-recorded videos or slides of lectures which can be watched at the user's own pace.
Question 22(b):
The organization or company providing the online reservation facility to the users has several advantages. Give any two of these advantages.
View Solution
Solution:
- Reduced Staffing Costs: Online reservation systems often lead to reduced staffing needs as they automate processes that may have been done manually. This saves costs and improves efficiency.
- Improved Efficiency: Online systems automate processes like booking, confirmation and payment, thus improving the overall efficiency of the system and reduces workload. This is a cost-effective approach for most companies.
Question 22(c):
Anil wants to book a flight from Delhi to Mumbai through online reservation. He has opened the website for flight reservation and logged in using his userid and password. Write the steps that he should follow now to complete his booking.
View Solution
Solution:
- Search for Available Flights: Anil should first use the search feature of the website by entering details such as source (Delhi), destination (Mumbai), date of travel, and any other details such as the number of passengers.
- Select Flight and Seat: Next, he should select the desired flight from the list of options, and also select the seats. Then he should confirm his selection.
- Make Payment: After selecting the seat, he should make payment using one of the options given on the page.
- Download the E-ticket: Once payment is complete, Anil must download the e-ticket or receive the confirmation via mail, which completes the process.
Question 23(a):
Define the term Array with respect to Java.
View Solution
Solution: In Java, an array is a variable that can hold multiple values of the same data type. It is a container that stores a fixed number of elements of a specified type. Arrays are helpful for storing and managing collections of data elements of the same type.
Question 23(b):
Explain the access modifiers and their types in Java.
View Solution
Solution:
Access Modifiers: In Java, access modifiers are keywords used to control the visibility of class members, like variables, methods, and constructors. They decide whether a member is visible inside the class, within the package, or outside the package.
Types of Access Modifiers:
- Private: Private members of a class are only accessible from within the class itself. They cannot be accessed from any other class. It ensures encapsulation and information hiding.
- Public: Public members of a class can be accessed from anywhere, both inside and outside the class. This gives the greatest degree of accessibility.
- Protected: Protected members can be accessed within the same class, within the same package, and by subclasses in another package.
- Default (No modifier): When no access modifier is declared for a member, it defaults to package-private visibility, meaning that they are visible to all classes within the same package, but not outside of it.
Question 24(a):
Consider the following and answer the questions. (a) Write an SQL command to create a table TravelAgency whose description is given below:
| Column Name | Data Type | Constraint |
|---|---|---|
| AgentCode | Char(4) | Primary Key |
| AgentName | Varchar(20) | Not Null |
| Location | Varchar(25) | |
| Package | Varchar(30) | |
| Charges | Decimal |
View Solution
Solution: The SQL command is:
CREATE TABLE TravelAgency (
AgentCode CHAR(4) PRIMARY KEY,
AgentName VARCHAR(20) NOT NULL,
Location VARCHAR(25),
Package VARCHAR(30),
Charges DECIMAL
);
This command uses CREATE TABLE to define a table called TravelAgency, and creates columns with specified names, datatypes, and constraints.
Question 24(b):
Write the command to add a new row to a table TravelAgency with the following data: (“A005”, “Raman”, “Grover Travel”, “Domestic”, 8000)
View Solution
Solution: The SQL Command for adding the new data:
INSERT INTO TravelAgency VALUES ('A005', 'Raman', 'Grover Travel', 'Domestic', 8000);
OR
INSERT INTO TravelAgency (AgentCode, AgentName, Location, Package, Charges)
VALUES ('A005', 'Raman', 'Grover Travel', 'Domestic', 8000);
This command inserts the new data as a new row into the ‘TravelAgency’ table.
Question 24(c):
Write a query to remove the column Package from the table Travel Agency.
View Solution
Solution: The SQL Command for removing the column:
ALTER TABLE TravelAgency
DROP Package;
OR
ALTER TABLE TravelAgency
DROP COLUMN Package;
This query changes the table by removing the column 'Package'.








Comments