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

98

Current Page

108

Total Pages

Showing 2155 result(s) for your search.

java
Question Result 1941

(a) Differentiate between if else if and switch-case statements (b) Give the output of the following code: String P = "20", Q ="19"; int a = Integer.parseInt(P); int b = Integer.valueOf(Q); System.out.println(a+""+b); (c) What are the various types of errors in Java? (d) State the data type and value of res after the following is executed: char ch = '9'; res= Character.isDigit(ch); (e) What is the difference between the linear search and the binary search technique?

Java Programming Language ICSE Computer Application - Class - X ICSE Computer Application - Class X - 2019 PYQ
Answer (a) if else if switch-case if else if can test for any Boolean expression like less than, greater than, equal to, not equal to, etc. switch-case can only test if the expression is equal to any of its case constants. if else if can use different expressi...
View Details
/question/8154
Question Result 1942

(a) Write a Java expression for the following: \[ \lvert x^2 + 2xy \rvert \] (b) Write the return data type of the following functions: startsWith() random() (c) If the value of basic=1500, what will be the value of tax after the following statement is executed? tax = basic > 1200 ? 200 :100; (d) Give the output of following code and mention how many times the loop will execute? int i; for( i=5; i>=1; i--) { if(i%2 == 1) continue; System.out.print(i+" "); } (e) State a difference between call by value and call by reference. (f) Give the output of the following:       Math.sqrt(Math.max(9,16)) (g) Write the output for the following: String s1 = "phoenix"; String s2 ="island"; System.out.println(s1.substring(0).concat(s2.substring(2))); System.out.println(s2.toUpperCase()); (h) Evaluate the following expression if the value of x=2, y=3 and z=1.   v=x + --z + y++ + y (i) String x[] = {"Artificial intelligence", "IOT", "Machine learning", "Big data"}; Give the output of the following statements: System.out.println(x[3]); System.out.println(x.length); (j) What is meant by a package? Give an example.

Java Programming Language ICSE Computer Application - Class - X ICSE Computer Application - Class X - 2019 PYQ
Answer (a) Math.abs(x * x + 2 * x * y)   Answer (b) boolean double Answer (c) Value of tax will be 200. As basic is 1500, the condition of ternary operator — basic > 1200 is true. 200 is returned as the result of ternary operator and it gets assigned to tax. A...
View Details
/question/8155
Question Result 1943

(ix)(a) Write the Java statement to initialize the first 6 odd numbers in a 3 × 2 array. (b) What is the result of x[0][1] + x[2][1] of the above array?

ICSE Computer Applications Class 10 – Previous Year Question Papers & Solutions ICSE Computer Application - Class - X ICSE Computer Application - Class X - 2025 PYQ
(a) Java statement to initialize the first 6 odd numbers in a 3 × 2 array: int[][] x = { {1, 3}, {5, 7}, {9, 11} }; (b) Calculation of x[0][1] + x[2][1]: x[0][1] refers to the element at row 0, column 1, which is 3. x[2][1] refers to the element at row 2, colu...
View Details
/question/8482
Question Result 1946

What is the value of y after evaluating the expression given below? y+= ++y + y-- + --y; when int y=8

Java Programming Language ICSE Computer Application - Class - X ICSE Computer Application - Class X - 2018 PYQ
   y+= ++y + y-- + --y⇒ y = y + (++y + y-- + --y)⇒ y = 8 + (9 + 9 + 7)⇒ y = 8 + 25⇒ y = 33 Practice With Code Let's analyze and implement the Java program to evaluate the given expression: Expression: y += ++y + y-- + --y; Given int y = 8, let's break it down ...
View Details
/question/8144
Question Result 1948

Declare a 2D array of integers in Java with 3 rows and 4 columns. Initialize the array with the following values: 1 2 3 4 5 6 7 8 9 10 11 12

