(i) Which of the following is used to create a Symbolic constant in Java?
a) ✅ final
b) Final
c) Constant
d) Const
(ii) Identify the type of Operator &&
a) Ternery
b) Unary
c) ✅ Logical
d) Relational
(iii) Assertion(A): In Java, statements written in lower case letter or uppercase letter are treated as same.
Reason(R): Java is case sensitive language.
a) Both A and R are true and R is correct explanation
b) Both A and R are true and R is not a correct explanation
c) Assertion(A) is true and Reason(R) is false
d) ✅ Assertion(A) is false and Reason(R) is true
(iv) The number of bytes occupied by a character array of 10 elements is
a) ✅ 20 bytes
b) 60 bytes
c) 40 bytes
d) 120 bytes
(v) The method of Scanner class used to accept an integer value is:
a) ✅ nextInt()
b) nextDouble()
c) next()
d) newDouble()
(vi) int res = 'B';
What is the value of res?
a) ✅ 66
b) 68
c) 65
d) 72
(vii) The output of Math.ceil(Math.abs(-8.6)) is
a) ✅ 9.0
b) 13.0
c) 37.0
d) 13
(viii) To execute a loop 15 times, which of the following is correct
a) ✅ for(int i = 10; i <= 38; i += 2)
b) for(int i = 10; i <= 38; i += 3)
c) for(int i = 15; i <= 38; i += 2)
d) for(int i = 10; i <= 38; i += 4)
(ix) A single dimensional array has 20 elements. Which of the following is the correct statement to initialize the last element to 250?
a) x[23] = 250
b) x[24] = 250
c) ✅ x[19] = 250
d) x[50] = 250
(x) The method to convert a lowercase character to uppercase is:
a) String.toUpperCase()
b) Character.isUppercase(char)
c) ✅ Character.toUpperCase(char)
d) toUpperCase()
(xi) Output of the following String methods:"SUCCESS".indexOf('S') + "SUCCESS".lastIndexOf('S')
a) 0
b) 5
c) ✅ 6
d) -5
(xii) Output of the following code:System.out.println("Good".concat("Day"));
a) ✅ GoodDay
b) Good Day
c) Goodday
d) goodDay
(xiii) What does the following picture indicates:
2 | 6 | 8 | 9 | 16 |
b) A single dimensional Array with last index 4
c) ✅Both a) and b)
d) None of the above
(xiv) The correct statement to create an object named mango of class fruit is:
a) Fruit Mango = new fruit();
b) ✅ fruit mango = new fruit();
c) Mango fruit = new fruit();
d) fruit mango = new mang();
(xv) do…while loop is an:
a) Entry Controlled Loop
b) Infinite Loop
c) ✅ Exit Controlled Loop
d) Finite Loop
(xvi) Which of the following might make the Java compiler report a Syntax error in a particular line of a program?
a) The program is typed in wrong font.
b) ✅ The line contains a comma(,) instead of a dot(.)
c) It is caused by Java runtime.
d) Program takes too long to complete.
(xvii) Assume x = 1 with the following code snippet:int y = --x;
Which one of the following is true?
a) x = 1, y = 1
b) ✅ x = 0, y = 0
c) x = 1, y = 0
d) x = 0, y = 1
(xviii) Which element is num[9] of array num?
a) 8th
b) 9th
c) ✅ 10th
d) 11th
(xix) What is the type of casting shown in the following example:char c = (char)120;
a) Implicit Typecasting
b) ✅ Explicit Typecasting
c) Both a and b
d) None of the above
(xx) Which of the following statement will declare an array marks of base type int and which can hold 150 elements
a) ✅ int marks[] = new int[150]
b) int mark[] = new int[150]
c) Int marks[] = new int[150]
d) int marks[] = new marks[150]
No comments:
Post a Comment
Note: only a member of this blog may post a comment.