Official CBSE Assignments for Class 12 Informatics Practices
Review targeted academic assignments with the CBSE Class 12 Informatics Practices Revision Assignment Set 03. Built according to official CBSE standards for the 2026-27 term, these downloadable Class 12 Informatics Practices worksheets support effective daily practice for All topics.
Solved Practice Assignments for Informatics Practices
Access the complete assignment PDF for Class 12 Informatics Practices below. Regular practice with these targeted academic tasks builds familiarity with standard question patterns and helps secure higher marks in final school evaluations.
Question 1. Differentiate between: a. JTextField and JPasswordField b. JButton and JFrame c. JCheckBox and JRadioButton d. JComboBox and JListBox e. JTextField and JTextArea f. JLabel and JTextField
Answer: a. JTextField: A single-line text component that allows the user to type and edit normal text.
JPasswordField: A single-line text component derived from JTextField that masks the entered characters (usually with dots or asterisks) for secure password entry.
b. JButton: A push-button component that triggers an action or event when clicked by the user.
JFrame: A top-level container window that provides a window frame, title bar, and close buttons to hold other GUI components.
c. JCheckBox: A component that can be selected or deselected independently, allowing multiple options to be chosen simultaneously from a group.
JRadioButton: A component used in a mutually exclusive group (ButtonGroup) where selecting one automatically deselects all other buttons in the same group.
d. JComboBox: A component that combines a button or editable field and a drop-down list, allowing users to select one option from a dropdown menu.
JListBox: A component that displays a static list of scrollable items, allowing single or multiple item selections depending on the configuration.
e. JTextField: A single-line text input box used for short text entries such as names or phone numbers.
JTextArea: A multi-line text area used for displaying or editing plain text spanning multiple lines, such as addresses or descriptions.
f. JLabel: A non-editable display area for static text, images, or both; it cannot accept user input.
JTextField: An interactive component that allows the user to input and modify text values.
In simple words: JTextField allows typing, JPasswordField hides typed text, JButton triggers clicks, JFrame is a window, checkboxes allow multiple choices while radio buttons allow only one, combo boxes drop down, text areas handle multiple lines, and labels display static information.
Exam Tip: Memorize component categories (containers, atomic components, text components) as questions frequently test their specific use cases and visual behaviors.
Question 2. Explain the use of following functions of Java: a. Integer.parseInt() b. Integer.toString() c. Math.round() d. Math.pow() e. length() f. Byte.parseByte() g. substring() h. concat() i. toLowerCase() j. JOptionPane.showMessageDialog() k. next() l. DriverManager.getConnection()
Answer: a. Integer.parseInt(): Parses a string argument as a signed decimal integer.
b. Integer.toString(): Converts an integer value into its string representation.
c. Math.round(): Returns the closest long or int to the argument, rounding ties toward positive infinity.
d. Math.pow(): Returns the value of the first argument raised to the power of the second argument.
e. length(): Returns the number of characters in a string or the number of elements in an array.
f. Byte.parseByte(): Parses the string argument as a signed decimal byte.
g. substring(): Returns a new string that is a substring of the given string, starting from a specified index up to an optional end index.
h. concat(): Concatenates the specified string to the end of another string.
i. toLowerCase(): Converts all the characters in a string to lowercase using the rules of the default locale.
j. JOptionPane.showMessageDialog(): Pops up a standard dialog box informing the user about something.
k. next(): Reads the next token from the input Scanner, terminated by whitespace.
l. DriverManager.getConnection(): Establishes a connection to a specified database URL using JDBC.
In simple words: These built-in Java methods handle data conversions, mathematical calculations, string manipulations, user notifications, input scanning, and database connectivity.
Exam Tip: Be careful with return types and parameters when writing syntax for parsing and math methods.
Question 3. Write any two common properties and two common methods among following: a. JTextField and JTextArea b. JCheckBox and JRadioButton c. JComboBox and JListBox
Answer: a. JTextField and JTextArea:
Properties: text, editable
Methods: getText(), setText()
b. JCheckBox and JRadioButton:
Properties: text, selected
Methods: isSelected(), setSelected()
c. JComboBox and JListBox:
Properties: model, selectedIndex
Methods: getSelectedIndex(), getSelectedItem()
In simple words: Components that serve similar purposes share underlying properties and methods for getting and setting values.
Exam Tip: Property names in NetBeans properties window usually map directly to getter and setter method names in code.
Question 4. Write Java function named tenfolds() that takes a number as parameter and returns its tenth part.
Answer: double tenfolds(double num) {
return num / 10.0;
}
In simple words: The function takes a number, divides it by 10, and returns the result.
Exam Tip: Always specify the correct return type (double or float) and parameter type in function signatures.
Question 5. Write statements to import packages for following: a. for database connectivity through JDBC. b. to use JOptionPane dialog box.
Answer: a. import java.sql.*;
b. import javax.swing.JOptionPane;
In simple words: Import statements make pre-written library classes available in your program.
Exam Tip: Remember that JDBC classes belong to the java.sql package and Swing GUI dialogs belong to javax.swing.
Question 6. Consider the following GUI: [Virus S/W Hut form with customer name, bill amount, payment mode radio/checkbox options, calculate discount button, discount, net amount, and stop button].
If bill amount is greater than 10000 then discount is calculated as follows:
[Cost: 15%, Credit Card: N/L, Cheque: 10%]
i. Write code to make txtNameofCustomer and txtBillAmount uneditable.
ii. Write code for stop button to close the application.
iii. Write code for Calculate Discount button to calculate discount and net amount .
Answer:
i. Code to make text fields uneditable:txtNameofCustomer.setEditable(false);txtBillAmount.setEditable(false);
ii. Code for stop button:System.exit(0);
iii. Code for Calculate Discount button:
double bill = Double.parseDouble(txtBillAmount.getText());
double discount = 0.0;
double netAmount = 0.0;
if (bill > 10000) {
if (jRadioButtonCost.isSelected()) {
discount = bill * 0.15;
} else if (jRadioButtonCheque.isSelected()) {
discount = bill * 0.10;
} else if (jRadioButtonCreditCard.isSelected()) {
discount = 0.0;
}
}
netAmount = bill - discount;
txtDiscount.setText("" + discount);
txtNetAmount.setText("" + netAmount);
In simple words: We check the bill amount, apply the appropriate percentage discount based on the selected payment mode, compute the net total, and display the results.
Exam Tip: Always parse text inputs to numeric types before performing arithmetic calculations.
Question 7. Consider the following tables:
BOOK (EID, EbookName, Author)
COST (Subj ID, EID, Cost) [with sample data rows provided in source]
i. Suggest the suitable primary key and foreign key in COST table.
ii. Write MySQL query to display EbookName, Author, Cost of each book.
iii. Write MySQL query to display the difference of maximum and minimum cost from cost table.
iv. Give the output of select count(*) from book, cost;
v. How many rows and columns will be there in equijoin of above tables?
Answer:
i. Primary Key in COST table: Subj ID (or EID if EID is unique in COST); Foreign Key: EID (referencing BOOK table).
ii. MySQL query:SELECT EbookName, Author, Cost FROM BOOK, COST WHERE BOOK.EID = COST.EID;
iii. MySQL query:SELECT MAX(Cost) - MIN(Cost) FROM COST;
iv. Output of SELECT COUNT(*) FROM BOOK, COST;:
Returns the Cartesian product count. Since BOOK has 3 rows and COST has 4 rows, output is 12.
v. Rows and columns in equijoin:
Number of matching rows = 4 (each EID in COST matches BOOK), Columns = 3 (from BOOK) + 3 (from COST) = 6 columns.
In simple words: Primary keys uniquely identify table rows, foreign keys link tables, aggregate functions compute totals, and joins combine related records across tables.
Exam Tip: Cartesian product (cross join) multiplies the row counts of both tables when no join condition is specified.
Question 8. Explain the use of pre-increment and post-increment operator with an suitable example.
Answer:
- Pre-increment (\(++x\)): Increments the variable's value by 1 first, and then uses the new value in the expression where it is evaluated.
- Post-increment (\(x++\)): Uses the current value of the variable in the expression first, and then increments the variable by 1 afterwards.
Example:
int x = 5;
int y = ++x; // x becomes 6, y becomes 6
int a = 5;
int b = a++; // b becomes 5, then a becomes 6
In simple words: Pre-increment changes the value before using it, while post-increment uses the value first and changes it afterwards.
Exam Tip: Always trace increment operators step-by-step in dry runs of exam snippets.
Question 9. What is the output produced by following code fragment?
float x=9, y=5;
int z=int(x/y);
switch(z)
{ case 1: x+=2;
case 2: x=x+3;
default: x=x+1;
}
System.out.println("x is: "+x);
Answer:
\(x = 9\), \(y = 5\)
\(x / y = 9 / 5 = 1.8\)
\(z = \text{int}(1.8) = 1\)
Since \(z = 1\), execution starts at case 1: \(x\) becomes \(9 + 2 = 11\).
Due to the absence of break statements, execution falls through to case 2: \(x\) becomes \(11 + 3 = 14\).
Execution then falls through to default: \(x\) becomes \(14 + 1 = 15\).
Output produced:x is: 15.0
In simple words: Without break statements, a switch case executes all subsequent cases below the matching case (fall-through).
Exam Tip: Watch out for missing break statements in switch-case questions as they cause fall-through execution.
Question 10. Which HTML tags are used for:
a. line break b. horizontal rule c. to put a table d. to insert an image e. to change background color f. to change font size g. to make heading h. to make a textfield i. to make a form
Answer:
a. <br>
b. <hr>
c. <table>
d. <img>
e. <body bgcolor="..."> (or CSS background-color)
f. <font size="..."> (or CSS font-size)
g. <h1> to <h6>
h. <input type="text">
i. <form>
In simple words: Each HTML tag has a specific purpose for structuring and styling web pages.
Exam Tip: Know both legacy HTML attributes and modern CSS equivalents for styling tags.
Free study material for Informatics Practices
Chapter Assignment & Practice Material for Class 12 Informatics Practices All topics
Revision Assignment: All topics (CBSE)
Access structured practice assignments for All topics designed in alignment with the latest CBSE curriculum for Class 12 Informatics Practices. These printable sets cover objective and descriptive problem types to support thorough revision.
Maximize Exam Scores with Chapter Practice Sets
- Exam Alignment: Questions strictly follow contemporary CBSE sample papers and grading schemes.
- Comprehensive Coverage: Features objective drills, case studies, and structured descriptive problems for All topics.
- Pacing & Precision: Regular problem-solving builds critical calculation speed and test-taking accuracy.
How to Approach Informatics Practices All topics Assignments
- Textbook Review: Always study the core NCERT book for Class 12 Informatics Practices prior to beginning the assignment.
- Independent Attempt: Solve All topics questions on your own initially before cross-checking with expert solutions.
- Error Tracking: Record challenging concepts in a dedicated notebook and practice online MCQ tests for revision.
FAQs
You can download free PDF assignments for Class 12 Informatics Practices All topics from StudiesToday.com. These practice sheets have been updated for the 2026-27 session covering all concepts from latest NCERT textbook.
Yes, our teachers have given solutions for all questions in the Class 12 Informatics Practices All topics assignments. This will help you to understand step-by-step methodology to get full marks in school tests and exams.
Yes. These assignments are designed as per the latest CBSE syllabus for 2026. We have included huge variety of question formats such as MCQs, Case-study based questions and important diagram-based problems found in All topics.
Practicing topicw wise assignments will help Class 12 students understand every sub-topic of All topics. Daily practice will improve speed, accuracy and answering competency-based questions.
Yes, all printable assignments for Class 12 Informatics Practices All topics are available for free download in mobile-friendly PDF format.