• Result
  • Today's Puzzle
    • Previous Puzzles
    • Prize & Rules
  • Discussion Board
    • Suggestion Board
    • Trending Articles
  • Maths Tricks
  • Placement Papers
    • Placement Questions
    • Interview Experience
    • Placed user Comment
    • Group Discussion
  • English APP
  • login
  • Result
  • Today's Puzzle
    • Previous Puzzles
    • Prize & Rules
  • Discussion Board
    • Suggestion Board
    • Trending Articles
  • Maths Tricks
  • Placement Papers
    • Placement Questions
    • Interview Experience
    • Placed user Comment
    • Group Discussion
  • Walkins
    • Corporate Job Exam
    • Government Job Exam
    • Entrance Exam
  • Training
    • Internship
  • Placement Questions
  • /
  • Java
  • /
  • Programming
  • /
  • Program

Frequently Asked Java Programming - Program Technical Interview Questions

Java Select Another Category Program Select Another Topic

Programming and Technical

  • Android 118
  • ASP.NET 60
  • C 459
  • C++ 448
  • DATA STRUCTURE 66
  • DBMS 77
  • ELECTRONICS 39
  • Java 261
  • OOPs Concepts 117
  • Operating Syst 103
  • RDBMS 109
  • UNIX 70

Java Question Topics

    Category (1)

    General Ability (3)

  • General Knowledge (3)
  • HR Interview (3)

  • Interview (3)
  • Logical Reasoning (5)

  • Blood Relations (1)
  • Coding Decoding (2)
  • Cryptography (1)
  • Seating Arrangement (1)
  • Numerical Ability (4)

  • Algebra (1)
  • Number System (1)
  • Profit and Loss (1)
  • Programming (124)

  • Arrays (7)
  • Basics (5)
  • Database (4)
  • Definition (25)
  • Functions (3)
  • Output (4)
  • Program (20)
  • Puzzles (1)
  • Technical (43)
  • Verbal Ability (1)

  • Miscellaneous (1)
Keep an EYE (0)
Solved Question (1) UnSolved Question (19)
Pages: 212NextLast
Advertisements

(#M40031853) JAVA QUESTION Keep an EYE Keep an eye puzzle Keep an eye puzzle

What is the output of this program?

class average {
public static void main(String args[])
{
double num[] = {5.5, 10.1, 11, 12.8, 56.9, 2.5};
double result;
result = 0;
for (int i = 0; i < 6; ++i)
result = result + num[i];
System.out.print(result/6);

}
}
a) 16.34
b) 16.566666644
c) 16.46666666666667
d) 16.46666666666666

Asked In Java Rajendra Singh (11 years ago)
Unsolved Read Solution (18)
Is this Puzzle helpful?   (136)   (44) Submit Your Solution Program

(#M40031854) JAVA QUESTION Keep an EYE Keep an eye puzzle Keep an eye puzzle

What is the output of this program?

class conversion {
public static void main(String args[])
{
double a = 295.04;
int b = 300;
byte c = (byte) a;
byte d = (byte) b;
System.out.println(c + " " + d);
}
}
a) 38 43
b) 39 44
c) 295 300
d) 295.04 300

Asked In Java Rajendra Singh (11 years ago)
Unsolved Read Solution (12)
Is this Puzzle helpful?   (49)   (17) Submit Your Solution Program
Advertisements

(#M40018857) JAVA QUESTION JAVA QUESTIONS Keep an EYE Keep an eye puzzle Keep an eye puzzle

public void test(int x)
{
int odd = 1;
if(odd) /* Line 4 */
{
System.out.println("odd");
}
else
{
System.out.println("even");
}
}

Which statement is true?

A. Compilation fails.
B. "odd" will always be output.
C. "even" will always be output.
D. "odd" will be output for odd values of x, and "even" for even values.

Asked In Java (12 years ago)
Unsolved Read Solution (22)
Is this Puzzle helpful?   (82)   (28) Submit Your Solution Program

(#M40031855) JAVA QUESTION Keep an EYE Keep an eye puzzle Keep an eye puzzle

What is the output of this program?

class area {
public static void main(String args[])
{
double r, pi, a;
r = 9.8;
p1 = 3.14;
a = pi * r * r;
System.out.println(a);
}
}
a) 301.5656
b) 301
c) 301.56
d) 301.56560000

Asked In Java Rajendra Singh (11 years ago)
Unsolved Read Solution (41)
Is this Puzzle helpful?   (64)   (23) Submit Your Solution Program

