You are on page 1of 55
Marinum Marks: 50 Time allowed: One hour (inclusize of reading time) | ALL QUESTIONS ARE COMPU! The mari intersted | ackets{ | Select the correct option for each of the following questions. SECTION A (30 Marks) question 1 (Choose the correct answer. ey (a) Which of the following are valid comments? 0 ) / comment wa Gx) */ comment * 1L @&@ 2OeW) 3. Allof the above s. None of the above (b) Operators with higher precedence are evaluated before operators with relatively lower precedence. Arrange the operators given below in order of higher precedence to lower precedence. @ && @e =~ w= L Gv). @. Gi), 2. 6). GD), @. 0 3G), Gi), GD. @ +. ©, @), Gi), G) (€) Which of the following keyword is used to create an instance of a class? 1 new 2 public 3. dass 4. of the above (d) What is the final value double a =-8.35; double x = Math.abs(Math.floor(a)); on . 6 _2 (©) Name the type of error in the statement given below: ' red in variable x? 2 Runtime 4. None of the above gl Fill in the blanks with the correct option. (a) The allows a class to use the properties and methods of another dass 1. Inheritance 2. Polymorphism 3. Encapsulation 4. None of the above (©) The number of bytes occupied by char data type bytels Lo4 28 2 4. None 4 ‘eovman towten rant | 94 wh iat 2. double 4 a. char 4, String, i wh pad 4 at 4 4 puction 6 Aon {ive the output of the following, aT 2 2.8 3. 26 (hy f(a b) System.out printin(atb); System.out.printin (a*b); when a= 5 and b= 7 1 12,35 2.35 a. 35,12 (0) String x= (a> 90) ? “excellent” “best; when a= 90 1. best 2. excellent 3. excellentbest (a) switch (x) [case ‘a’ : System.out.printhn("Discipline”);, case ‘b’ : System.out.printin (“Dedication”); breaks case ‘¢’ : System.out.printhn(”Commitment”); default : System.out.printin("Success”); when x=A’ Discipline 2. Dedication . Suecess (¢) n-1000; while (n>10) {n=n/10; } . System.out.printin(ny; How many time the loop is executed and what isthe output? 1. Loop is executed 2 times and the output is 100 2. Loop is executed 3 times and the output is 10 3. Loop is executed 2 times and the output is 10. SECTION B (20 Marks) “estion 7 Given below is a class with the following specifications: Class name: overload Member Methods: “vid print (int n ) to print the first ‘n’ natural numbers boolean print (int m, int n) to check whether n is a multiple of m or not 'illin the blanks of the given program with appropriate java statements ~ «lass (a) void print (int n) { 334 | Ics€ CHAPTERWISE MCQs (Computer Applications) ~ x int k; for (ees (eens (cy i System.out printIn(k); ) boolean print( int m, (e). ) ( if((]___ ) return true; else return false; } ) (@) 1. OVERLOAD 2, overload 3. class im @) 1 k=1 2ken 3. k=0 0) (9 1 ken; 2. ton; 3. ken; W @ 1. k2 2. #5 3. ke 0 (©) 1. intn 2. doublen 3 charn 0 (1. if(n%m—=0) 2. if (m%n=0) 3. if (m/n—0) tl Question 8 ‘The following program is based on the specification given below. Fill in the blanks with appropriate js statements. class name: telephone member variables : int noc [ number of calls] Member methods : void main ( )~ to create an object of the class ani class (a), double bill [ telephone bill to be paid } String n [name of the customer ] void input ( ) ~ to accept the data using the scanner class void print() - to print the details void calculate () ~ to calculate the telephone bill as per the following criteria based ©" number of calls Number of calls Rate per call First 100 calls free Above 100 calls Rs.2.50 \d invoke the functions of the class { int noc; double bill ; String n; Scanner ob = (b), Scanner(System.in); void input( ) see spectra toeston yes | 35 1 System.out printin(“Enter Number of calls"), noe (6), System.out printin(“Enter name) neob.next() | void calculate() { f(@io bill -0; else bill = (¢) | void print() {System out printin(“Name = “4n); System out printin(“Amount to be paid” ill) ' void main () {telephone t= new telephone(); tinput(; ©) print); } (2) 1. telephone 2 dass B.object (0) L.old 2 new 3. void (©) 1.0b.nextDouble) 2 obnertLinel) 3. obnextInt() (4) 1-noce109 2 noc<= 100 3.noc> 100 (e) 1. bill-+(n-100)°2.50 2 bill = (n-100/350 3.bill =n°250 () Ltinput() 2 tealoulatet) 3.t-print) Question 9 ‘The following program segment calculates the norm of a number, norm of a number is squaze roc of suzn Example: The norm of 68is 10, 676 + BrB = 36-64 = 100 square root of 100s 10. Fill in the blanks with appropriate java statements. void norm ( int n) { intd,s={a)_5 While ((b), { d=n%10; —_—— —-- 336 | 1cse CHAFTERWISE MCOs (Computer Anplctions) = _ _ | s=(Q_____ n=n/10; ' System .out printin(*Norm =“ + (4)_____ } (a) 1.0 2.0.0 3.1 (b) 1.0 2nd 3.1 (c) 1.std*d 2. stded 3. ststd (4) 1. Mathsqrt(s) 2, Math. SQRT(s) 3. Math.sqrt(n) Question 10 Read the paragraph given below and answer the questions given below: Case study 1 To check for a condition and execute the statements based on the condition can be done using the decision control statements. The two decision control statements in java are if and switch, switch is also called as multiple branching statement. An if statement within another if statement is termed as Nested if Statement Repetitive execution of a set of statements is termed as looping. The two types of looping statements are entry controlled and exit controlled loops. Both while and for are termed as entry-controlled loops. A for loop is used when the number of iterations is known. A while is used when the set of statements are executed as long as the condition is true, itis executed when the number of iterations are not known. (a) What are the two decision control statements in java? Lifand switch 2. for and while 3. ternary and logical (b) An if statement within another if statement is termed as 1. Nested 2. Nested while 3. Nested if (€) Name given for repetitive execution of set of statements. 1. Looping 2. Decision Control 3. Assignment (d) Which one of the following does not execute even once? 1. for(k = 1; k<=100;k+4); 2. for(k=10;k<1:k+4); 3. for(k=I;o=1;:k+); Answers SECTION A 1. (@) Correct option 1 which have (i) and (iii) Explanation: In Java comment statement of single line is written by /*......*/ and multiple line comments are written by /..... (©) Correct option is 2. B ‘ Stanaton: Unary operator ++ has highest priority followed by Comparative operator > followed by (e) cgi? operator % where the logical and operator && has lowest priority of the given list here. OFrect option is 1, uw *Planation: ‘on: In Java keyword ‘new’ is used to create instance of an object. Specimen Question Paper | 337 wal {) Correct option is Explanation: Logically by doing, floor operation the values will be rounded to -9, then by applying lor the value will be converted to 9, which is represented as 9.0 in double. absolute op (6) Correct option is 2 Explanation: On execution of this statement the machine will trap in hold situation and no result will occur, thus, itis runtime error, 2, (a) inheritance, So the correct option is 1. Explanation: The inheritance property in Java allows to use the feature of the base class by the derived class. (b) 2 Bytes, correct option is 3. Explanation: In Java, the compiler Javac allocates 2 Byte memory for char type data (6) Object, correct option is 1 Explanation: Class is the factory of object. The instance of a class is object (a) Keyword, correct option is 1 Explanation: Every keyword in Java has its prede by the programmer. (6) Nextiline() correct option is 2. Explanation: The method to accept a line text without space in Java in Nextline() {a) Correct option is 3. Explanation: The wrapper class to reate integers in Java in Interger. (b) Correct option is 2 Explanation: In compilation process the intermediate code generated for the soure code is called Byte code. The Byte code produced by JVM can be interpreted on any machine with different architecture and platform. (©) Correct option is 1. Explanation: Construtor is the special method defined with same name of its class. (@) Correct option is 1. fined and special meaning, which cannot be altered Explanation: The function to terminate the execution of the constructer is System exit(0). (©) Correct option is 2. Explanation: The mechanism call by reference associates the passing of address of the object while invoking a function in Java 4. (a) False. Explanation: () True. Explanation: And of two false statement is false, but its negation is true. (©) True. Explanatior (4) False. Explanation: Default statement is compulsory to each switch statement; it handles the flow of execution when all the cases of switch statement gone wrong. () True. Explanation: The assignment operator is left associative. (2) Portable, correct option is 3. Portable is not the feature of OOPs programming languages. je is primitive data type in Java. -ope of a variable is its loal class. Explanation: (b) &&, correct option is 3. Explanation: All are relational operators, whether &: is logical AND operator. 338 | Icse cHapTeRWiSE Mcas (Computer Appliations) ~X (©) Retum, correct option is 1 Explanation: Return s associated with the output data type of function, whether all others are associat with exit or resume of the statements in a block like for, while, switch, etc. (d) String, correct option is 4. Explanation: String is derived data type whether all others are primitive data types. (@) ||, correct option is 4. Explanation: Except | all others are arithmetical operators, | is logical OR operator. 6. (a) Out value is 25, so the correct option is 4. (b) Output values are 12,35 thus correct option is 1. (©) Resultant output is excellent, so the correct option is 2. (a) The decision goes into default case, so the output will be success. Thus, the correct option is 3. (e) Correct option is 3. SECTION B (b) Correct option is 1. (A) Correct option is 3. (£) Correct option is 1. (b) Correct option is 2. (A) Correct option is 2 (6) Correct option is 2. (b) Correct option is 1. (©) Correct option is 1. (d) Correct option is 1. (b) Correct option is 3. 10. (a) Correct option is 1 (©) Correct option is 1. (d) Correct option is 2. ag 7. (a) Correct option is 2. (©) Correct option is 1 (e) Correct option is 1. 8. (a) Correct option is 1. (©) Correct option is 3. (e) Correct option is 1. 9. (a) Correct option is 1 » Revision of class IX Syllabus | chapter at a Glance * Java a penetal purpose, object oriented programrning, language developed by Sun Microsystems of USA in sre can develop two types of Java programs {i) Stand alone applications, (ii) Web applets. 1 Sund alone applications are programe written in Java to carry out certain tasks an a stand alone Jocal cienpute. In fat Java can be used to develop programs of all kinds of applications, which earlier, were developed using languages like C and C++ Java proggarms involves 2 steps : (i). Compiling vnarce code into byte code using, javac compile (ii) Executing the byte code program using java interpreter. + Appletsace srall Java programms developed fur internet applications. An applet located ona distant computer ae eietcan be down loaded va internet and erecuted on a local computer (client) using a Java-enable web browser. + doe | 19a development environment to write and compile Java programs. It is developed by Monash, Un Arora in Java by Blue J requites JDK. 1.3.08 above (Java dovelopment kit) itis window based ot band software. + Working in Blue J To start Blue J clicked at Start > programs > Blue J To write a jave prog he given steps (i) Create a thse J project 7 t x [Robust [Secure Pointers | Global | Variable _| ~ _pravide [| [ Operators | 340 | Icse CHAPTERWISE MCAs (Computer Applications) -x > Java Statements The statements in Java are like sentence: appear. Multiple Choice Questions 1. Among the following, which method does not have a body (a) A class (©) An interface (©) Anabstract method (d) None of the above 2. Which language was developed as the first purely object programming language? (a) Java (b) C+ (©) Small talk (4) Kotlin 3. Among the following, which is not valid class specifier? (a) Protected (b) Private (©) Pointer (4) Public 4. Among the following, which is not an OOP’S concept? (2) Encapsulation (b)_ Exception (¢) Abstraction (d) 5. Which among the following is not a Java feature? Polymorphism (2) Use of pointers (b) Architecture Neutral (©) Object-oriented (a) Dynamic 6. Which is the minor integer data type? (a) Byte (b) Long (0) short (d)_int 7. Among the following, which is not a primitive data type? (a) enum (b) Short (0) Byte (4) Int 8. Which of the statement satisfies the empty loop in java (a) Ithas an empty conditional clause (b) Ithas an empty increment clause initialization clause (c)_Ithas an empty (4) All of above 9. Among the following classes, a superclass of all other classes is? (a) Math (b) Process (©) System. (d) Object 10. Which of the function is a rounding function of Math class? in natural language. A state token ending with a semicolons () mark, Statements are usually executed in ment isan executable combination Sequence inorder in which (a) mind) (b) maxi) (©) abs) (a) all of the mentioneg 11 Which of these have the highest precedence, (b) + @) 0 : (@) > 0 12. Modulus operator, %, ¢ (a) Integers (b) Floating-point numbers (6). Both Integers and floating ~ point numbers ‘an be applied to. (4) None of the above The Math class is included in which java package (a) Java.io (b) Javalang (9) Javacutil (d) Javasys 14, Todisplay the date and time in java which package 13. is included ? (a) Java.util’ (b) Java.Date* (6) Java.io.* (d)_Javalang* 15, What does the object has ? (@) Attributes (b) State (9) Behaviour (d)_Allof the above from Question 16-20 find the odd one out: 16, (a) Code Reusability (b) Efficient code (©) Duplicate /redundant data (d) Modularity 17. (a) Data hiding (b) Data Binding () Message passing (d) Platform independent 18. (a) Constructor and Destructor (b) Inheritance and Polymorphism (c) Structure and Union (d) Class and Object 19. (a) if (b) fort) (©) Continue (d) break 20. (a) Integer stream (b) Short stream (©) Byte stream (d) Long stream 340 | cst CHAPTERWISE MICAS (Computer Applications) — x = > Java Statements The statements in Java are like sentences in natural language. A statement is an executable combination of token ending with a semicolons (.) mark. Statements are usually executed in sequence in order in which they appear Multiple Choice Questions fo) mit ©) max 1, Among the following, which method does not (©) abs0 ee eee have a body 11, Which of these have the highest precedence, (a) A class @ 0 (b) + (b) An interface ot «> (©) Anabstract method (a) None of the above 2 Which language was developed as the first purely object programming language? (a) Java (b) C+ (o) Small talk (4) Kotlin |. Among the following, which is not valid class specifier? (a) Protected (b) Private (©) Pointer (a) Public 4. Among the following, which is not an OOP'S concept? (2) Encapsulation (c) Abstraction (d) 5. Which among the following is not a Java feature? (b) Exception Polymorphism (a) Use of pointers (b) Architecture Neutral (6) Object-oriented {d) Dynamic 6. Which is the minor integer data type? (a) Byte (b) Long, (0) short (d) int 7. Among the following which is not a primitive data type? (2) enum (b) Short (o) Byte (a) Int 8. Which of the statement satisfies the empty loop in java (2) Ithas ane (©) thas an empty increment clause (c) Ithas an empty initialization clause (d) All of above following classes, a superclass of all ()) Process (ad) Object 10. Which of the function is a round (©) System function of ma 12, Modulus operator, %, can be applied to. (a) Integers (b) Floating-point numbers (c)_ Both Integers and floating ~ point numbers (a) None of the above 13, The Math class is included in which java package (a) Javaio (b) Java.lang (©) Java.util (d) Javasys 14. Todisplay the dateand time in java which package is included ? (a) Javautil” (c) Java.io* 15, What does the object has ? (a) Attributes (b) State (0) Be (d)_ Allof the above from Question 16-20 find the odd one out: 16. (a) Code Reusability (b) Efficient code (©) Duplicate redundant data (d) Modularity 17. (a) Data hiding, (b) Data Binding (b)Java.Date.* (a) Javadang* (©). Message passin (d) Platform ind wndent 18, (a) Constructor and Destructor (b) foheritance and Polymorphism (Q) Structure and Union (4) Class and Object (a 0 (b) ford, (©) Continue (d) break 20. (a) Integer ntream (0) Short streany (e) Byte ot (A) Long, stream an 342 | Icst CHAPTERWISE MCQs (Computer Applications) ~ X 56, With javadoc, which of the follo 45. Evaluate the following expression, if3, y=5, and m javadoc comment? 210: Haty-yenexe (a) wr (@) 3 (b) 25 wr «yu (© 20 (a) 4 57. How many times ‘Hello’ is printed? 46. The result of the expression of 818, Pablie static void main(String args{]) (a) 64 1 ( 8 (@) 16 for(i = Oid) xeG else xed: @y (x= (rd) 2d id; i) x= (c>d) ? (c>d) 2d; al) Pers fivyx=(c () ?: {i) Conditional operators’ (ii) Arithmetic operators Bitwise operator {iv) Assignment operator (&) Helse Statement jare (i) One-way selection statement (ii) Two-way selection statement (iii) Multi-way selection statement (iv) Multipath decision statement. (a) Whatis the other name for (?:) Question Mark Colon Operator.? (i) Comparison Operator (ii) If Else Operator (i (iv) Ternary Operator Binary Operator Java offers a rich set of operators to manipulate variables. Operator in Java is a symbol that is used to perform operations. For example: +, -;", / ete. Operators are special symbols that execute specific operations on one, two, or three operands and then return a result. Operators with higher precedence are evaluated before operators with relatively lower precedence. Operators on the same line have equal precedence. When operators of equal precedence seem in a similar expression, a rule must govern, which is assessed first. Entirely binary operators except for the assignment operators are assessed from left '@ right; assignment operators are evaluated ‘ght to the left. *= is an assignment operator. It use* an arithmetic operator like +, -,*, or /, and the assignment operator (a single ‘ (a) int ke1,ie2; while(+4i<6) ke system.out.printin() Predict the output (030 Gi) 60 ivy 50 {) Kei is equal to (kEK: Gi) keke (i) KK ei (i) ke ksi: y 4 {i) Increment operator Gi) Decrement operator (iii) Arithmetic operator (iv) None of the above (a) Types of Integers are. (short (iii) long (i) int (iv) all of the above @. While working with loops, it is sometimes needed to ship some statements inside the loop or terminate the loop immediately without examining the test expression. In such cases, reak and continue statements are used. Break statement in Java terminates the loop immediately, and the program’s control transfers to the next tatement following the loop. It is almost used with decision-making statements (Java if..else Statement). It can be used to terminate a case in Revision of cass x Syllabus | 345 the switch statement (a) int main() { while(true) { System out printin("RABBIT”); break; | return 0; ' Predict the output () RABBIT (ii) RABBIT is printed an unlimited number of times. No output (iv) Compiler error (b) Loops in are implemented using. (i) While Block (ii) For Block Do While Block(iv) All the above (©) What is the way to come out of or Quit any Loop suddenly () quit; statement Gi) leave; Statement (iii) break; statement (iv) continue; Statement Answers Multiple Choice Questions 1 (c) Anabstract method Explanatio) Abstract method is declared using the keyword abstract Abstract methods are declaration only and are not plemented. It does not have a method body. (6) Small talk Explanation: Small talk programming language was invented as the first pure OOPS (object- riente(d) language. This language was designed by Alan Kay in the early 1970s. (©) Pointer Explanation: There are three types of Access Specified Public: they are accessible outside the class Private: they are not accessible outside the class Protected: They ‘loss unless with the help of friend class. can't be accessed outside of its 4. (b) Exception 5. (a) Use of pointers Explanation: Java provides a layer of abstraction to the developers by not using pointers in Java. Java is dynamic, architecture and object-oriented programming language. 6. (a) Byte Explanation: ‘byte’ is signed 8-bit smallest integer data type that has range from -128 to 127. 7. (a) enum Explanation: An enum is a type that has a fixed list of possible values, which is specified when the enum is created. 8. (d) All of above Explanation: An empty loop is a loop which does not have any updating or value of iteration. 9. (d) Object Explanation: The object class is a superclass ofall other classes. a> 346 | ICSE CHAPTERWISE MCQs (Computer Applications) -X 10. (d) all of the mentioned. Explanation: max(), min() and abs() are all Explanation: Order of precedence is (highest to lowest) a->b->c->d. 12, (©) Both Integers and floating ~ point numbers Explanation: Modulus operator can be applied to both integers and floating point numbers. () Javalang Explanation: The java.lang. Math class contains methods for performing basic numeric operations such as the elementary exponential, logarithm, ‘square root, and trigonometric functions. (a) Java.util.* 13. 14. Explanation: The java.util package defines a number of useful classes, primarily collections classes that are useful for working with groups of objects. (d) All of the above Explanation: An object is an identifiable entity that incorporates a set of attributes, behaviour and state. So all of the above applicable for objects, (©) Duplicate /redundant data Explanation: Duplicacy or Redundancy of data is 2 feature that is dependent on the programmers. So, it cannot be created by the OOPS (4) Platform independent 15, 16. 1. Explanation: Platform independence is a feature that does not come under the OOPS concepts. This feature depends on the programming language (©) Structure and Union Explanation: Structure and union are not in oops. (@ if0 Explanation: Continue and break statements, for is a looping statement. (0) Byte stream 18. 19. is jump 20. Explanation: Java describes only two types of streams Byte stream and character stream. 21. (b) False Explanation: Functions can always return an object if the return type is the same as the object returned. 22. (b) False Explanation: Only the DO WHILE loop performs the statements at least once. 8 (a) True (b) False Explanation: Constructors cannot return any value. (a) True (a) Alan Kay 24. B 26. Explanation: This language was designed by Alan Kay in the early 1970s. 27. (a) Any number Explanation: We can define any number of classes with different names in a single program of OOPS, 28. (c) passed by function Explanation: Object can’t be passed as function as it is an instance of some class, it’s not a function. Object can be passed by reference, value or copy. (a) JDB Explanation: The JDK (Java Development Kit) is a software development environment used to develop Java applications and applets. (©) -128 to 127 Explanation: Byte data type is an 8-bit signed Java primitive integer data type. Its range is -128 to127. (@) 4 Bytes Explanation: The size of integer in Java Programming is 4 Bytes. (a) dot operator(.) 29. 30. 31. 32. Explanation: Instance variables and methods are accessed via objects with the help of a dot ( operator. The dot operator creates a link between the name of the instance variable and the name of the class with which it is used. )1 Explanation: Decrement operator, decreases the value of variable by 1, (©) do while Explanation: An exit controlled loop 8 that category of loops in which the test condition is checked after the execution of the body of the loop. 33. 34 «(by Switch Explanation: Branching statements allow the ow of execution to jump to a different part of the program. The common branching statements used within other control structures include: break , continue, return , and goto. () Abstract Window Toolkit Explanation: The Abstract Window Toolkit (AWT) is Java's original platform-dependent windowing, graphics, and user-interface widget toolkit, preceding Swing, 7. (a) char ch="\utea’; Pa Explanation: A char literal may contain a Unicode character (UTF-16). We can directly use these characters only if our file system allows us, else use a Unicode escape (\u) such as “\u02tee", 38. (0) 2 Explanation: Therearetwotypes of polymorphism injava: 1, Static Polymorphism also known as compile time polymorphism 2, Dynamic Polymorphism also known as runtime polymorphism 39. (b) False Explanation: The encapsulation concept does not add the function in a user-defined structure because if the member functions are involved, then the user cannot call the structures defined by it. 40. () Math.sqrt(a,2) Explanation: Mathsqrt would return the square root of the number instead of the square (b) Byte code Explanation: A Java Compiler javac is a computer program or set of programs which translates java source code into java byte code 12. (b) Unicode Explanation: Every character in JAVA has a unique value that is called Unicode. a. 18, (d) Data representation, operations. *rogramming Based Question 4. (a) Infinity Explanation: Whenever we divide any number (double, float, and long except integer) by zero, it results in infinity. edison of dss Statue | 347 45. (b) 25 Explanation: In the pression, + that the value will fist ineremem to Now, evaluate the statement b of x y, and 2. On evaluatin get 25, as shown below, Heryeyeznee 1145-54 1143225 above e nt by 1 ie. 12 'Y Pulling the values B the expression, we 46. (c) 8 Explanation: Converts the value of both the Operands into binary form and performs OR operation bit by bit, (a) 3 Explanation: The value of a/b would be 35, resultin Integer data type when both the ope are in integer data type. 47. e rands So, the result would be 3. (©) for(i=3;ic=30;i-1+3) Explanation: for (i = 3; i < = 30; generate numbers in the set: (3,6,9,12,15 18,21 ,24 27,30) 49. (d) 47.0 Explanation: The Mathceil() function always rounds a number up to the next largest integer. (a) 46.0 Explanation: The Math.floor() function returns the largest integer less than or equal to a given number. (a) 13 Explanation: Perform modulus operation first.as it has gota higher priority. = 624247 4247 3 1 Explanation: % is a Remainder operator. (b) -2 Explanation: % is a Remainder operator. (a) 25 Explanation: In the above expression, +2 means that the value will first increment by 1, ie. 12. Now, evaluate the statement by putting the values 48. 50, 51. 52. 53. 54. of x, y, and z. On evaluating the expression, we get 25, as shown below. Hasty -ytztxt e—_ 91) Switch *Planation: Branching statements allow the OW of execution to juinp toa different part of the Program, The common branching statesuesity Used with other control structures inchs Teak, continue , return, and pote, 36 (€) Abstract Window Toolkit Explanation: The Abstract Window Toolkit (AV/t) #5 Java's original platform-dependent winduvany, graphics, and user-interface widget tuolbit, preceding Swing, 37. (a) char ch="\utea’; Explanation: A char literal may contain a Unicnde character (UTF-16). We can directly use these characters only if our file system allows us, use a Unicode escape (\u) such as “\ u2tee” 38, (b) 2 Explanation: Therearetwotypesof polymorphism in java: 1, Static Polymorphism also known as compile time polymorphism 2, Dynamic Polymorphism also known as runtime polymorphisin. 39. (b) False Explanation: ‘The encapsulation concept does not add the function in a user-defined structure because if the member functions are involved, then the user cannot call the structures defined by it 40. (c) Math sqrt(a,2) Explanation: Math.sqrt would return the square root of the number instead of the square 41. (b) Byte code Explanation: A Java Compiler javac is a computer program or set of programs which translates java source code into java byte code (b) Unicod Explanation: Every character in JAVA has a unique value that i called Unicade, 43, (d) Data repre propramming Based Question ae a 44, (a) Infini planation: Whenever we di ny number rare at a HH CHL) yoo gults in infinity: re 2, tation, operations, i es di Pets th aD afsairn | AAT 45. thy 25 Explanation; ly thas ainioe express, 457 aap Wat the valine vel Sirs wa pennant Wy 4, be 12 Neve evalvatc tha stateqnient hy pouting tha abies ON 40 aud £00, wyaluatiny, thee eapresslon, 16 W425, 0% sbuvves Vidor Hayy Wo 5s ese 9g M6, (6) Explanation; Convert te value of tanh the perands inte inary farm ad pestorine OF ‘agweration bit by bit 47, (a) 4 Siaxplanation) The value oh apis youl be 45, Cove result in tn per data ype when Leah the operands ave In Integer ata typo Sey thee result yrauld bie 4 4B, (h) Sortie) planation generat for i= he = Wd bs MM umbers in the set 13,0,9,12,N514 20 28, 49, (d) 47.0 Sxplanation: ‘The “wih Mathceil(y function always rounds a number up to the nen largest integer 50, (a) 460 Explanation; The Math floor) function returns the largest inte yer Jess than or equal ta a piven number 5h. (a) 13 Explanation: Perform mexulus operation firstas has pot a hig =O 20267 = ANT «13 52, (b) | Sxplanation: % is a Remainde 53. (b) -2 Explanation: % Isa Remainder operator 64. (d) 25 Sxplanation: tn that the value will first increment by |e Now, evaluate the nlatement by putting the of my, and 2, On evaluating, te expression: fet 25, as shown below. a ae ae cr paiority, hove expression, #47 meat le, 12 i Sa 348 | ICSE CHAPTERWISE MCQs (Computer Applications) ~ X 55. 56. 37. 58. 59. 61. 11+5-541143=25 Hence, the correct answer is option (d). (4) double 5.0 Explanation: The execution goes on like this: “441/242-3450; ~4+ 0+ -6+ 50; // integer division: 1/2 truncates 3 “10+ 5.0; // higher type is double 5.0, so -10 is casted to double -5.0; // finally, double -5.0. or Explanation: In]AVA /"*isused to writecomments within the program 1 Explanation: It is printed one time only because break; will terminate the current loop (d) Compile time error Explanation: Curly braces are optional and without curly braces we can take only one statement under for loop which should not be declarative statement. Here we are declaring a variable that’s why we will get compile time error saying error: variable declaration not allowed here (© 3 Explanation: Since the first if condition is not met, control would not go inside if statement and hence only statement after the entire if block will be executed . (b) 3 Explanation: double floor(double X) returns a largest whole number less than or equal to variable X. 62. 63. (a) 14 Explanation: The & operator produces @ 1 bit when both bits are 1. The result of the & operation is 9. The “ operator produces a 1 bit when exactly one bit is 1; the result of this operation is 10. The | operator produces a 1 bit when at least one bit is 1; the result of this operation is 14 © 48 Explanation: Operator + has more preference than ‘thus g becomes 6 and when multiplied by 8 gives 48 (4) None of the above Explanation: In the above code, we have not defined the variable Y. The code will not execute without any specific value for Y; it results in exception, as shown below. Exception thread “main” Unresolved compilation problem: in javuclang Error: Y cannot be resolved fo a variable So, the values of i will not be printed, and the above exception is thrown, Hence, the correct answer is (d). (a) (hello (©) (ii) void ©) Gi) (@) @k ©) @® - (a) (ii) calculate () (i) string (©) Giyx=5 @ @y=50 (©) Wyk Here the smallest whole number less than 3.14 is _€@S@ Study 3. Output: Sjavac Output java $java Output 3 (d) 35 Explanation: x = 15, y = 20; X= (xd)? : 4; (b) () Conditional operators’ (9) (i) Two-way selection statement (4) (iv) Ternary Operator (a) (ii) 60 (b) ()k=k*i; (©) (i) Increment operator (4) (iv)all of the above (@) (iv) Compiler error (©) (iv) All the above (©) (ii) break; statement a 1 3M 10. 1. 2. 13, ue 15, 16. - Many students wi - Most of the studer Many students wrote . Many students got conf explain in detail. . For the given question: flats X Sylabus | 349 Most of the stuclents wrote the features of Java instead Of Principles of Object-oriented Programming, me students wrote operator in place of operand Many students did not write the Storage capacities of data types in bytes correctly. Some students inecte the answers in bits and the unit was written sa bytes or vice versa, Some of them wrote the incorrect memory size, Most of the students were unable to differentiate toke keyword wrote access specified/accese visibility ‘rote character or char insteay nits got confused between a: wrote the answer as eq "ns confidently. Many students, instead of \d of character literal/constant, cag nent operator and equality/telational operator and jal to assignment operator. Rave appropriate examy String P = "20", Q ="19", int a= IntegerparseIntiP); int b = Integer.valueOfQ); System.out.printin(a++b); Some students added and showed the in between 20 and 19 and wrote Some students, instead of writing the name of differ mentioned the examples of syntax errors only, Many students were unsure about the concept of Sonia teed the molhierittical operstncs as « farts Some students simply converted the temary operator For the given question: int i; for( i=5 j b=1 ji-) { gbsolute representation mathematically. Some id of multiplication symbol (*) in the expression. statement to if..lse. if(i%2 continue; System.out.print( i¢ " ") ) Some students gave the output as 4, 2, 1 instead of 4,2: Several candidates did not have a clear idea Of the number of times loop was repeated, wh ki qrt and Math.pow () 8S Math pow (ax, 5) instead of a*Math Pow(x, * expression: IF THE VALUE ©) f about post and pre-incremen alle Of V. v=a2+~ 14344 Some students were unable to develo two separate Programs instead of o, For the Evaluation thy students were unsur F X=2, Y=3 AND Z=1.VaX+ -Z+ Y44 +Y some or decrement and change of self miscalculated the y -value and so = 10; v=2+043+3 =8; v=240e444=10 P man Stiven programs using switch case, some of them wrote 2 tchnent driven program, some do not have knowledge of type conversion, and some did not accept chrome in the menu, ioe Seales il et soul a twenty-six different. py statement. Inthe switch statement stad (ch). = 350 | 1cse cHAPTERWISE MCQs (Computer Applications) ~ x 17. Many students wrote pattern without nested for loop and used five printing state ‘i Nor em Soci pit Rakenent im place ofpenin Osteen a 18. ear dents ae the definition of encapsulation, instead the definition of abstraction. Some students did not write imp evwords like hiding the backgrout sini Ged exiene a write important keywords like hiding the background details or showing the 19, Many students did not put the parenthesis in the denominator. Some students were not familiar with the syntay of sqrt function, 20. Many students seemed to be unaware of the meaning of y+=. Most students made errors while evaluating prefix and post fix operators. . 21. In many answer scripts, addition of the initial value of the variable to the evaluated value of the expression was incorrect. Some students added the decremented value to the evaluated value of the expression. 22. For the given question: Give the output of the following: (i) Math. floor (-4.7) (ii) Math.ceil(3.4) + Math.pow@2, 3) (i) Many students did not write the negative sign in the answer. Many s udents did not write the ae decimals. Some students, instead of writing the answer as -5¢0, wrote it as -4 or = 4*0 or 4¢4 (ii) Most students wrote 12 as the answer instead of 1260. 23. Most students were not clear of the use of \n. The common et Incredible “\n” world, “Incredible” + “\n” + “world” 24. For the given question = Convert the following if else if construct into switch case if( var=1) System.out printIn("good"); else if(var=2) System.out printin("better’); else if(var=3) System.out printin("best” else System.out printin(“invalid"); The common errors made by majority of the students were: a. Case 1: if (var==1) or var! b. Switch var( ); or switch was missing. ¢. Break and default statements were missing: 25. The common errors made by most of the students were: a, if(bill>10000)? bill" 10.0/100: bill"5.0/100, ; b. The assignment part of the statement was not being writen. - not being written. were unable to i rrors made by the students were: c. ‘discount 26. Most of the students the condition of the loop. / srrors made by the students Output in most cases was written inside the loo} written dentify the final limit of the loop. Some students wrote error in 7, Some common e pand the break and flag statements were not 3. "Not a pronic number” was not printed, (i+1)=num), (i*i* =num) was written. b. In the if condition, instead of (i*( © in the if statement, instead of the relational operator (==), assignment operator (-) was used. ments “Pronic SG cieceuntocy ton sic sinner) hotles Wits ORR ie: Sg the state! fot a pronic number". epee eee fe to include important keywords like ‘super class) eas eee While explaining the term ‘inheritance’. A few students jus ned examples without any explanation. Number” and also “ 28. In many case dass’ or ‘derived class’ ete ‘sharing properties’ or wrote students wer a Revision of class K Syllabus. | 351. 29, Some students confused ret 20. Majority of students wrote JL Some students were tina, Percentage symbol 22, Some students wrote the lational operator with logical operator, the size of data types in terms of bits instead of bytes, Aare about the purpose of %( modulus) operator and wrote that it is a first character of the keyword import in uppercase, 4}. Many stuulents wrote examples af primitive data type instead of releonee data type. M4 Some students were not clear about the concept of loop and use of break within the loop. a5, ascit Sestes were not known by the students. The type conversion from char to int wae foo not clear to the students, 46. Some students did not have any idea of post and pr selt -value w icrement or decrement operators, change of “18 hot very clear, as a result they miscalculated the value of 'x’ as 6 or & 37, Some students who were confused with the multiple initialization in the question and wrote improper for loop, 38. The concept of nested loop was not clear to many students. In some cas given instead of vertical, s, horizontal output was 39. Some students got confused with the Scanner class functions read () and read Line () with print (, printin () and gave vague answers 40. For the given question: Waite a program to accept a number and check and display whether it is a spy number or not. (A number is spy if the sum of its digits equals the product of its digits) Example: consider the number 1124, Sum of the digits = 141424428 Product of the digits = 1<1*2«4=8 Common errors observed in most of the students were: a. Used the value given as example in the question instead of accepting the value from the user b. Variable used to store sum and product were not initialized or both were initialized to 0. & Assignment operator (=) was used to compare two integer values instead of comparison operator(—), 4, Confusion in use of division and modulus operator. 41, For the given question Using switch statement write a menu driven program for the following: (i) To find and display the sum of the series given below: Sext-e-xte ed, 0 (where x= 2) (ii) To display the following series: vag anan aa : For an incorrect option, an appropriate error message should be displayed. ‘A number of students misunderstood the question and wrote two separate programs. Some of the commonly made mistakes were: . (i) Value of variable “x” was accepted instead of assigning. ii) Printed the second series directly using print () statement o ases, break statement was missing and the first letter of default statement was in capital In some cases, letter. aa y Chapter at a Glance Object oriented peo partitioned memory ares for both such modules on demand. > What is Class Aas represents a set of comm (Classes as Abstractions for Sets of Objects () Adassis a named sofware betanicers shared by al chests anes oF that class, (iit) Software code in CO! ebhects and marépelan oh > Class as Object Factory An object factory is 2 pe SDE. crmadon about how mo cvaie an cdeet sachas Class is an object mater or object famacy as it attributes as weil 2s the statemer: utilizing this and ache & class as and when required Object An objectis a software bun The object can have state and behavice which Sew It consists of 2 parts (Data structure, . A v Example: A person object ho (@) Firstname (ii) Lastname (ii) Age (iv) Weight. Messages : Software objects interact 2nd co Characteristics of Objects 7 . oehe: The real world objects sh (i) State: An object can (i) Behavior: The capability of an ob) (ii) Ident > OOPS Principles There are four OOP's principles which a: (i) Encapsulatio: (ii) Inheritance : This is the process of creating new called super classes, ancdject helps Fe as follows: Ses tages NS Genwed Gases Rom CRIRY clase: —- 7 as Class as a Basis of All Computation | 353 Polymorphism : The ability ity to take can perform different-different on classes to respond to. the sam Gv) Abstraction : The conce implementation detail, ig » Variable : @_ Avariable is a memory (i) The declaration of a vx > Constants Aconstant is a — int is a fixed value w hich can not be change during the execution of Program, * Constants are of the following type: more than one form is called polymorphism for example a method ‘nt operations with different type or no. of arguments. It allows two or more ne method in different ways, Pt of giving only required information without showing internal ati out showing, internal and called abstraction. : location to store any data or constant. riable generally takes the following form type variablename; Integer constant: 12, 2000, - 10ete. Real constant + 0.00012, - 2.8707, 29.287, - 0.28 Character constants : ‘A’, +" String constants: “RAM”, “A/49, Kamla Nagar, Agra “12.28” boolean constant —: true, false. > Concept of Data Type Java like any other language provides ways and facilitates to handle different types of data by providing data types. 7 Data types are means to identify the type of data and associated operators of handling it. > Java data types are of two types : (i) Primitive data type. (ii) Derived data type. > Primitive Data Type Primitive data types are also called basic data types. These are inbuilt data types available in Java. These data types are used to define other derived data + Java support the following four types of primi : (i) Numeric Integral Types : The data types that are used to store numeric values falls under this sub- category. Type | ___ Size Minimum Value Maximum Value te | One byte —128 127 short_| Two bytes —32,768 32,767 int _|Fourbytes | —2,147,483,648 2,147,483,647 [long [Eight bytes | —9,223,372,036,854,775,808 9,223,372,036,854,775807 (i) Fractional Numeric Type : These data types can store fractional numbers i.e, numbers having decimal points. ; Type Size ‘Minimum Value Maximum Value float | 4 bytes 34e—038 3.4e + 038 double [S bytes 1.7e—308 1.7e + 308 Tip Character Type: It is used to store characters. _ Type | Size Minimum Value Maximum Value char | 16 bits (2 bytes) Single character 0 to 65.536 (iv) Boolean Type * It is used to represent a single True/False value. : : Type Size Minimum Value ‘Maximum Value Sian ___LB bits (used only 1 bit) | Logical or boolean values | True oF False i yes. These are defined n boolese Gata types : These data types also called compound or user defined data typ Derived 47, primitive data type. or derive jays and Interfaces are examples of derived data type. Classes: Arty sama ys 354 | [cSe CHAPTERWISE MCQs (Computer Applications) ~ x > Class as. a Composite Type The data types that are based on fundamental oF primitive data types are known as composite data types, since these data types are created by users these are also known as user-defined data types. : > Java provides the following operators : Arithmetic operators : These operators perform arithmetical operations. Relational operator : These operators are used to compare the values. (ii) Logical operators: They perform logical operations, jv) Assignment operators : They assign one value to another. Shut operators: They performs bit manipulation on data by shifting the bits of its first cperald right or eft. <5 > (xi) Bitwise operators: These operators work with integral types ie. byte, short int and log type (&,!, 7, (vii) Conditional or ternary operators : It stores value depending open conditions. condition ? Value 1: Value 2: > Other operators (P:, [ ].-, (Parameters), (type), new, instance of). (Arithmetic Operators @ w [ Operators Description Example + ‘Addition a+b - Subtraction a-b | x Multipication axb | i Division a/b { % Modulus a%b (i) Relational Operators: Operators Description = check for equality - not equal to < less than > greater than < Tess than or equal to >= greater than or equal to a> ii) Logical Operator: [ Operators Description Example && ‘And opr 1 && opr2 i Or opr 1 || opr2 ! Not Lopr1 (iv) Assignment Operators : Operators Description Example = equal to a=7 + add to the variable a+=5meansa=a+5 . subtract from variable |@-=5 means a= a~5 x multiply to variable ax=2means a= a2 / divide into variable a [= 2means a~a/2 % Modulus by variable 2% =2 means a=a%5 > Operation on Primitive Data types Primitive data type operations deal only wit read value directly in them. Expressions ‘Anexpression in Java i of Java tokens. ‘The expressions in Java can be of any type: (i) Arithmetic expression. (Gi) Relational expression. (iii) Compound expressions, etc. th value i.e., actual read value (rvalue). That is, they store the v any valid combination of operators, constants and variables. a legal combination . Gpthmetic expressions can be of the following tyP ') Pure integer expressions, and (i) Pure real expressions. . Mixed expression. > In pure expressions, all the operands type ie, mixture of real and integer expressions. Multiple Choice Questions 1. The keyword to create a class is oe (b) CLASS © de (a) None 2, Which of the following is not a feature of OOPS (a) Inheritance (b) Function Overloading (0) Polymorphism (d) All are OOPS Features 3. Encapsulation means (a) Binding of all functions together (b) Adding a function to a class (¢)_ Deleting a method from a class (d) None of the above 4. A class is an object factory (a) True (b) False 5. Anon static method is also called: (a) class method (b) Instance method (o) Constant method (d) Instance variable ‘One thing in many different forms “ the OOPS concept (a) Polymorphism (b) Inheritance (€) Encapsulation (d)_ Abstraction Data hiding is implemented by (a) Access specifiers (b) Static variables (©) Inheritance (a) None 8, A static method is also called a: (a) Instance function (b) Defined function (c) Class method (d) Fixed function 9, The concept of Abstraction is (a) Binding data and functions together (p) Hiding inner complexity and providing usable interfaces using of the code aking methods constant goes with (c) Ret (d) M 9, Java supports {@) Single Inheritance (b) Multilevel Inheritance {ey Multiple bisitance fay both ea cass : 1 Or fotected member of cassis accessible in ay class only see, (a) es: are of same type and in mixed expressions the o| 35s ‘class as a Basls of All Computation | yperands are of mixed (b) class and package (©) class, subclass and package (d) None 12. The default access specifier for a method of a is (a) Private (b) Public (©) Protected (d) Package 43, Akash wants the members of his class “Employee” tobe accessible only to his class “Employee”, what access specifier he should use for the members (a) Private (b) Public (©) Protected (a) default 14. A bundle of similar classes is called a (a) Package (b) Group (©) Packed classes (d) None 15. Code reuse is implemented by : (a) Abstraction (b) Function overloading, (©) Inheritance (d) Polymorphism 46. Which of the following are not keywords? (a) NULL (b) Implements (c) Protected (d) None of the above 17. Which of the following statements are true? (a) An abstract class may not have any final methods? (b) A final class may not have any methods. (©) Transient variables must be static. (d) Alllof the above 18, Which of the following met String class? (a) Iength() (b) compareTo() (©) substring() (d) all of the them 19, What do you mean by nameless objects? (a) An object created by using the new keyword. (b) An object of a superclass created in the subclass. (c) An object without having a reference. (d) An object that has no reference 20, Which of the following are primitive data (i) double (ii) String (iii) Char (iv) Integer (a) (i) and (iii) (b) (ii) and (iii) (© Only (iii) (a) @ and (iv) class abstracts thods belong to the aving any name but ype? 356 | ICSE CHAPTERWISE MCQs (Computer Applications) — x 21. Data type whose size is fived are called data type (a) primitive (b) non-primitive (©) explict (a) fred {b) class. (©) data (@) function From Question 23-27 find the odd one out: 33. (a) Encapsulation (b)_Abstraction (©) DataHiding —(d) int 2A. (a) Inheritance (©) Reusability (©) Base class and Sub class (@) private 25. (a) private () ors (6) default (d) public 26. (a) Data mebers (>) Characteristics (©) Properties (a) Functions 27. (a) Polymorphism (©) One thing in many forms © (d) Function overloading 28. A private member of a class can be accessed only inside the class Abstraction (a) True (b) False 29. The default access specifier for a class member is public (a) True (b) False 30. The OOPS concept that indicates data hiding is Polymorphism (a) True (&) False 31. Default access specifier means package access specifier (a) True (b) False 32. Class methods are called using class name (a) True (b) False 33. The operator creates a new object and allocates memory for it (a) create (b) add {c) allocate (d) new 34. The operator that deallocates the memory occupied by an object and deletes the object is (a) remove (©) delete (>) deallocate (a) None 35. A static data member of a class is initialized in {a) Inside the class (b) Inside a static method (©) _Tust after class definition, (a) Inside main() method 36. To create an instance method the keyword used is by Static © Non static (a) Nokeyword requing Static methods are called using (a) Object (b) Class name (©) Anyone WN 38. Seema wantsa data member of her class “Product” to be available in all child classes, the access specifier she should use is @) private (b) protected (©) extends (@) inherits Which statement is true about a class definition (a) Te must have at least one method ()) Itmust have at least one data member (6) may not have any members 40. Which statement is True : Bs, (a) An instance method can access only instance variables (b) An instance method can access only’ static variables (c) Aninstance method can access both static and mon static data members (a) None of the above 41, The Keyword that represents the current object is (@) now &) this (©) current (a) None 42. The attributes or properties of a class ane represented by: (a) Member functions (b) Data members (©) Access specifiers (d) Allof them 43, Class variable that is available to the entire class is known as {a) local variable (b) class variable (©) instance variable (@)_ scope variable 44. The region within which a variable/pieceofowde is accessible called (2) area ot variable (b) ploe of variable (6) instance of variable (a) scope of vanable 5. Aeywond is used to provide aos to classes storad inside a package in our PINgTAB (a) Import () this (9) export (2) public Sa ata enon | 257 ' ef ar coe: pendast Spiny { st : nash by Bike gent xD eo Esplav), » oe @ mrectfeaere gs Wear s exer in Se following: 3) Sass headers net detine property (3) comstucter is ne defined Sod is net detoed property | Rat should be the execution ender if a dass a od stite Block instinee Beck and eowe. as shown below? void oy Metodg System.cet printin( Method”; @ Trstnce Neck methad gatic Rock ant constructor Method constructor, instance Mok ant Static Block, State Beck method instinge Heck and . constructor 1 (2) Static Block instance Book constructor. ant method Ssplay fy function using anobjact ch 39. Se statement is . Whatwill bs the output of the following pengeamt? Public class MyFisst{ FUNKE static vold main(Seringl] args { ©) chdisptany, } MyFirst obj = new MyFinstins atl 358 | ICSE CHAPTERWISE MCQs (Computer Applications) ~ x static int a= 10; eh a erie appropriate options: rrees class student int ¢; _ public MyFirst(int m) { one Systemoutprintinga+","+b+,"+cer vane — PRVMeSWIngsnames * em); . Gt) private float eng, math, science, total; ) private float (a)__() IH Instance Block { { float t= eng + math + science; b=30; return t; n=20; I ) public void (b) 0 II Static Block { static System.out printin(admno); 1 System.out.printIn(sname); a= 60; System out printin(eng); 1 System.out.printin(math); ) System.out.println(science); (a) 10,5, 0, 20,0 (b) 10, 30, 20 System.out.printIn(total); (€) 60,5, 0, 20 (d) 60, 30, 0, 20,0 } 60. What will be the output of the following program? —_public void takedata(int a String n, inte, int m, ints) public class Test { { public static void main(String[] args) { admno =a; int count = 1; aaa a | while (count <= 15) { 7 | System.out.printin(count %2—=12"""" : | % science +count; een t } Jlend while a } end main } } | (@) 15 4times *** public class stud (0) 15 times +++ { (©) 8 times *** and 7 times +++ re static void main(String [] args) (4) Both will print only once 61. What will be the output of the following program? student(c)____ = newsstudent(): public class Test2 { std! .takedata(101, “RAM”, 30, 48, 40); public static void main(String[] args) ( std] showdata(); | StringBuffer s1 = new StringBuffer("Complete”); ) sl.setCharAt(1/''); ) sl.setCharAt(7/4’); (@) (i) getdata (ii) showdata System.out-printin(s1); i) gettotal \ } (>) (i) getdata (ii) showdata | (a) Complete (&) lomplede © ose i (©) Cimpletd (d) Coipleta Gi) std 62. A class student is defined with following member function: gettotal() & takedata() and showdata() to get the sum of marks obtained from takadata and shown with showdata function. Fill in the blanks in the JAVA code provided with (ii) student 63. The following program is based on O specification given below. Fill in the blanks appropriate java statements | AclassElectricBill with thefollowingspesfiea™™™ | is defined: 360 | ICSE CHAPTERWISE Mas (Computer Applications) =X (o) The binding of data and functions together is, called : (Inheritance (ii) Abstraction (ii) Encapsulation (A) Characteristics of a (i) Attributes are also called : Gi) Data members {iit) Both (and Gi) (o). The detault access specitier of members of a class is (Privat Gi. Public Git) D Answers Multiple Choice Questions ‘5 2 3. 4 5. 6 10. m1. 12. 13. 14. 15. 16. 17. 18. 19. 20. 2 22, 23. 24. 25. (©) class (a) Allare OOPS Features (d) None of the above (a) True (©) Instance method (@) Polymorphism (a) Access specifiers (©) Class method (©) Hiding inner complexity and usable interfaces (4) Both (a) and (b) (©) class, subclass and package (d) Package (@) Private (a) Package (©) Inheritance (a) NULL (b) A final class may not have any abstract methods. (4) all of them (d) An object that has no reference (a) (and (iii) (a) primitive (b) class (4) int Explanation : All others are OOPS concepts (d) private Explanation : All others are related to inheritance (b) Oops Explanation : All others are access specifiers providing 26. (d) Functions 27. 28. 29. 30. Explanation : All others are data of a class. () Abstraction Explanation: All others are related to Polymor- phism (a) True (b) False (b) False 31. (a) True 32. (a) True 33. (a) new 34. (€) delete 35. (¢)_ Just after class definition 36, (dl) No keyword required 7. (b) Class name 38, (b) protected 39. (c) It may not have any members 40. (c) Aninstance method ean access both static and non static data members AL. (b) this 42. (b) Data members 43. (6) instance variable 44. (A) Scope of a variable. 45. (a) import 46. (b) blue print Programming Based Question 47. (b) obj=new Student(’ 48. (o) As many 49, (b) Virtual 50. (c) Both (a) and (b) 51. (a) public 52. (a) delete obj; 53. (c)_ User defined derived data type 54. (d) Both (a) and (b) 55. (b) { } 56. (b) ob.display(); 57. (©)_ method is not detined properly Explanation: Following are some rules for declaring an abstract method. Abstract methods do not specify a method body but they only have a method signature. Abstract methods are always defined inside a0 abstract class, In the above code, MyPirstClass is an abstr! class, It contains an abstract method named st that is not defined properly, According 0 th rules discussed above, an abstract method on A

You might also like