Java Programming Language Array in java 2D and Multi-Dimension Array in Java
Write a Java program to print all the elements of the array.: public class Main { public static void main(String[] args) { int[][] array = { {1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12} }; for (int i = 0; i < array.length; i++) { for (int j = 0; j < array[i].le...
View Details
/question/8216
Question Result 1949

Give the output of the following Character class methods: (a) Character.toUpperCase ('a') (b) Character.isLetterOrDigit('#')

Java Programming Language ICSE Computer Application - Class - X ICSE Computer Application - Class X - 2023 PYQ
(a) Character.toUpperCase ('a') Output A Explanation In Java, the Character.toUpperCase(char ch) method is used to convert a given character to its uppercase equivalent, if one exists. So, the output is uppercase 'A'. (b) Character.isLetterOrDigit('#') Output ...
View Details
/question/8388
Question Result 1951

What is the problem of dangling-else?When does it arise?What is the default dangling-else matching, and how can it be overridden?

Java Programming Language Decision Making in java if statement in Java
Question: What is the problem of dangling-else?When does it arise?What is the default dangling-else matching, and how can it be overridden? Answer: 🧩 Definition: The dangling-else problem occurs in nested if statements when it is unclear which if a particular ...
View Details
/question/8679
Question Result 1952

Write a Java program that calculates the sum of each row in a 2D array and prints the result. Given the following array: int[][] arr = { {1, 2, 3}, {4, 5, 6}, {7, 8, 9} };

Java Programming Language Array in java 2D and Multi-Dimension Array in Java
public class Main { public static void main(String[] args) { int[][] arr = { {1, 2, 3}, {4, 5, 6}, {7, 8, 9} }; for (int i = 0; i < arr.length; i++) { int rowSum = 0; for (int j = 0; j < arr[i].length; j++) { rowSum += arr[i][j]; } System.out.println("Row " + ...
View Details
/question/8221
Question Result 1953

Write a Java program that prints the diagonal elements of a square 2D array. Given the following array: int[][] matrix = { {1, 2, 3}, {4, 5, 6}, {7, 8, 9} };

Java Programming Language Array in java 2D and Multi-Dimension Array in Java
public class Main { public static void main(String[] args) { int[][] matrix = { {1, 2, 3}, {4, 5, 6}, {7, 8, 9} }; System.out.print("Diagonal Elements: "); for (int i = 0; i < matrix.length; i++) { System.out.print(matrix[i][i] + " "); } } }
View Details
/question/8222
Question Result 1954

Write a Java program that takes a 2D array of size 2x3 and returns its transpose. 1 2 3 4 5 6 Output: 1 4 2 5 3 6

Java Programming Language Array in java 2D and Multi-Dimension Array in Java
public class Main { public static void main(String[] args) { int[][] matrix = { {1, 2, 3}, {4, 5, 6} }; int[][] transpose = new int[3][2]; for (int i = 0; i < matrix.length; i++) { for (int j = 0; j < matrix[i].length; j++) { transpose[j][i] = matrix[i][j]; } ...
View Details
/question/8219
Question Result 1955

Write a Java program to calculate and print the sum of all elements in the following 2D array: int[][] arr = { {2, 4, 6}, {1, 3, 5}, {7, 8, 9} };

Java Programming Language Array in java 2D and Multi-Dimension Array in Java
public class Main { public static void main(String[] args) { int[][] arr = { {2, 4, 6}, {1, 3, 5}, {7, 8, 9} }; int sum = 0; for (int i = 0; i < arr.length; i++) { for (int j = 0; j < arr[i].length; j++) { sum += arr[i][j]; } } System.out.println("Sum of all e...
View Details
/question/8218
Question Result 1956

Write a Java program to multiply two matrices. Ensure that the number of columns in the first matrix is equal to the number of rows in the second matrix. Given matrices: Matrix A (2x3): 1 2 3 4 5 6 Matrix B (3x2): 7 8 9 10 11 12

Java Programming Language Array in java 2D and Multi-Dimension Array in Java
public class Main { public static void main(String[] args) { int[][] matrixA = { {1, 2, 3}, {4, 5, 6} }; int[][] matrixB = { {7, 8}, {9, 10}, {11, 12} }; int[][] result = new int[2][2]; for (int i = 0; i < matrixA.length; i++) { for (int j = 0; j < matrixB[0]....
View Details
/question/8223
Question Result 1957

Write a Java program to search for a specific element in a 2D array and print its position (row and column index). If the element is not found, print a message indicating that the element was not found. Given the following 2D array: int[][] arr = { {5, 7, 9}, {4, 6, 8}, {1, 2, 3} };

Java Programming Language Array in java 2D and Multi-Dimension Array in Java
public class Main { public static void main(String[] args) { int[][] arr = { {5, 7, 9}, {4, 6, 8}, {1, 2, 3} }; int searchElement = 6; boolean found = false; for (int i = 0; i < arr.length; i++) { for (int j = 0; j < arr[i].length; j++) { if (arr[i][j] == sear...
View Details
/question/8220
Question Result 1958

Write a Java program to sort each row of the following 2D array in ascending order. Example Input: 9 7 5 3 1 2 6 4 8 Expected Output: 5 7 9 1 2 3 4 6 8

Java Programming Language Array in java 2D and Multi-Dimension Array in Java
Here is the Java program to sort each row of a 2D array in ascending order: import java.util.Arrays; public class RowWiseSorting { public static void main(String[] args) { int[][] array = { {9, 7, 5}, {3, 1, 2}, {6, 4, 8} }; System.out.println("Original 2D Arr...
View Details
/question/8224
Question Result 1960

[Inheritance] Based on the given image, write the Java statement to create the class Child.

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 correct Java statement is: class Child implements Father, Mother { } Understanding the Diagram: The image shows: Two interfaces: Father and Mother One class: Child The class Child is connected to both interfaces This represents: Multiple Inheritance using ...
View Details
/question/11122