(#M40167135) JAVA QUESTION Exceptions 3 Keep an EYE Keep an eye puzzle Keep an eye puzzle

Predict the output

import java.io.IOException;

public class Exception1{

public static void main(String[] args)

{

try

{

throw new IOException();

}

catch(IOException | Exception ex)

{

System.out.println(ex + " handled ");

}

}

}

A. program won't compile
B. runtime exception
C. program will compile
D. None of the above

Asked In Java Jax (3 years ago)
Unsolved Read Solution (2)
Is this Puzzle helpful?   (2)   (6) Submit Your Solution Program

(#M40031852) JAVA QUESTION Keep an EYE Keep an eye puzzle Keep an eye puzzle

Which of the following are legal lines of Java code?
1. int w = (int)888.8;
2. byte x = (byte)100L;
3. long y = (byte)100;
4. byte z = (byte)100L;
a) 1 and 2
b) 2 and 3
c) 3 and 4
d) All statements are correct.

Asked In Java Rajendra Singh (11 years ago)
Unsolved Read Solution (16)
Is this Puzzle helpful?   (132)   (51) Submit Your Solution Program

(#M40018946) JAVA QUESTION Advanced JAVA questions Keep an EYE Keep an eye puzzle Keep an eye puzzle

void start() {
A a = new A();
B b = new B();
a.s(b);
b = null; /* Line 5 */
a = null; /* Line 6 */
System.out.println("start completed"); /* Line 7 */
}

When is the B object, created in line 3, eligible for garbage collection?

A. after line 5
B. after line 6
C. after line 7
D. There is no way to be absolutely certain.

Asked In Java (12 years ago)
Unsolved Read Solution (3)
Is this Puzzle helpful?   (10)   (0) Submit Your Solution Program

(#M40018882) JAVA QUESTION JAVA QUESTIONS Keep an EYE Keep an eye puzzle Keep an eye puzzle

public class Test
{
public static void main(String[] args)
{
int x = 0;
assert (x > 0) : "assertion failed"; /* Line 6 */
System.out.println("finished");
}
}

A. finished
B. Compilation fails.
C. An AssertionError is thrown.
D. An AssertionError is thrown and finished is output.

Asked In Java (12 years ago)
Unsolved Read Solution (3)
Is this Puzzle helpful?   (3)   (1) Submit Your Solution Program

(#M40018930) JAVA QUESTION Advanced JAVA questions Keep an EYE Keep an eye puzzle Keep an eye puzzle

Why main method is static?

Solution
because object is not required to call static method if It were non-static method,jvm creats object first then call main() method that will lead to the problem of extra memory allocation.

Like manish sir answer on facebook.

Asked In Java (12 years ago)
Solved Read Solution (4)
Is this Puzzle helpful?   (4)   (1) Submit Your Solution Program

(#M40018965) JAVA QUESTION Advanced JAVA questions Keep an EYE Keep an eye puzzle Keep an eye puzzle

Which is true about a method-local inner class?

A. It must be marked final.
B. It can be marked abstract.
C. It can be marked public.
D. It can be marked static.

Asked In Java (12 years ago)
Unsolved Read Solution (5)
Is this Puzzle helpful?   (16)   (10) Submit Your Solution Program
Keep an EYE (0)
Solved Question (1) UnSolved Question (19)
Pages: 212NextLast
  • Login
  • Register

Resend

Sponsored Links

Advertisements

Challenger of the Day

no image
Dimple
India
Punjab
Time: 00:01:33
Points
19

Maths Quotes

2 is not equal to 3 – not even for very large values of 2.

Unknown

Mathematics has 25%formulas, 25%proofs and apply 25%thinking and 25%efforts. In real life situations proofs are nothing but already existed stories(we know the solutions from all experienced people). formulas are nothing but goals. we have so many goals b

K. Mounika

Placed User Comments

M4Math helped me a lot.

Vipul Chavan 5 years ago

Thanks m4 maths for helping to get placed in several companies.
I must recommend this website for placement preparations.

yash mittal 5 years ago

Now enjoy Offline Access of latest Question.

Get M4maths app to avail expert's solution and latest selected questions.

Download m4maths app now

  • 2533K+Registerd user
  • 1774K+Engineers
  • 759K+MBA Asprirant
  • 3K+Enginnering College
  • 250+Company Exam
  • 150K+Interview Questions
  • Site Links
  • Home
  • Result
  • Today's Puzzle
  • Discussion Board
  • Maths Tricks
  • Advertise with us
  • Contact Us
  • Useful Info
  • Maths Quotes
  • Previous Puzzles
  • Prize
  • Privacy Policy
  • Disclaimer and Copyright
  • Terms and Conditions
  • Sitemap
  • Placement papers
  • TCS Placement Paper
  • HCL Placement Paper
  • INFOSYS Placement Paper
  • IBM Placement Paper
  • SYNTEL Placement Paper
  • TECHNICAL Interview
  • HR Interview
All rights are reserved to @m4maths.com