CBSE Class 12 Informatics Practices Programming Fundamentals Assignment

Download CBSE Class 12 Informatics Practices Assignments

Review targeted academic assignments with the CBSE Class 12 Informatics Practices Programming Fundamentals Assignment. Built according to official CBSE standards for the 2026-27 term, these downloadable Class 12 Informatics Practices worksheets support effective daily practice for Programming Fundamentals.

Access CBSE School Assignments and Answers

Navigate directly to the solved Informatics Practices assignments using the digital viewer below. Each practice set includes detailed step-by-step solutions, allowing students to instantly cross-check their work and identify areas requiring further revision.

Q1. Name any two Object Oriented Programming languages?
Answer: C++ and Java
In simple words: C++ and Java are popular object-oriented programming languages.

Exam Tip: Remember that object-oriented programming relies on concepts like classes and objects.

 

Q2. Why is java called a platform independent language?
Answer: Java program can be easily moved from one computer system to another, anywhere anytime. Changes and upgrade in operating system, processors and system resources will not force any change in the Java program. Hence it is called a platform independent language.
In simple words: Java code runs on any machine without needing modification due to byte code compilation.

Exam Tip: Mention byte code and JVM (Java Virtual Machine) for complete clarity in exams.

 

Q3. Elaborate the java Compilation process.
Answer: The source program is first converted into a byte code using a java compiler. This byte code is machine independent i.e. same for all the machines. Later the byte code is executed on the machine using an interpreter.
In simple words: Source code goes to compiler to become byte code, then interpreter runs it.

Exam Tip: Always distinguish between compiler (.class file generation) and interpreter (execution phase).

 

Q4. Why do we write a comment in a program? What are the two ways of writing comment in a java Program?
Answer: Comments are added to a program for the following purposes:
1. Make the code more readable and understandable.
2. For future references.
We can add comments in a Java program in the following ways:
i) Adding // before the line which is to be commented. This can be used only for single line comments.
ii) Using a pair of \(/*\) and \(\*/\) for multi-line comments.
In simple words: Comments help explain code and are ignored by the compiler.

