Smart Content Search

Find the exact content you need

Search across courses, articles, programs, MCQs, and descriptive questions from your knowledge platform in one clean workspace.

2155

Results Found

99

Current Page

108

Total Pages

Showing 2155 result(s) for your search.

java
Question Result 1962

[Inheritance] What will happen if method void show() in subclass Car is given access specifier as private?

Computer Science - 10 Years Solved Papers ISC Class XII Computer Science - 10 Years Solved Papers ISC Class XII Competency focused Practice Questions ISC Class XII Computer Science
A compile-time error will occur because an overridden method cannot have weaker access privilege than the superclass method. Understanding the Original Code: In the superclass Vehicle, the method is: public void show() { ... } This method is inherited and over...
View Details
/question/11120
Question Result 1963

[Interface] All methods declared in an interface are abstract. Where will the body of these abstract methods be defined?

Computer Science - 10 Years Solved Papers ISC Class XII Computer Science - 10 Years Solved Papers ISC Class XII Competency focused Practice Questions ISC Class XII Computer Science
The body of abstract methods declared in an interface will be defined in the class that implements the interface. Understanding Interface: An interface in Java is used to achieve: Abstraction Multiple inheritance Standardized behavior Methods inside an interfa...
View Details
/question/11121
Question Result 1964

[Polymorphism] In the given code snippet, which feature of object‑oriented programming concept is being exhibited by the substring() method? String s = "sandwich"; System.out.println(s.substring(4)); System.out.println(s.substring(1,4));

Computer Science - 10 Years Solved Papers ISC Class XII Computer Science - 10 Years Solved Papers ISC Class XII Competency focused Practice Questions ISC Class XII Computer Science
The feature exhibited is: Method Overloading (Compile-time Polymorphism) Understanding the Code: The String class provides multiple versions of the substring() method. Two Different Method Calls: s.substring(4) s.substring(1,4) Meaning of Each: Method Call Mea...
View Details
/question/11123
Question Result 1965

[Primitive Values, Wrapper Classes, Types and Casting] How many bytes of data is passed when public void stu_data(int, double, char) is invoked?

Computer Science - 10 Years Solved Papers ISC Class XII Computer Science - 10 Years Solved Papers ISC Class XII Competency focused Practice Questions ISC Class XII Computer Science
Total Bytes Passed = 14 bytes Step-by-Step Calculation: The method contains three parameters: int, double, char Size of Each Data Type in Java: Data Type Size int 4 bytes double 8 bytes char 2 bytes Total Calculation: int → 4 bytes double → 8 bytes char → 2 by...
View Details
/question/11125
Question Result 1966

[Primitive Values, Wrapper Classes, Types and Casting] Since a byte can represent 256 different numbers, why is its maximum value 127?

Computer Science - 10 Years Solved Papers ISC Class XII Computer Science - 10 Years Solved Papers ISC Class XII Competency focused Practice Questions ISC Class XII Computer Science
Because Java uses signed representation for byte, half of the values are used for negative numbers. Step 1: Understanding Byte Size A byte in Java uses: 8 bits = 1 byte Total combinations: 2⁸ = 256 values Step 2: Signed vs Unsigned Representation Java uses sig...
View Details
/question/11126
Question Result 1967

[Primitive Values, Wrapper Classes, Types and Casting] The following statement will generate a compile time error. This can be rectified in 2 different ways, without losing precision of price. Write these statements: float price = 17.99;

Computer Science - 10 Years Solved Papers ISC Class XII Computer Science - 10 Years Solved Papers ISC Class XII Competency focused Practice Questions ISC Class XII Computer Science
float price = 17.99; Correct Statements: float price = 17.99f; float price = (float) 17.99; Why Error Occurs: In Java, decimal numbers like: 17.99 are treated as double by default. So the statement: float price = 17.99; tries to assign a double value to a floa...
View Details
/question/11127
Question Result 1968

