Trending ▼   ResFinder  

ICSE Class X Question Bank 2021 : Computer Applications

17 pages, 112 questions, 0 questions with responses, 0 total responses,    0    0
Zahin Makani
Smt. Sulochanadevi Singhania School, Thane
+Fave Message
 Home > zahinmakani >

Formatting page ...

SECTION I POSSIBLE THEORY QUESTION AND ANSWER 1. Java uses both compiler as well as Interpreter. Ans. Java converts source code to intermediate code called as byte code which is platform independent which in turn converts it to machine code with a special interpreter called JVM (Java virtual machine ) 2. Write a Java statement to use package util in your class. Ans. import java.util.*; 3. What does a token keyword refers in JAVA ? Give 2 example? Ans. Java reserved word is called as keyword which carry special meaning to the system compiler. Java.lang,java.util 4. Name 2 types of JAVA programs. Ans. Java Applet & Java Application 5. Name the code that gets created on compilation of source code. Ans. byte code 6. Name the platform independent code which is converted to machine code by the Java interpreter. Ans. byte code 7. Difference between System.out.print( ) & System.out.println( ) Ans. System.out.print( ) - Output on same line System.out.println( ) - Output on next line 8. Name the code which requires two bytes for its storage and includes characters of different languages around the world. Ans. Unicode 9. Write the command to terminate the running JAVA VIRTUAL MACHINE Ans. System.exit(0) 10. What is compound statement in Java? Ans: A compound statement is a statement which encloses a number of statements within a block of opening and closing curly braces. e.g. if(condition) { } I -TECH Page 1 11. Give one point of difference between Java applet and Java application. Ans. java applet - Java applet is internet based application software. Needs web browser Java Application is a standalone program to accomplish a task. Works without browser 12. Difference between Static Initialization Initialization during coding of program Direct assignment Dynamic Initialization Initialization during run time Outcome of relational, logical or mathematical operation. 13. Identify the following 1. // single line comment 2. /* */ multi line comment 14. ASCII value of 1. 2. 3. 4. A Z a z 0 -9 Spacebar Ans. A Z : 65-90 a z : 97-122 0 -9 : 48 -57 Spacebar : 32 15. What are tokens ? Ans. Each individual component used in Java is called as token 16. Name 5 tokens used in JAVA ? Ans . Literals , Identifier, Operators, Separator and punctuator and keywords Literals:- Constants used in Java, which remains fixed trough out the program 17. Difference between 1. = and == Ans. = is Assingment operator helps to assign value to the variable eg a=5. = = is relational operator used to check equality between primitive data type 3. / and % Ans. / Shows quotient value % shows reminder value 18. What are different character set available in Java. Ans. Letters, digits, operators, Delimiters. 19. Identify the use of non graphic characters I -TECH 1. \t tab space 2. \v vertical tab 3. \ 4. \ Page 2 5. \n new line feed 6. \\ \ 20. Give an example for 1. Declaration 2. Initialization Ans 1. int a; 2. int a=5; 21. What is type conversion Ans. In a mixed expression conversion of Data type into particular data is called type conversion which are of two type Implicit and Explicit type conversion 22. Differentiate between 1. 2. 3. Mixed & pure expression Mixed Expression with more than one data type Type conversion takes place Pure Expression Expression with one data type Pure expression doesn t fallow type conversion Coercion & type casting Coercion Also called implicit type conversion Automatic conversion to higher data type It is done automatic Type casting Also called as explicit type conversion Manual conversion of particular data type Needs users intervention Primitive & Non-primitive data type Primitive Independent of any other data type Basic data type Inbuilt data type Non-Primitive Dependent on Primitive data type Composite Data type Derived Data type 23. What is the difference between true and true Ans true is boolean literal true is String literal 24. in what way float different from double. Ans. float occupies 4 bytes and has default 0.0f double occupies 8 bytes and has default 0.0 25. Hierarchy of data types from lower to higher precedence. Ans. boolean < byte < char < short < int < long < float < double < string 26. Define with eg 1. Unary : works on single operand eg a++, +, 2. Binary : works on double operand eg a+b I -TECH Page 3 3. Ternary : works on three operands also called as conditional assignment statement Eg variable =(test condition)? Expression 1 : Expression 2. 27. Give two examples to illustrate shorthand operation. Ans a+=5 is equivalent to a=a+5 A*=10 is equivalent to a=a*10 28. How is JAVA expression different from statement? Ans. Expression: It is a set variables, constant and arithmetic operators Statement : It is an expression assigned to a variable is called statement 29. Using Unary operation explain 1. Prefix : increment before action, ++x 2. Postfix : increment after action, x++ 30. Write any two features of Java language. Ans. java is platform independent Java is case sensitive It uses both compiler and interpreter 31. Name the following 1. 2. 3. 4. Default package java.lang Package which contains classes for managing graphics java.awt Package which contains classes for mathematical function java.math Another name for Java interpreter. JVM(Java virtual machine) 32. What are packages? Give 2 examples. Ans. Collection of related classes and subclasses is called as package. Java.lang, java.util 33. Name three types of error occur while coding the program. Ans. Syntax, Logical and Run time error 34. Write syntax to input the following using scanner class. 1. char : ob.next().charAt(0) 3. double : ob.nextDouble() 2. String : ob.next() 4. int : ob.nextInt() 35. What is the use of keyword import in JAVA. Ans. Includes all the packages and related classes. 36. Name the package which includes all Math function in class Math. Ans. java.lang 37. Write the return type for following Math functions 1. Math.round ( ) int 2. Math.random ( ) double I -TECH Page 4 3. Math.cbrt ( ) double 4. Math.floor ( ) double 38. Syntax to get random number between 1 and n Ans. int r = (int)(Math.random ( ) *n++; 39. Syntax to get random number between m and n where m < n Ans. int r = (int)(Math.random ( ) *(n-m)+m; 40. True or false We can find cube root of negative numbers. True We cannot find square root of negative numbers. True 41. Difference between 1. Math.ceil ( ) and Math.floor( ) Math.ceil() returns the next integer number that is greater or equal to the argument saved in double data type eg Math.ceil(2.3) 3.0 Math.floor()returns the next integer number that is lower or equal to the argument saved in double data type Math.floor(2.3) 2.0 2. Math.sqrt ( ) and Math. cbrt( ) Math.sqrt() finds the square root of positive number return type is double eg Math.sqrt(4) 2.0 Math.cbrt() finds the cube root of positive as well as negative number double eg Math.cbrt(8) 2.0 42. Difference between switch case (branching) and if else (selection) switch if else Called as branching control Called as selection control Only checks equality All operators can be used like relation , logical, mathematical Cannot use decimal number All data types can be used None of the case gets satisfied it console goes to None of the condition gets satisfied it goes to default else 43. What do you understand by the term compound statement in Java ? Ans. Set of statement enclosed in curly or bracket is called compound statement { . . } 44. Explain fall through with example Ans In switch case the break statement terminates the block. If the break is not use the control will keep on executing other case till the console finds break or end of block such situation is called as fall through I -TECH Page 5 45. A menu driven program is also called as Ans. switch case 46. Identify the types of control 1. if else 2. for loop 3. switch 4. while loop 5. do while Ans. 1. if else - Selection 2. for loop Entry or Iterative 3. switch - Branching 4. while loop - Entry 5. do while -Exit 47. Name and explain 3 jump statement in JAVA. Ans. break , continue and return 48. Explain with example 1 Delay loop A delay loop has a high end value without any statements in the body of the loop. E.g for (int i=0;i<1000000;i++) { } 2 Infinite loop or Endless loop A loop which never ends(non-terminating loop) is an infinite loop. E.g for( int i=0; ;i++) { } Or if the condition is wrong 3 Null loop/Empty loop semicolon applied to a loop for (int i=0;i<10;i++); 4 Bodyless loop empty loop is called as bodyless loop for (int i=0;i<10;i++) { } 49. What is wrapper class? Name the package in which wrapper class belongs? Ans. Wrapper class belongs to java library. It wraps the primitive data type into objects. It belongs to java.lang I -TECH Page 6 50. What are the two primary purpose string conversion of Java? Ans. 1. To store primitive datatype. 2. To convert a string data type into another and vice versa. 51. Write the syntax to convert string to primitive data type Ans. int x = Integer.parseInt(String); or int x = Integer.valueOf(String) 52. Write the syntax to convert primitive datatype to string String S = Integer.toString(n); 53. Out of 256 ASCII character how many characters are used by computer? Ans. 128 54. What is the difference between ASCII code of uppercase character and lowercase characters? Ans. 32 55. What is autoboxing? Ans. Automatic conversion of primitive data type into an object of equivalent wrapper class. Eg. Integer val = new Integer (26); 56. State the purpose of autoboxing Ans. To pass primitive data type to a function that uses wrapper object as function argument. To add a primitive data type in the list of array element. 57. What is unboxing Ans. It is the system of converting an object of wrapper class into primitive data type. Eg. Integer val = new Integer (26); int v=val; unboxing 58. Purpose of unboxing Ans. 1. used when value from wrapper object is to be passed to the function having primitive argument. 2. When data from array list is to be used as primitive data. 59. Name wrapper class belong to char and boolean type Ans I -TECH Data type char boolean Wrapper class Character Boolean Page 7 60. What is the significance of * while importing a package. Ans. * means it includes all the super classes available in the package. 61. What is an array ? Ans. A non-reference datatype which represent a number of values of similar datatype with a variable having same name with different subscript. int a [ ] = new int[5] 62. SDA 1. Variable with same name having single subscript 2. It is also called single subscripted variable 63 DDA 1. Variable with same name having two types of subscript representing row and column number. 2. It is called as double subscripted variable Linear Search Works on sorted as well as unsorted array. The search begins from 0th position to last position Binary Search Works on sorted array Divides the array in two halves and search the element in either half 64 what is meant by subscript of an array. Ans. The cell number of the array within the square bracket. 65 .length() String function Finds the length of the string .length Array property Finds the length of array 66 state the size of the array a[5] with char data type and int with c[10] Ans. a[5] char 2 bytes X 5 = 10 bytes c[10] int 4 bytes X 10 = 40 bytes 67 write the statement to initialised first 5 odd numbers in an array m[] Ans. int m[ ]= { 1,3,5,7,9}; 68 write the statement to declare first 5 odd numbers in an array m [ ] I -TECH Page 8 Ans. int m[ ] = new int[ 5 ]; 69. what would be the following print int m[ ] = new int[5]; System.out.println(m); Ans. Garbage value 70. Search Two types Linear and Binary search It searches the element in the given array Sort Two types Selection and Bubble sort It sorts the array in ascending or descending order 71 what is the key role of command new Ans. class. It creates object with dynamic memory allocation or it create temporary instance of the 72 what is the difference between variable and array variable Ans. variable can store single value while array variable can store number of elements under one variable of similar data type. 73 Selection sort Smallest element is selected and interchanged with the element available at 1st index in ascending order and vice versa in descending It interchanges the value Bubble Sort Adjacent element is compared and swapped It swaps the value 74 give default for the following data type String - null or float - 0.0f char - \U0000 75 .equals( ) Return type is boolean It checks for equality I -TECH .compareTo( ) Return type is int Not only checks for equality but also compares Page 9 two string with its ASCII values 76 Character.toUpperCase( ) Return type is char it converts the given character in uppercase Character.isUpperCase( ) Return type is boolean It checks the given character is in uppercase 77 What is the key role of valueOf( ) command in java Ans. valueOf( ) function converts a string to a primitive data type 78 Name the string function which removes the blank spaces in the extreme of the sentence. Ans. .trim( ) 79 CHARACTER FUNCTIONS Function Return Type Use Character.isLetter() boolean Function checks for the alphabet Character.isDigit() boolean Function checks for the Digit Character.isLetterOrDigit() boolean Function checks for the alphabet/Digit Character.isWhiteSpace() boolean Function checks for the blank space Character.isUpperCase() boolean Function checks whether the given argument is in uppercase Character.isLowerCase() boolean Function checks whether the given argument is in lowercase Character.toUpperCase() char Function changes the given argument to lowercase Character.toLowerCase() char Function changes the given argument to uppercase 80 ASCII codes A-Z 65-90 a-z 97-122 I -TECH Page 10 0-9 48-57 Space 81 32 STRING FUNCTIONS Function Return Type Use toLowerCase( ) String Converts all the character to lowercase toUpperCase( ) String Converts all the character to Uppercase replace( ) String Replaces character or a part of a string trim( ) String Removes all the extreme space (before and after the string) equals( ) boolean Checks whether two strings are equal equalsIgnoreCase( ) boolean Checks whether two strings are equal ignoring the case compareTo( ) int It checks two string and returns 0 if both are equal -(negative integer) if 1st string is smaller than 2nd +(positive integer) if 1st String is greater than 2nd length( ) int Returns number of characters present in the string charAt( ) char Returns the character of the string on nth position substring( ) String Return substring from the given nth position Note s.substring(m,n) in the given string it will return a part of the string starting from mth position but ends (n-1) position concat( ) String it concatenate/Joins two string indexOf( ) int Returns the index position of the first occurrence of the given character. I -TECH Page 11 Note s.indexOf( m , n) Returns the position of m in the string from nth position lastIndexOf( ) integer(int) Returns the index position of the last occurrence of the given character. endsWith( ) boolean Returns true if the string 1 contains suffix specified by sting 2 startsWith( ) boolean Returns true if the string 1 contains prefix specified by sting 2 82 MATH FUNCTIONS Function Math.sqrt(a ) Return Type Use double Returns the square root of the positive integer a Math.min(a , b ) int Returns the smallest number between a , b Math.max(a , b ) int Returns the largest number between a , b Math.pow(a,b) double Returns ab Math.log(a) double Returns the value of log10 a Math.sin(a) double Returns the value of sin/cos/tan in radians double Returns the value of asin/acos/atan in radians Math.exp(a) double Returns exponent value ea Math.ceil(a) double Returns the whole number greater or equal to the number Math.floor(a) double Returns the whole number smaller or equal to the number Math.round(a) int Math.cos(a) Math.tan(a) Math.asin(a) Math.acos(a) Math.atan(a) I -TECH Returns rounded value to the Page 12 nearest number Math.rint(a) Math.random() double Returns rounded value to the nearest number but if the decimal place is at equidistance i.e say 4.5 0r 5.5 it will go to its nearest even integer viz 4.0 or 6.0 respectively double Returns value between 0 and 1 Note :- if you want to display Random nos between m and n use the formula (int) ((Math.random( )*(n-m))+m) if you want Random nos between 1 and n use the formula (int) (Math.random( )*n) if you want Random no 1 or 0 as head and tail use the formula (int) (Math.random( )*2) 83 == Checks equality between primitive data type .equals( ) Checks equality between strings 84 Convert a number stored as String variable s to double data type. Ans. String s= 123.45 ; double c= Double.parseDouble(s); 85 Define Method - Program module used at different instances in a program to perform specific task is known as a method and function 86 State the components needed to define a class. Ans: Access specifier, Keyword class, Instance variables , Member methods. 87 State the components needed to declare a class. Ans: Class name , class keyword , Access specifier 88 Precedence of Operators Operator [ ] ,( ), . ++, --, ! * ,/, % I -TECH Use Array, parenthesis, dot Increment, decrement, not Multiplication, division, modulo Page 13 +, <, >, <=, >= == ,!= && || ?: =, +=, -=, *= /=, %= Addition, Subtraction Relational Equality Boolean Logical AND Boolean Logical OR Conditional Assignments or shorthand 89 Different types of Access Specifier and scope Access Specifier default/friendly public private protected Within class Yes Yes Yes Yes Outside class Yes Yes No If inherited Outside Package No Yes No 90 Private Scope is within the class Abstraction takes place Protected Scope Within the class but can be outside only in case of inheritance Inheritance can be done 91. Components to define a function Ans. Access specifier, access modifier, return type, function name and parametric list and method block. Or Program module used at different instances to perform specific task is called function 92. Components to declare a function Ans. Access specifier, access modifier, return type, function name and parametric list . 93. Define Function Signature : Function signature is identification of the method with function name and parametric list. Function block :- Function body contains set of statements which are to be executed. return statement :- Statement that sends the value back to the caller/calling method. void statement : :- Statement that does not send the value back to the caller/calling method. 94. Features of return statement Ans. Always used at the end of the method - returns the value to the caller method - may have more than one return statement but only one gets executed I -TECH Page 14 - no statement is executed after the return statement 95, Two ways to invoke the function Ans. - Pass by value - Pass by reference 96 Actual Parameter Defined in caller/calling method It passes the value to formal parameter Formal Parameter Defined in Function header It receives the value from actual parameter 97 Pure Function This function does not change the state of the object passed. Impure Function This function changes the state of the object passed. Called as Accessor methods Has a return type Called as Mutator methods May or may not have a return type 98 Call by Value Primitive data types are passed by value Values of actual parameters are copied into formal parameters Any change made in formal parameter does not affect actual parameter Call by Reference Non- primitive data types are passed by reference Address of actual parameters are passed to formal parameters Any change made in formal parameter affects actual parameter 99 static functions static function can be called on Class name Only static variables can be accessed directly from static functions non static functions Non-static functions can be called on object name Both static as well as non-static variables can be accessed directly from the non-static functions. 100 static variables non- static variables (instance variables) Only one copy of the static variable is common for all the objects static variables can be accessed directly from static as well as non-static functions Every object has its own copy of non-static variable Non static variables cannot be accessed directly from static functions. Object needs to be created. Also called instance variables Also called class variables 101 I -TECH Page 15 Class Variable Declare within the class Scope of the variable is throughout the class Class variable can be static Local variable Declared within the body of method Scope of the variable is within block or curly bracket Local variable cannot be static 102 a. Constructor Same name of that of class Automatically invoked during object creation No return type not even void Method Any other name other than the class name Need to be called by object name Return type mentioned b. Object Object is an instance of a class. Object is a physical entity. Object is created through new keyword mainly e.g. Student s1=new Student(); Class Class is a blueprint or template or object factory from which objects are created. Class is a logical entity. Class is declared using class keyword e.g. class Student{} 103 Features of constructor Ans. has same name of that of class - use to initialised data members - Automatically called during object creation - constructor are always public - no return type not even void - constructor are overload automatically 104 Class is called as an User Defined Data Type. Explain. Ans: A user can create a data type, and declare certain characteristics and behaviour within it. This can be done by using a class. Hence class is called as User Defined Data Type. 105 Class is called as a Composite Data Type. Explain. Ans: - Java uses predefined datatype to provide certain facilities during programming - When they are used to declare any variable then those variable posses in built characteristic and behaviour 106 Class is called as an Object Factory. Explain. Ans: A class creates a number of objects possessing the certain characteristics and behaviour. Hence, Class is called as an Object Factory. 107 Objects is called instance of class Ans. Object of class posses all data and functions provided in the class. It contains all the features of the class. Hence objects is called instance of class. 108 Pillars of Java I -TECH Page 16 1. Encapsulation: Wrapping of data and function of an object into single unit in such a way that the data members are applied only within function. 2. Polymorphism(Early/Static Binding) :It is the process of using a function for multiple purpose. Function overloading works on the principle of polymorphism wherein it shares the same function name but different parametric list. 3. Inheritence(Reusability): It is a property by virtue of which one class(child class) acquires some features of another class(parent class). It promotes reusability 4. Abstraction :- Act of representing the essential feature by hiding background details 109 Basic Elements of OOP Ans. Objects ,Classes ,Data Abstraction , Encapsulation, Inheritance, Polymorphism Dynamic Binding 110 Use of dot(.) operator Ans. dot(.) operator is the member operator it is used to access member of a package or a class 111 constructor overload Ans. Process of using a number of constructor with same name of that of class but different types of parameters is known as constructor overload Eg public class program program( ) { } Program(int x) { } void main() { program ob=new program(); program ob1=new program(); } } I -TECH Page 17

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

 

  Print intermediate debugging step

Show debugging info


 

 

© 2010 - 2025 ResPaper. Terms of ServiceContact Us Advertise with us

 

zahinmakani chat