15 46 10 12 03 2024 MCQS
15 46 10 12 03 2024 MCQS
24) Given: String st = (a>= 90)? "Excellent": "Best"; Predict the output, when a = 90.
(a) Best (b) Excellent: Best (c) Best: Excellent (d) Excellent
25) Which of the following makes a function non-returnable?
(a) public (b) static (c) void (d) new
26) The while statement repeats the execution of a block only when the given condition is:
a) False (b) True (c) 1 (d) 0
28) If a=1, b=2; System.out.println(--b - ++a + ++b - --a);
(a) 0 (b)3 (c) 5 (d) 7
29) For which purpose a constructor is used?
b) To initialize the instance variables b) To provide the instance variables
c) To organize the instance variables d)To simplify the instance variables.
30)_______ statement will repeat a loop for the next iteration after ignoring some statements
of loop.
(a) Break (b) Continue (c) Labelled break (d) None
31)Parameters used in method call statement are known as:
(a) defined parameter (b) passed parameter (c) actual parameter (d) formal
parameter
32)The method which changes the state of an object is known as:
(a) pure method (b) impure method (c) replace method (d) none of the above
34) Find the odd one out:
(a) Method overloading(b) Polymorphism (c) Abstraction (d) Multiple forms of same
35) A method is invoked through an:
(a) object (b) system (c) parameter (d) none
36) A package is a_________
(a) Collection of data (b) collection of functions (c) collection of classes
(d) a nested class
38) Which of the following is the correct usage?
b) int a[-40] (b) int a[40] (c) float a[0 - 40] (d) None
39) Which of the following function finds the size of array
char m[] = {'I', 'N', 'D', 'I', 'A', 'N' };?
b) m.sizeof (a) (b) m.elementsof (m) (c) m.length (d) None
40) Which of the following functions is used to remove leading and trailing white spaces
from the string?
b) trim( ) (b)trail( ) (c) truncate( ) (d)slice( )
41) A method with the same name as of the class and with arguments and no return data
type is termed as
(a)parameterized constructor (b)Default constructor
(c )non-parameterized constructor (d) wrapper class method
(42)the method to check if a character is an alphabet or not is:
(a) isLetter(char) ( b)isAlpha(char)
(c) is Uppercase(char) (d)is Lowercase(char)
(43)The scanner class is a _____________class
(a) primitive (b) Derived (c) Wrapper (d) superclass
(44)The output of Double.parseDouble(“71.25”) + 0.75 is :
(a) 72.0 (b) 72 (c) 71.0 (d) 71.75
(45)The output of the method “MATHEMATICS”.substring(5,9) is___
(a) EMATI (b) MATIC (c) MATI (d) EMATIC
(46)When a primitive data type is converted to the corresponding Object of its class, it is
termed as______
(a) Boxing (b) Explicit type conversion
(c) UnBoxing (d) Implicit type conversion
47)The return type of the library function CompareTo( ) is __________
(a) boolean (b) int (c) char (d) string
(48)Data members declared as __________are accessible within the same package (or)
subclasses in different packages.
(a) public (b) private (c) protected (d) default
(49)If a = 22 result of a/ = (a++) ─ (++a) + a;
(a) 2 (b) 0 (c) 1 (d) 11
(50) pick the odd one out
(a) Inheritance (b)Polymorphism
(c)Overloading (d)Overriding
(51)A variable that is bounded to the object itself is called
(a)Instance Variable (b)Class Variable
(c) Local Variable (d) Argument Variable
(52) The value of a[3] ─ 1 of the array elements {2,4, 5, 6,7,8};
(a) 2 (b) 3 (c) 5 (d) 6
(53) Java Programming language is __________
(a) Robust and easy to learn (b) simple and secure
(c) Object Oriented (d) All of the above
(54) The output of Math.sqrt (Math.min (64,42.25)) is_________
(a) 8.0 (b) 6.25 (c) 6.5 (d) 6.05
(55) A class is ____________
(a) Not a primitive data type (b) A specification for objects
(c)A blue print to create objects(object factory) (d) All of these
(56)valueOf( ) function converts
(a) Primitive type to String (b) String to primitive type
(c) character to String (d) None
(57)_______ statement will repeat a loop for the next iteration after ignoring some statements
of loop.
(a) Break (b) Continue (c) Labelled break (d) None
58) A method with many definitions is called:
(a) multiple method ( b) method overloading
(c) floating method (d) none of these
59)Parameters used in method call statement are known as:
(a) defined parameter (b) passed parameter
(c) actual parameter (d) formal parameter
60)The method which changes the state of an object is known as:
(a) pure method (b) impure method
(c) replace method (d) none of these
61)The maximum number of objects of a class can be created as:
a) 1 b) 2
c) On the user's choice d) Number of variables
62)A class contains:
a) Attributes and methods b) A number of object of same types
c) Data and member function d) All of the above
63)___________ members are accessible from anywhere in the program.
a) Public b) Private
c) Protected d) All of the above
64)Which of the following is not a keyword?
(a) void (b) byte (c) object d)public
65)A variable whose value is not associated to an object and its value exists throughout the
life of the program is ____________
(a) local variable (b) static variable
(c) final variable (d) None of these
66)The method which changes the state of an object is known as:
a) pure method b) impure method
c) replace method d)none of the above
67)Parameters used in the method definition are called:
a) forward parameter b) actual parameter
c) formal parameter d) none of the above
68)The process of calling a method in such a way that the change in the formal arguments
reflects on the actual parameter is known as:
a) pass by reference b) pass by value
c) pass by method d) none
70)Which of the following type can be used for a non-returnable method?
a). int b). float c). double d)void
71)A method is invoked through an:
a) object b) system c) parameter d) none
72) A constructor is always:
a) private b) protected c) secure d) public
73) A constructor is used when an _______ is created
a) object b) class c) method d) none
74) For which purpose a constructor is used?
a) To initialize the instance variables b) To provide object
c) To organise the class d)To calculate problem.
75) Given Double a = -8.35; Double p = Math.abs(Math.floor(a));
What will be the final value stored in the variable p?
a) 9.0 b)8.0 c)7.0 d) 8.5
76) Given double b = Math.ceil(3.4) + Math.pow(2,3);
What will be the final value stored in the variable b?
a) 12.0 b)11.0 c)11.4 d)11.5
77) The keyword _________ is used to include a package in a program.
a) Void b) Import c) Public d) new
78) Given: x += x++ + ++x + --x
Find the value, when x=5.
a) 23 b) 21 c) 22 d) 24
79) Assigning a value of 24.3 to a variable that is defined as int type is __________ error.
a) Syntax b) Logical c) Runtime d) Executional
80) Which of the following keywords can be used to terminate a switch case as well as a loop
construct?
a) continue (b) void c) break d) stop
(81) ________________ means that the same function may behave differently on different
classes. (a) Inheritance (b) Encapsulation
(c)Abstraction (d) Polymorphism
(82) The process of wrapping the data and instructions together into a single object is
called_____________(a) Encapsulation (b) Data Abstraction
(c) Polymorphism (d) Inheritance
(83)A package is a collection of ______________________________
(a) Data members (b)Functions (c) Classes (d) Small elements
(84) A function body is enclosed within a pair of ________
(a) [ ] (b) ( ) (c) { } (d) “ “
85)Condition is essentially formed by using _______ operators
(a) Arithmetic (b) Relational (c) Logical (d) All
(86)BlueJ is window-based platform is suitable for________
(a) Experts (b) Professionals (c) Beginners (d) Teachers
(87) __________________are the Java programs that are executed in a web browser or using
internet.
(a) Application (b) Applet (c) Object (d) Webpages
(88) The errors occur due to the grammatical errors in programming language
(a) Logical error (b) Syntax error
(c) Runtime error (d) None
(89) The output of Math.sqrt (Math.max (64,42.25)) is_________
(a) 8.0 (b) 6.25 (c) 6.5 (d) 6.05
(90)__________package includes the “math class” and it is implemented (or) imported by
default by the java compiler
(a) java. lang (b) java.util
(c) java.io (d) java.awt
(91) In a switch case, when the switch value does not respond to any case then the execution
transfers to:
(a)a break statement (b)a default case (c) a loop (d)None
(92) Arrange the operators given below in order of higher to lower precedence_
(a) ++ , % , && , >=
(b) ++ , && , >= , %
(c) ++, % , >=, &&
(d) % , >= , ++ , &&
(93) Which one of the following is not a binary operator?
(a) AND (b) = = (c) % (d) !
(96) What type of value is returned by Math.sqrt( ) ?
(a)Int (b) Short (c) float (d) double
(97)Give the output of the Math.ceil(65.6) ;
(a) 65 (b) 66 (c) 67 (d) 64
(98)Give the output of Math.abs(-4) + Math.max(-77.6, -87.4);
(a) -77.6 (b) -81.6 (c) -73.6 (d) -91.4
(99)The ASCII codes of uppercase alphabets range from
(a) 65 - 90 (b) 60 - 85 (c) 65 - 91 (d) 97 – 122
(100) The following which statement results in False
(a) 3 >1 || 0 < 4 (b) 3 == 4 & & 5==5
(c) ! (6 < 3) (d)5 + 3 > 7 && 7 >= 4+3