[Primitive Values, Wrapper Classes, Types and Casting] What gets printed? char[] set = {'*','D','5'}; System.out.print(Character.isDigit(set[2]) + " "); System.out.print(Character.isWhitespace(set[0]) + " "); System.out.print(Character.isLetterOrDigit(set[1]));

Computer Science - 10 Years Solved Papers ISC Class XII Computer Science - 10 Years Solved Papers ISC Class XII Competency focused Practice Questions ISC Class XII Computer Science
Output: true false true Step-by-Step Analysis: The array is: set = {'*', 'D', '5'} Index Character 0 * 1 D 2 5 Line 1: Character.isDigit(set[2]) set[2] = '5' '5' is a digit → Result = true Line 2: Character.isWhitespace(set[0]) set[0] = '*' '*' is NOT a whites...
View Details
/question/11129
Question Result 1969

[Primitive Values, Wrapper Classes, Types and Casting] While using Wrapper classes, we do not need to import any package. Give a reason.

Computer Science - 10 Years Solved Papers ISC Class XII Computer Science - 10 Years Solved Papers ISC Class XII Competency focused Practice Questions ISC Class XII Computer Science
Because Wrapper classes are part of the java.lang package, which is imported automatically by Java. Understanding Wrapper Classes: Wrapper classes convert primitive data types into objects. Primitive Type Wrapper Class int Integer double Double char Character ...
View Details
/question/11130
Question Result 1970

[Operation on File] Question: What is the difference between the following two statements? 1. FileWriter fw = new FileWriter(); 2. FileWriter fw = new FileWriter(, true);

Computer Science - 10 Years Solved Papers ISC Class XII Computer Science - 10 Years Solved Papers ISC Class XII Competency focused Practice Questions ISC Class XII Computer Science
Answer: Statement 1: FileWriter fw = new FileWriter(); This statement opens the file in overwrite mode. If the file already contains data, the old data will be erased. New data will be written from the beginning of the file. Statement 2: FileWriter fw = new Fi...
View Details
/question/11338
Question Result 1971

[Packages] Question: Given the following code snippet: package mine; public class Greetings { public static void greet(String name) { System.out.println("Hello " + name + ", welcome to the world of programming"); } } import java.util.*; import mine.*; public class Trial { public static void main() { Scanner sc = new Scanner(System.in); System.out.println("Give your name"); String n = sc.next(); Greetings.greet(n); } } (a) Predict the output for n = "Abhay". (b) Explain the difference between: import java.util.*; and import mine.*;

Computer Science - 10 Years Solved Papers ISC Class XII Computer Science - 10 Years Solved Papers ISC Class XII Competency focused Practice Questions ISC Class XII Computer Science
Answer: (a) Output: Give your name Abhay Hello Abhay, welcome to the world of programming Explanation: The Scanner object takes input from the user The input entered is: Abhay The method: Greetings.greet(n); is called The greet() method prints the welcome mess...
View Details
/question/11331
Question Result 1972

[Packages] Question: State the purpose of the following keywords in Java: (a) package (b) import

Computer Science - 10 Years Solved Papers ISC Class XII Computer Science - 10 Years Solved Papers ISC Class XII Competency focused Practice Questions ISC Class XII Computer Science
Answer: (a) package The package keyword is used to group related classes and interfaces together into a single namespace. Purpose: Organizes Java classes properly Avoids name conflicts Provides access protection Example: package mypack; (b) import The import k...
View Details
/question/11330
Question Result 1973

[Packages] Question: Why is the lang package termed as the default package in Java?

Computer Science - 10 Years Solved Papers ISC Class XII Computer Science - 10 Years Solved Papers ISC Class XII Competency focused Practice Questions ISC Class XII Computer Science
Answer: The java.lang package is called the default package because it is automatically imported into every Java program by the Java compiler. Explanation: Normally, packages must be imported before using their classes. Example: import java.util.Scanner; But c...
View Details
/question/11329
Question Result 1974

