Software Programming : Java Programming QUESTIONS AND ANSWERS :: part18 : 1 to 5
Following Software Programming language Entrance Multiple choice objective type questions and answers will help you in Software Programming 2024 examinations :
1.What is the output of the following code? class SpecialArithmetic { public static void main (string args[]) { int x=17,a,b; a=x++;b=++x; System.out.println(“x=” + x +“a=” +a); System.out.println(“x=” + x + “b=” +b); a=x--;b=--x; System.out.println(“x=” + x + “a=” +a); System.out.println(“x=” + x + “b=” +b); } } |
x=18 a=17 |
b=19 |
a=19 |
b=17 |
x=19 a=17 |
2.The method getAccountType() is invoked in the code for printBalance(). #276. The method getAccountType() is invoked in the code for printBalance(). What is the compile-time type of the receiver of this method invocation? |
Object |
Account |
OverdraftAccount |
The answer varies depending on how printBalance() is invoked |
AccountType. |
3.What is the output of the following code? class Bitwise { public static void main (string args[]) { int x=5, y=6; System.out.println(“x&y=” +(x &y)); System.out.println(“x|y=” +(x|y)); System.out.println(“x^y=” +(x^y)); } } |
x&y=5x|y=7x^y=3 |
x&y=4x|y=7x^y=3 |
x&y=6x|y=7x^y=3 |
x&y=4x|y=8x^y=3 |
x&y=4 |
4.What is the size of the Short integer type in terms of bits? |
8 |
16 |
32 |
64 |
128. |
5.Given the code below: class A { public void print() { System.out.println("hi"); } } class B extends A { public void print() { System.out.println("bye"); } } B b = new A(); b.print(); |
Prints nothing |
Prints “hi” |
Prints “bye” |
The code does not compile, the compiler returns a type error |
The code throws a runtime exception. |
More Java Programming QUESTIONS AND ANSWERS available in next pages
-
Health is the greatest gift, contentment is the greatest wealth -Buddha
- TNTET 2021 - Practice
- SSC CGL 2021 - Practice
- TNPSC Group 2A 2021 - Practice
- IIT JEE
- IIT JEE Q&A
- TNPSC Answer Keys
- TNPSC Group 2 Syllabus
- TNPSC Q&A
- Online Tests - TNPSC
- Online Tests - GK
- IBPS 2020-2021
- Online Tests - Bank
- Online Tests - RRB NTPC
- Online Tests - UGC NET
- Online Tests - TANCET
- Online Aptitude Test
- Engineering
- Programming
- Basic Science
- Quiz
- Plus Two Question Papers
- SSLC Question Bank
- Aptitude Tests
- Logical Reasoning
- General Knowledge-Hindi
- Indian History MCQ
- Indian Geography MCQ
- Indian Civics MCQ
- Indian Economics MCQ
- CTET Biology MCQ
- CTET Chemistry MCQ
- CTET Physics Solved MCQ
- Arithmetic Tests
- Press Release
- FAQ
- Coaching Centres
- TNPSC Group 1 Syllabus
- TNPSC Group IV Syllabus
- TRB 2017 in English PDF
- TRB 2017 in Tamil PDF
- TET
- TNTET