Meaningless Drivel is fun!*
The moose likes Beginning Java and the fly likes 5 Theoratical questions core java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "5 Theoratical questions core java" Watch "5 Theoratical questions core java" New topic
Author

5 Theoratical questions core java

Nikhil Vrrma
Greenhorn

Joined: May 15, 2008
Posts: 4
I was taking a sample test at
http://www.geekinterview.com/quiz/review/17/1303.html

5 questions I do not agree with their answers.
Request to please share your views.
I have added my thinking process behind the answers

1 Applets are always downloaded on demand
@ I answered false as there are a few self downloading applets like update packages.

2 java run time system is also called jvm
@ I answered false as JRE is different from JVM.

3 Java is Not designed for the distributed environment of the Internet
@ I answered false as thats why its platform independent and architecturally neutral.

4 You do not need to follow any special indentation rules in Java
@ I answered true which was correct but raises a questions if there ARE any languages where indentation matters to programming. (is it RUBY?)

5 A constant value in Java is created by using a literal representation of it
@ I answered it as false as we need to make it "final".



Thanks for your help
~ Nik
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
Welcome to JavaRanch.
1 Applets are always downloaded on demand
@ I answered false as there are a few self downloading applets like update packages.

I'm not sure what you mean by either "self-downloading" or "update packages"; can you give an example?
Applets are embedded in HTML pages, and get downloaded when the page gets rendered and applet support is turned on in the browser.
2 java run time system is also called jvm
@ I answered false as JRE is different from JVM.

The phrase "Java runtime system" is not generally used, so it means whatever the person using it wants it to mean.
The JVM is in integral part of the JRE; I don't think it can do much without the class libraries, though (which are the other big part of the JRE).
3 Java is Not designed for the distributed environment of the Internet
@ I answered false as thats why its platform independent and architecturally neutral.

"Architecture neutral" and "platform independent" have nothing to do with distributed computing. They simply mean that java classes can run on any platform, not that they enable distributed computing.
Java has a number of features that are very useful in distributed computing, though. like applets, RMI and serialization.
4 You do not need to follow any special indentation rules in Java
@ I answered true which was correct but raises a questions if there ARE any languages where indentation matters to programming. (is it RUBY?)

Python is a language where the indentation is part of the syntax.
5 A constant value in Java is created by using a literal representation of it
@ I answered it as false as we need to make it "final".

"final" applies to reference (variables), not to values.


Ping & DNS - updated with new look and Ping home screen widget
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13875
    
  10

Originally posted by Nikhil Vrrma:
5 A constant value in Java is created by using a literal representation of it
@ I answered it as false as we need to make it "final".

If you make a reference variable final, then you can't change the variable (to refer to another object), but if its type is mutable, then you can still change the state of the object that the variable refers to - so "final" does not really make a constant (in the way that for example "const" does in C++).


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Nikhil Vrrma
Greenhorn

Joined: May 15, 2008
Posts: 4
THanks to Ulf and Jesper

1 Applets are always downloaded on demand

I'm not sure what you mean by either "self-downloading" or "update packages"; can you give an example?

I was initially thinking of Java Std ed 6 when an update is available it shows an Orange icon in system tray. If we specify in settigs to automatically download update then it does so. Even Firefox browser does that latest version check.
But as you mentioned we are actually explicitly approving the download (also for applets in HTML tag) I guess the statement "Applets are always downloaded on demand " is TRUE.


2 java run time system is also called jvm

The phrase "Java runtime system" is not generally used, so it means whatever the person using it wants it to mean.
The JVM is in integral part of the JRE; I don't think it can do much without the class libraries, though (which are the other big part of the JRE).


I still think jre and jvm are two different entities. (as i got from this link http://wiki.answers.com/Q/What_is_difference_between_JVM_and_JRE)
The Java Runtime Environment (JRE) is a set of library files and the java executable that is kicked off in order to run any java program.

The Java Virtual Machine (JVM) is created, like a separate program, whenever a java program is executed. The JVM essentially runs between the computer and the java program. Java is designed so that any java program can run on any machine. This is because the JVM will interpret the Operating System independent java code and execute the commands needed for the particular Operating System you are trying to run the program on at the time.
Java Program --- Execute some command ---> JVM --- Translate the command for this computer ---> Computer


3) Java is Not designed for the distributed environment of the Internet
@ I answered false as thats why its platform independent and architecturally neutral.


"Architecture neutral" and "platform independent" have nothing to do with distributed computing. They simply mean that java classes can run on any platform, not that they enable distributed computing.
Java has a number of features that are very useful in distributed computing, though. like applets, RMI and serialization.


What do you think of when you think distributed Computing. Which languagues were designed keeping this in mind if not Java ?



4 python

Thanks for the answer.


5 A constant value in Java is created by using a literal representation of it
@ I answered it as false as we need to make it "final".


"final" applies to reference (variables), not to values.


from Jesper ::

If you make a reference variable final, then you can't change the variable (to refer to another object), but if its type is mutable, then you can still change the state of the object that the variable refers to - so "final" does not really make a constant (in the way that for example "const" does in C++).



I was thinking like when we initialize the value of PI=3.141 then we are making it literal (PI). So it is becoming a constant. HOw would we make it a constant value in Java.

I am confused :roll: Can you please clarify.

Thanks a lot for your support.

~ Nik
[ September 01, 2008: Message edited by: Nikhil Vrrma ]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
I still think jre and jvm are two different entities.

Indeed they are. But you used the phrase "java runtime system", and that has no generally understood meaning.

I was thinking like when we initialize the value of PI=3.141 then we are making it literal (PI). So it is becoming a constant. HOw would we make it a constant value in Java.

I'm not sure sure what you're asking. The value 3.141 is constant; it's in the source and can't change (unless you edit the source and recompile). But the variable PI can take on other values, unless it is declared final.

What do you think of when you think distributed Computing. Which languagues were designed keeping this in mind if not Java ?

Distributed computing generally means that more than a single machine takes part in a computation. An example would be a system consisting of a web server, an app server and a database, all running on different machines. A more standard example would be parallel computers or workstation clusters using something like MPI to work on tasks of a single problem. Or even a program using a remote web service would qualify.
I'm not sure if there are languages designed with this in mind (unless you want to count the parallel-processing languages shipped with parallel computers), but some languages have features that make this kind of thing easier, e.g. in Java it helps to have the java.net package and RMI.
Nikhil Vrrma
Greenhorn

Joined: May 15, 2008
Posts: 4
Thanks for sharing your views Mr.Ulf Dittmer .It was a great help.
Espescially that "Distributed Computing" one.All my doubts have been cleared now.



[ September 07, 2008: Message edited by: Nikhil Vrrma ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: 5 Theoratical questions core java
 
Similar Threads
Do we really need java interview book when we have internet
need interview Q/A on servlets,jsp,ejb pleeeeeeezzz
IS this a HandBook for the Architect Exam?
Pls Help SCJPs.....
Some questions about Java SE 7 OCA and OCP