[Recursion] Question: Following method is a part of a class MyArray. int check(int m[ ], int i) { if(i

Computer Science - 10 Years Solved Papers ISC Class XII Computer Science - 10 Years Solved Papers ISC Class XII Competency focused Practice Questions ISC Class XII Computer Science
Answer: (a) Output: 6 Working: Initially: m = {1,2,3,4} m.length = 4 Function call: check(m,4) Recursive Working: check(m,4) = check(m,2) + m[3] = check(m,2) + 4 check(m,2) = check(m,0) + m[1] = check(m,0) + 2 check(m,0) = 0 Substituting values: check(m,2) = 0...
View Details
/question/11336
Question Result 1975

[String and Arrays] Question: Find the output of the following snippet: void check1() { String x[] = {"Kolkata","Chennai","Delhi"}; String y[] = {"Kolkata","Chennai","Delhi"}; System.out.println(x.equals(y)); } Answer: false

Computer Science - 10 Years Solved Papers ISC Class XII Computer Science - 10 Years Solved Papers ISC Class XII Competency focused Practice Questions ISC Class XII Computer Science
Explanation: In Java, arrays are objects. The method: x.equals(y) does NOT compare the contents of the arrays. Instead, it compares the references (memory addresses) of the arrays. Here: x and y are two different array objects Both arrays contain same elements...
View Details
/question/11323
Question Result 1976

[String Tokenizer] Question: What is the difference between the two methods, nextToken() and hasMoreTokens() of StringTokenizer class?

Computer Science - 10 Years Solved Papers ISC Class XII Computer Science - 10 Years Solved Papers ISC Class XII Competency focused Practice Questions ISC Class XII Computer Science
Answer: 1. nextToken() The method: nextToken() is used to return the next token (word/string part) from the StringTokenizer object. After returning a token, the tokenizer automatically moves to the next token. Example: StringTokenizer st = new StringTokenizer(...
View Details
/question/11339
Question Result 1977

[String] Question: Find the output of the following snippet: String S1 = "AB", S2 = "BC"; for(int i = 0, j = 0; i < S1.length(); i++, j++) { System.out.println(S1.charAt(i) + S2.charAt(j)); }

Computer Science - 10 Years Solved Papers ISC Class XII Computer Science - 10 Years Solved Papers ISC Class XII Competency focused Practice Questions ISC Class XII Computer Science
Answer: 131 133 Explanation: The loop runs for: S1.length() = 2 So there will be 2 iterations. Character ASCII Values: 'A' = 65 'B' = 66 'C' = 67 First Iteration: S1.charAt(0) = 'A' S2.charAt(0) = 'B' ASCII addition: 65 + 66 = 131 Output: 131 Second Iteration:...
View Details
/question/11328
Question Result 1978

[String] Question: How many String objects are created in the following snippet? Justify your answer. String s1 = "Gujarat"; String s2 = new String("Gujarat"); String s3 = new String("Gujarat"); String s4 = "Gujarat";

Computer Science - 10 Years Solved Papers ISC Class XII Computer Science - 10 Years Solved Papers ISC Class XII Competency focused Practice Questions ISC Class XII Computer Science
Answer: A total of 3 String objects are created. Explanation: Java stores string literals in a special memory area called the String Constant Pool (SCP). Step-by-Step Analysis: 1. String s1 = "Gujarat"; The string literal "Gujarat" is created in the String Con...
View Details
/question/11327
Question Result 1979

[String] Question: Write the Java statement to print the position of the 2nd occurrence of the letter 'I' within the word "MICHIGAN".

Computer Science - 10 Years Solved Papers ISC Class XII Computer Science - 10 Years Solved Papers ISC Class XII Competency focused Practice Questions ISC Class XII Computer Science
Answer: System.out.println("MICHIGAN".indexOf('I', 2)); Explanation: The method: indexOf(character, startingIndex) is used to search for a character starting from a specific position. In the word: MICHIGAN Character positions are: M I C H I G A N 0 1 2 3 4 5 6...
View Details
/question/11324