Exam Tip: Differentiate clearly between single-line (//) and multi-line (\(/* ... \*/\)) comment syntaxes.

 

Q5. What is a syntax error in context of a program? Give an example.
Answer: Error in the way of writing a statement in a program, results in a syntax error.
For e.g.
for (i=0, i<=100. i++), will result in a syntax error because the program has written a comma instead of a semicolon in the for loop.
In simple words: Syntax errors happen when grammar rules of the programming language are broken.

Exam Tip: Syntax errors are detected by the compiler before program execution.

 

Q6. What is RAD programming? Why is program development in java using Netbeans IDE is RAD?
Answer: RAD stands for Rapid Application Development. A programming style which aims at building programs fastly through the use of tools and wizards is called RAD.
Program development using Netbeans IDE is RAD as it:
- Provides GUI
- Provides online help and suggestions during typing of the program (using ctrl+Spacebar key)
- Error alerts while typing of the program.
In simple words: RAD allows fast app development using visual tools and drag-and-drop components.

Exam Tip: Highlight GUI builders and pre-built components as core features of RAD.

 

Q7. What is IDE? Name two IDE for Programming in java.
Answer: A programming environment, where all the tools required for programming are available under one roof is called IDE. Two IDE for Java are Netbeans and BlueJ.
In simple words: An IDE is an all-in-one software for writing, compiling, and debugging code.

 

Q8. Name any two type of Tokens available in Java.
Answer: Keyword, Identifier, Literal, Punctuators, and Operators.
In simple words: Tokens are the smallest individual elements of a Java program.

Exam Tip: Memorize at least 3-4 token types to secure full marks.

 

Q9. What are primitive data types? Name the various primitive data type available in Java.
Answer: Data types that are directly available with java are called primitive data type.
Various primitive data types available in java are byte, short, int, long, float, double, char, and boolean.
In simple words: Primitive types are built-in basic data containers provided by Java.

Exam Tip: There are exactly 8 primitive data types in Java.

 

Q10. What are Reference data types?
Answer: Data types created by the programmer using the primitive data type are called reference data type e.g. Classes, interfaces etc.
In simple words: Reference types store memory addresses of objects rather than actual data values.

Exam Tip: Mention that arrays and classes are standard examples of reference types.

 

Q11. What is type casting?
Answer: Converting a value from one type to another is called type casting.
For e.g. int a = 5; here 'a' is an integer, which can be cast to float as follows:
float b = (float) a;
In simple words: Type casting means forcing a variable of one data type to act as another data type.

Exam Tip: Explicit casting requires mentioning the target data type in parentheses.

 

Q12. Name and explain the usage of any two data types used in Java to store numbers with decimals.
Answer: Two data types available in java for storing numbers with decimals are:
1. float: for single precision floating point values for e.g. float num = 10.0F
2. double: for double precision floating point value. This is the default data type for decimal numbers. For e.g. double num = 10.0
In simple words: Float and double store decimal numbers with different levels of precision.

Exam Tip: Double uses 64 bits while float uses 32 bits of memory.

 

Q13. What are Keywords? Give two examples of keywords available in Java.
Answer: Keywords are words that have a specific predefined meaning in Java. They cannot be used as variable names. E.g. void, private, if, while etc.
In simple words: Keywords are reserved words with special pre-defined programming meaning.

Exam Tip: Keywords are always written in lowercase in Java.

 

Q14. Name and explain the usage of any one relational and one logical operator in Java.
Answer: One relational operator in java is ==. This operator results in true if both its operands are equal otherwise false. One logical operator in java is &&. This operator is used to combine two logical values. The result of the && will be true if and only if both its operands are true otherwise false.
In simple words: == checks equality, and && performs logical AND operation.

Exam Tip: Do not confuse assignment operator (=) with relational equality operator (==).

 

Q15. What is the difference between = and == operator in java?
Answer: = represents an assignment operator. It sets the value of the variable on its left side with the result of expression on its right side. == represents a conditional equal to operator. It checks for the equality of both its operands. If both the operands are equal, condition evaluates to true otherwise to false.
In simple words: = assigns values, while == compares values.

Exam Tip: Using = inside an if condition by mistake is a very common compilation error.

 

Q16. Name the two type of selection statement available in Java.
Answer: Two selection statements available in java are 'if' and 'Switch'.
In simple words: Selection statements help the program make decisions based on conditions.

Exam Tip: Selection statements are also known as conditional or branching statements.

 

Q17. Write the purpose of Switch Statement with the help of an example. Which Java Statement can be used in place of switch statement? In the switch statement, what happens if every case fails and there is no default option?
Answer: A Switch statement is used to execute a statement from a group of statements based on the result of an expression. The expression must result in either byte, short, integer or character.
An 'if statement' can be used in place of switch statement. In a switch statement if none of the statements satisfies and even there is no default case then nothing would happen. This would not result in any sort of error.
In simple words: Switch handles multi-way branching cleanly, and failing all cases with no default does nothing safely.

Exam Tip: Remember that break statements are vital inside switch cases to prevent fall-through execution.

 

Q18. What is the purpose of 'break' statement in java?
Answer: Break is used to terminate the current switch statement or the loop.
In simple words: Break forces an immediate exit out of loops or switch blocks.

Exam Tip: Break only exits the innermost enclosing loop or switch.

 

Q19. What is the purpose of 'continue' statement in java?
Answer: Continue statement skips the remaining part of the current loop and begins the next iteration of the loop.
In simple words: Continue skips the current round and jumps straight to the next loop iteration.

Exam Tip: Continue skips execution of statements below it only for the current iteration.

 

Q20. Find the output of the following code snippet written in java public static void main(String []args)
{
long a=78345,s1=0,s2=0,r;
while(a>0)
{
r=a%10;
if (r%4==0)
s1+= r;
else
s2+=r;
a/=10;
}
System.out.println("S1 ="+ s1);
System.out.println("S2 ="+ s2);
}

Answer:
S1 = 12
S2 = 15
Step-by-step calculation:
Initial values: \(a = 78345\), \(s1 = 0\), \(s2 = 0\)
- Iteration 1: \(r = 5\). \(5\%4 \neq 0\). \(s2 = 0 + 5 = 5\). \(a = 7834\)
- Iteration 2: \(r = 4\). \(4\%4 == 0\). \(s1 = 0 + 4 = 4\). \(a = 783\)
- Iteration 3: \(r = 3\). \(3\%4 \neq 0\). \(s2 = 5 + 3 = 8\). \(a = 78\)
- Iteration 4: \(r = 8\). \(8\%4 == 0\). \(s1 = 4 + 8 = 12\). \(a = 7\)
- Iteration 5: \(r = 7\). \(7\%4 \neq 0\). \(s2 = 8 + 7 = 15\). \(a = 0\)
Final outputs: \(s1 = 12\), \(s2 = 15\)

In simple words: The code checks each digit of the number 78345, adding multiples of 4 to s1 and others to s2.

Exam Tip: Trace digit-extraction loops (using %10 and /10) carefully on your rough sheet.

 

Q21. Correct the errors in the following program segment written in JAVA. You are just required to write the corrected code, underlying the corrections made.
public Static Void Main (String [] args)
{
Integer Nos = 100;
while (Nos => 45)
{
If (Nos % 5 = 0);
Nos+=10;
otherwise
Nos + = 20;
}
}

Answer:
public static void main (String [] args)
{
int Nos = 100;
while (Nos >= 45)
{
if (Nos % 5 == 0)
Nos += 10;
else
Nos += 20;
}
}
In simple words: Fixed capitalization errors, operator typos (=> to >=, = to ==), removed semicolon after if, replaced 'otherwise' with 'else', and fixed spacing in +=.

Exam Tip: Watch out for case sensitivity in Java keywords like static and void.

 

Unsolved Questions

1. What will be output of the following code:
byte b;
double d= 417.35;
b= (byte) d;
system.out.println(b);

Answer:
-97
Step-by-step calculation:
Double value \(417.35\) is explicitly cast to byte.
Byte range is \(-128\) to \(127\). Total values = \(256\).
\(417 \pmod{256} = 161\).
Since byte is signed, value = \(161 - 256 = -97\).

In simple words: Casting a large double into a small byte results in overflow wrapping around the byte range.

Exam Tip: Be cautious of data overflow when casting large numeric types into smaller types.

 

2. Given the value of a variable, write a statement, without using if construct, which will produce the absolute value of a variable.
Answer:
int absVal = (x < 0) ? -x : x;
In simple words: Use the ternary operator to check if negative and invert it if necessary.

Exam Tip: Alternatively, you can use Math.abs(x) from the Java Math library.

 

3. What is wrong with the following code fragment?
Switch (x)
{
case 1:
n1= 10;
n2= 20;
case 2:
n3=30;
break;
n4= 40;
}

Answer:
1. Missing break statements between cases (leading to fall-through).
2. Statement `n4 = 40;` is placed outside any case label, making it unreachable code.
In simple words: Statements inside a switch block must belong to a case or default label.

Exam Tip: Every executable statement in a switch must be attached to a valid `case` or `default` label.

 

4. What will be the output of the following program code?
int m = 100;
int n = 300;
while(++m < --n);
System.out.println(m+” “+ n);

Answer:
200 200
Step-by-step calculation:
- m starts at 100, n starts at 300.
- The while loop has a semicolon (;), meaning it loops with an empty body until the condition `++m < --n` becomes false.
- In each iteration, m increments by 1 and n decrements by 1.
- They meet at 200 when `++m` becomes 201 and `--n` becomes 199, at which point \(201 < 199\) is false.
- Final values: \(m = 200\), \(n = 200\).

In simple words: m increases and n decreases until they both meet in the middle at 200.

Exam Tip: Watch out for trailing semicolons in loop headers, which create empty-body loops.

 

5. What does the following fragment display
String s = “Six:” + 3+ 3;
System.out.println(s);

Answer:
Six:33
Step-by-step calculation:
String concatenation proceeds from left to right.
- `"Six:" + 3` evaluates to `"Six:3"` (String concatenation).
- `"Six:3" + 3` evaluates to `"Six:33"`.

In simple words: Once a string is involved, subsequent numbers are concatenated rather than added.

Exam Tip: Use parentheses `(3 + 3)` if you want arithmetic addition instead of string concatenation.

 

6. What is the output of the following code?
String s = new string();
System.out.println(“s = “ + s);

Answer:
s =
Step-by-step calculation:
`new String()` creates an empty string object (with length 0).
Concatenating with `"s = "` prints `"s = "`. (Note: `string` with lowercase `s` would actually cause a compilation error in Java, but conceptually it outputs an empty string).

In simple words: An uninitialized new string object prints as an empty string.

Exam Tip: Remember that Java is case-sensitive, so `String` must start with a capital `S`. Assuming proper capitalization, it outputs `s = `. Data in exams may contain minor typos from scanned PDFs.

 

7. What will be the output of the following code snippet?
int x= 10;
int y = 20;
if ((x<y)||(x=5) > 10)
System.out.println(x);
else
System.out.println(y);

Answer:
10
Step-by-step calculation:
- Evaluate condition `(x < y)`: Since \(10 < 20\), this is true.
- Due to short-circuit evaluation in `||`, the second part `(x=5) > 10` is skipped entirely.
- The if condition evaluates to true.
- Prints `x`, which is 10.

In simple words: Because the first condition `x < y` is true, the `||` operator short-circuits and prints 10.

Exam Tip: Master short-circuit evaluation rules for logical operators (`&&` and `||`).

 

8. State the output of the following program:
public static void main(String args[ ])
{
int x = 10;
int y = 15;
System.ou.println((x>y)? 3.14: 3);
}

Answer:
3.0
Step-by-step calculation:
- `x > y` means \(10 > 15\), which is false.
- The ternary operator returns the second expression: `3`.
- Because the conditional expression has a mixed type branch (`3.14` is double, `3` is int), the result is promoted to the wider type (double).
- Prints `3.0`. (Note: `System.ou.println` contains a typo in OCR for `out`, assumed to be valid code).

In simple words: Since \(10 > 15\) is false, it returns 3, promoted to double format as 3.0.

 

9. State the output of the following program:
public static void main(String args[ ])
{
int x = 10;
float y = 10.0;
System.ou.println((x>y)? true: false);
}

Answer:
Compilation Error
Step-by-step calculation:
`float y = 10.0;` causes a compilation error because `10.0` is treated as a `double` literal by default in Java, and assigning a double to a float requires explicit casting or an 'f' / 'F' suffix (e.g., `float y = 10.0f;`).

In simple words: The code fails to compile because a double literal cannot be assigned directly to a float variable without an 'f' suffix.

Exam Tip: Always append 'f' or 'F' when initializing float literals in Java.

 

10. Given a package named EDU.student, how would you import a class named Test contained in this package? Write one line statement.
Answer:
import EDU.student.Test;
In simple words: Use the import keyword followed by the full package path and class name.

Exam Tip: Import statements are placed at the very top of the Java source file, before any class definitions.

 

11. Consider the following class definition:
Class Student
{
abstract double result( )
}
This code will not compile since a keyword is missing in the first line. What is the keyword?

Answer:
abstract
In simple words: If a class contains an abstract method, the class itself must be declared as abstract.

Exam Tip: Abstract methods can only exist inside abstract classes or interfaces.

 

12. Can an abstract method be declared final? Yes or No.
Answer:
No
In simple words: Abstract methods must be overridden by subclasses, but final methods cannot be overridden, making them mutually exclusive.

Exam Tip: Memorize that `abstract` and `final` are conflicting modifiers in Java.

CBSE Class 12 Informatics Practices Assignments for Programming Fundamentals

Chapter Practice Questions for Class 12 Informatics Practices

Review targeted chapter assignments for Class 12 Informatics Practices Programming Fundamentals. Built according to official CBSE guidelines, these downloadable problem sets help students build accuracy and prepare effectively for school tests.

Maximize Exam Scores with Chapter Practice Sets

  • Curriculum Standards: Assignments match modern CBSE sample formats to ensure relevant preparation.
  • Thorough Revision: Detailed problem sets reinforce core concepts and eliminate conceptual weak spots.
  • Execution Speed: Timed practice with assignment sets sharpens overall response timing.

How to Approach Informatics Practices Programming Fundamentals Assignments

  1. Textbook Review: Always study the core NCERT book for Class 12 Informatics Practices prior to beginning the assignment.
  2. Independent Attempt: Solve Programming Fundamentals questions on your own initially before cross-checking with expert solutions.
  3. Error Tracking: Record challenging concepts in a dedicated notebook and practice online MCQ tests for revision.

FAQs

Where can I download the latest CBSE Class 12 Informatics Practices Programming Fundamentals assignments?

You can download free PDF assignments for Class 12 Informatics Practices Programming Fundamentals from StudiesToday.com. These practice sheets have been updated for the 2026-27 session covering all concepts from latest NCERT textbook.

Do these Informatics Practices Programming Fundamentals assignments include solved questions?

Yes, our teachers have given solutions for all questions in the Class 12 Informatics Practices Programming Fundamentals assignments. This will help you to understand step-by-step methodology to get full marks in school tests and exams.

Are the assignments for Class 12 Informatics Practices Programming Fundamentals based on the 2026 exam pattern?

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 Programming Fundamentals.

How can practicing Programming Fundamentals assignments help in Informatics Practices preparation?

Practicing topicw wise assignments will help Class 12 students understand every sub-topic of Programming Fundamentals. Daily practice will improve speed, accuracy and answering competency-based questions.

Can I download Informatics Practices Programming Fundamentals assignments for free on mobile?

Yes, all printable assignments for Class 12 Informatics Practices Programming Fundamentals are available for free download in mobile-friendly PDF format.