Page 1 :
Computer Application, MCQ based questions, 1. The package that contains Scanner class, a) java.awt, b) java.io, c) java.util, d) java.lang, 2. Considering Scanner class object OBJ, which of the following may be used to input a character?, a) OBJ.nextInt( ).charAt(0), b) OBJ.next( ), c) OBJ.nextLine( ).charAt(0), d) OBJ.next(0), 3. Which of the following is an incorrect way to write comments?, a) /*, **/, b) /*, */, c) //, d) /*, 4. Which package is imported by default in a java program?, a) java.io, b) java.util, c) java.lang, d) None of these, 5. Evaluate: Math.sqrt ( -169 ), a) 13, b) -13.0, c) -13, d) NaN, 6. Evaluate: Math.cbrt ( -343 ), a) -7, b) 7, c) -9, d) NaN, 7. Evaluate: Math.round ( 6.5 ) + Math.pow(2,5), a) 39, b) 39.0, c) 7, d) 7.0, 8. Evaluate: Math.round ( -9.5 ), a) -9, b) -9.0, c) -10, d) -10.0, 9. Evaluate: Math.ceil ( 9.2 ) * Math.cbrt ( 125 ), a) 50, b) 50.0, c) 10, d) 10.0
Page 2 :
10. Evaluate: Math.ceil ( -11.5 ), a) -11, b) -11.0, c) -12, d) -12.0, 11. Evaluate: Math.floor ( -20.3 ), a) -20, b) -21.0, c) -21, d) -20.0, 12. Evaluate: Math.floor ( 100.7 ) + Math.sqrt(144), a) 112.0, b) 100.0, c) 112, d) 113.0, 13. Evaluate: Math.pow ( Math.ceil ( -11.6 ) , 2 ), a) -144, b) 144.0, c) -121.0, d) 121.0, 14. Evaluate: Math.pow ( Math.floor ( 1.6 ) , 4 ) + 10, a) 10, b) 11, c) 10.0, d) 11.0, 15. Fill in the blank: Scanner ob =, Scanner ( System.in) ;, a) this, b) new, c) void, d) None of these, 16. Data type short reserves, bits in R.A.M., a) 2, b) 8, c) 16, d) 32, 17. The two categories of data types supported by Java are Primitive and, ., a) ancient, b) new, c) combined, d) reference, 18. Escape sequences are characters preceded by which of the following symbols?, a) /, b) \, c) //, d) /*, 19. What is the memory location which stores some value called?, a) Variable, b) Identifier, c) Keyword, d) Tokens
Page 3 :
20. What will be the return data type of the following expression?, float * short – long + double, a) float, b) Float, c) Double, d) double, 21. Name the class used for formatted input., a) Scanner, b) Math, c) String, d) None of these, 22. Name the class which is used to add/include classes from another package., a) new, b) this, c) import, d) void, 23. Name the error that cause program to operate incorrectly but does not terminate it abnormally., a) Syntax error, b) Semantic error, c) Compile time error, d) Exception, 24. Name the API package that contains wrapper classes., a) java.util, b) java.lang, c) java.io, d) java.awt, 25. Conditional operator consist of which of the following symbols?, a) ; :, b) ? /, c) ? :, d) \ ?, 26. What is a modifier in the given function prototype?, public static void main ( String ar [ ] ), a) public, b) static, c) void, d) main, 27. State true/false: Math.random ( ) method generates a random value ranging from 0 to 1 ( including, the limits ), a) true, b) false, 28. Name the keyword due to which a variable becomes a literal., a) new, b) this, c) final, d) void, 29. A set of instructions enclosed within a pair of curly braces is called, ., a) code, b) block, c) nesting, d) condition
Page 4 :
30. What is ‘dangling else’ situation in java?, a) ‘else’ hangs out of the code, b) Not clear which ‘else’ is linked to which ‘if’ condition, c) Unequal number of ‘if’ and ‘else’, d) None of these, 31. State the value of the variable cm when ms = 2500, cm = ms <=2200 ? ms * 0.1 : ms * 0.2, a) 250, b) 500, c) 750, d) 1000, 32. Identify the type of loop:, for ( int h = 1 ; h > 0 ; h + + ), a) infinite, b) finite, 33. What value will be returned from the following function when y = 50 ?, double func ( int y ), {, int x = 2 ;, while ( x <= 10 ), {, ++x;, y-=x++;, }, return y ;, }, a) 26, b) 26.0, c) 15, d) 15.0, 34. State the final value of the variable ‘x’ :, int x;, for ( x = 10 ; ;x -- ), {, if ( x%5 == 0 ), break ;, else, x/=4;, }, System.out.print(x);, a), 10, b), 8, c), 6, d), 4, 35. State the output:, char ch = 'y' ;, for ( ; ch = = 'y' ; ), {, ch = 'n' ; System.out.print ( ch + "\t" ) ;, }, a) y y y y, b) n n n n, c) y, d) n
Page 5 :
36. Java is an, programming language., a) Procedure – oriented, b) Structure – oriented, c) Object – oriented, d) Executable – oriented, 37., independence is a program’s capabilities of being moved easily from one computer system, to another., a) Table, b) Program, c) Library, d) Platform, 38. Full form of JDK is, a) Java Development Kit, b) Java Developing Kit, c) Both a) and b), d) None of these, 39. The act of representing the essential features of an object without knowing its background details is, known as, a) Abstraction, b) Encapsulation, c) Inheritance, d) Polymorphism, 40. In OOPs, stress is laid on, rather than, a) Functions, data, b) Data, functions, c) Data, data type, d) None of these, 41. The full form of JVM is, a) Java Virtual Machine, b) Java Visible Machine, c) Java Valid Machine, d) None of these, 42. The machine language for the Java Virtual Machine is called, a) byte, b) byte numbers, c) byte code, d) bytes, 43. Object is an entity, which possesses, and, a) Characteristics , behavior, b) Characteristics, numbers, c) Numbers, text, d) None of these, 44. A Java Program should have at least one, and it must have main, in it., a) Class, procedure, b) Class, variable, c) Class, method, d) Class, code, 45. A set of statements enclosed within a pair of curly braces is called, a) Block, b) Group, c) Collection
Page 6 :
d) Combined statements, 46. A Java program is composed of, a) Functions, b) Classes, c) Variables, d) All of above, 47. In Java, the, name is case – sensitive., a) Folder, b) Class, c) First, d) Last, 48. To compile the Java program (without using BlueJ), type, followed by the name of the, source file., a) javac, b) Java, c) JavaC, d) cjava, 49. Encapsulation promotes, and, facilities in OOPs., a) Data hiding, data abstraction, b) Data , number, c) Text number, d) Inheritance, polymorphism, 50. Which of the following variable declaration is correct?, a) Double rate, b) double rate, c) doublerate, d) double = rate, 51. The texts after, _ are called single line comment., a) //, b) \\, c) // //, d) \\ \\, 52., is a translator which translates the complete program at once., a) Compiler, b) Translator, c) Interpreter, d) None of these, 53. Variables are declared using, followed by variable name., a) Data type, b) Int, c) Float, d) Double, 54. System.out.print and System.out.println are, which prints the argument(s) on the terminal, window., a) Methods, b) Classes, c) Outputs, d) Prints, 55. Polymorphism can be produced through, a) Encapsulation, b) Inheritance
Page 7 :
c) Function overloading, d) Abstraction, 56. When the program is run, the Java interpreter calls the, method and the statements that it, contains are executed., a) main( ), b) String, c) Main( ), d) String [ ], 57. The, method can call other methods that are defined in the same class., a) main( ), b) String, c) Main( ), d) String [ ], 58. The rules that determine what is allowed to be used in a language are called the, of the, language., a) Protocol, b) Syntax, c) Methodology, d) Regulation, 59., are the words, which are reserved for the system and cannot be used as variable names., a) Combined words, b) Special words, c) Keywords, d) None of these, 60. A syntactically correct program is one that can be successfully, or interpreted., a) Compiled, b) Executed, c) Combined, d) Understood, 61. Choose the correct feature(s) of Java:, a) Platform Independent, b) WORA, c) Secure Environment, d) All of the above, 62. Java is an object – oriented programming language. Everything is defined as part of, a) program, b) procedure, c) class, d) list, 63. A method in Java program cannot exist by itself. It has to be a part of a, a) program, b) procedure, c) class, d) list, 64. In Java, floating point literal by default is of the type, a) long, b) double, c) int, d) float
Page 8 :
65., , operator uses two operands., , a) Unary, b) Binary, c) Ternary, d) None of these, 66. In Java, integer literal by default is of the type, a) long, b) double, c) int, d) float, 67. Java compiler converts Java source code to, a) byte code, b) bytes, c) byte, d) none of these, 68. The act of assigning information contained in one object to another object of the same class is known, as, a) Abstraction, b) Objects, c) Classes, d) Message passing between objects, 69., is a principle of OOP, which allows a function to be used for more than one purpose., a) Inheritance, b) Polymorphism, c) Abstraction, d) Encapsulation, 70. Java programming can be done in the following ways:, a) Java Application, b) Java Applets, c) Both, d) None of these, 71., operator uses three operands., a) Unary, b) Binary, c) Ternary, d) None of these, 72., is a collection of classes., a) Class, b) Function, c) Package, d) Literal, 73. The, keyword converts the variable into constant whose value cannot be changed in the, program., a) literal, b) variable, c) constant, d) final, 74. A property according to which a class acquires some features from another class is known as, _, a) Encapsulation, b) Inheritance, c) Abstraction
Page 9 :
d) Polymorphism, 75. Type of data used for the storage in the computer’s memory is known as, a) Explicit, b) implicit, c) Data type, d) Composed, 76. There are, primitive data types., a) 4, b) 6, c) 8, d) 12, 77., is a non – graphical character to print horizontal tab., a) ‘\t’, b) ‘\n’, c) ‘\0n’, d) ‘\xHn’, 78., if is a statement which includes an ‘if’ statement within another ‘if’ statement., a) Multiple, b) Nested, c) Simple, d) None of these, 79., operator uses one operand., a) Unary, b) Binary, c) Ternary, d) None of these, 80. Wrapping up data and function as a unit is known as, a) Encapsulation, b) Inheritance, c) Abstraction, d) Polymorphism, 81. boolean is a special data type which consists, a) true, b) false, c) Both, d) None of these, 82., is dry run of the program, whereas, is eliminating errors from the program., a) Executing, running, b) Running, executing, c) Debugging, removing, d) Testing, debugging, 83. An, is a token used to perform different operations and produce result., a) Operand, b) Operator, c) Data type, d) Statement, 84. The class is also known as, because it implements the concept of abstraction., a) Inheritance Data Type, b) Abstract Data Type, c) Both, d) None of these
Page 10 :
85., a), b), c), d), , is used to print the data in different lines., System.out.println( ), System.out.print( ), System.Out.Println( ), System.Out.Print( ), **********