Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

need help with these questions, if you can answer any of them it will be much ap

ID: 3842837 • Letter: N

Question

need help with these questions, if you can answer any of them it will be much appreciated, thanks!

5. Identify the root element of this XML document:

<?xml version="1.0"?>
<!DOCTYPE configuration ...>
<configuration>
<title>
    <font>
      <name>Helvetica</name>
      <size>36</size>
    </font>
</title>
</configuration>

a. DOCTYPE

b. configuration

c. header

d. none of these

e. xml

6.

Match each XML DTD element rule to its proper meaning

Question 6 options:

One of E1, E2, ..., En

0 or 1 occurrences of E

No children allowed

1 or more occurrences of E

0 or more occurrences of E

E1, followed by E2, ..., En

0 or more occurrences of text and E1, E2, ..., En

in any order (mixed content)

Text

Any children allowed

1.

E*

2.

E+

3.

E?

4.

E1|E2|...|En

5.

E1, E2, ..., En

6.

#PCDATA

7.

(#PCDATA|E1|E2|...|En)*

8.

ANY

9.

EMPTY

7. Briefly name and explain the purpose of the first two lines which should be found at the top of an XML document.

8. When a ServerSocket object is instantiated, is it possible to set a timeout value? What behavior does the timeout value control and what happens at runtime when the timeout expires?(This is meant to require a short 2-3 sentence answer.)

9. Please do the following:

Provide a working Java program that:

creates a ServerSocket object bound to TCP port 9786

sets a time out of 10 seconds

prints to standard out "Connection established" when a connection is established

takes any text received over the socket and echoes it back to the client as well as sends a message to standard output of the form "Echo message: [text]"

prints to standard out "Timeout expired" when the time out expires

Include descriptive comments where appropriate to explain what is happening at a high level

To receive full credit, your code must properly compile and then run with these two commands (assuming a Java 7 environment):

javac SocketListener.java

java -cp . SocketListener

10. Moving packets from one machine to another cannot be done with only host names, it must be done with addresses. Describe the high-level/conceptual process for resolving a hostname to an IP address in Java (hint: this can be done with a single method call). Describe, in your own words, why it is not possible to move packets without resolving the addresses of the involved hosts (even if the resolution is handled implicitly by, for example, an object's constructor).

11. Order the steps in a network server event loop

Question 11 options:

1.Gather the information requested by the client.

2. Send a response to the client through the outgoing data stream.

3. Receive a command from the client through an incoming data stream.

4. Decode the client command.

12 Which statements describe the user datagram protocol (UDP)? (can be more than 1)

Question 12 options:

a.

Commonly used for application protocols, like media streaming, which can tolerate dropped packets

b.

Utilizes a three-way handshake for the initial connection setup

c.

It is described as an "unreliable" protocol

d.

The receiver does not confirm receipt of packets to the sender

e.

Uses window scaling to control the number of packets which are sent before a confirmation of receipt is required

13. Explain the concept of a port number in computer networking.

(This question is meant to require a short, 1-2 sentence, answer.)

14. Serialized Java objects are processed with redundancy elimination, while JavaBeans are persisted by storing every property value (even default values)

true or false?

15.

Describe how and why a persistence delegate is used when working with JavaBeans. Describe an example of its use.

(This is meant to require a thorough, 1-2 paragraph, answer.)

16.What is the relationship between a property editor and a customizer when working with a JavaBean?

17.Describe some ways in which JavaBeans support/promote software component reuse.

18.Explain the difference between a commit and a push in Git.

19.

What difference is there, if any, between a class extending Thread and implementing Runnable? Which is better? Why?

(This is meant to require a thorough, 1-2 paragraph, answer.)

20.

Java supports the concept of a static initializer block. It is a class-level construct of the form:

static {

// Java code

}

Describe what triggers the execution of the static initializer block, how often it is executed, and conceptually why a programmer would choose to implement one.

(This is meant to require a thorough, 1-2 paragraph, answer.)

21.

Which of the following are valid visibility levels for classes, methods, and class variables in Java? (can be more than 1)

Question 27 options:

private

encapsulated

public

friend

protected

(no keyword) [package visibility]

transient

One of E1, E2, ..., En

0 or 1 occurrences of E

No children allowed

1 or more occurrences of E

0 or more occurrences of E

E1, followed by E2, ..., En

0 or more occurrences of text and E1, E2, ..., En

in any order (mixed content)

Text

Any children allowed

1.

E*

2.

E+

3.

E?

4.

E1|E2|...|En

5.

E1, E2, ..., En

6.

#PCDATA

7.

(#PCDATA|E1|E2|...|En)*

8.

ANY

9.

EMPTY

Explanation / Answer

19.Developing Custom Thread:-

We have two ways to develop Custom Thread:-

1.Extending from Thread Class
2.Implementing from Runnable Interface

Among these two approaches creating Thread implementing from Runnable Interface is recommended.

Because...

a. To Achieve Multiple Inheritance
b. To Achieve Parallel Development

If we create subclass deriving from Thread class we cannot extend this class from other classes like frame or exception.
whereas if we implement it from Runnable Interface we can extend this class from frame class. so that this new sub class will have frame and thread capabilities.

20.Static Block:-
Static Block is a class level nameless block that contains the only static keyword in its prototype.

Syntax:-
class Example
{
static
{
// Any Java Legal statements are allowed except return and throw statements.
}
}

Need of Static Block:-
Static Block is used to execute logic only at the time of class loading.
logic like,
a.Initializing static variables
b.Registering native libraries
c.To know classes loading order

who will execute Static Block when and where?

Static Blocks are executed automatically by JVM at the time of class loading in the order they defined from top to bottom by creating separate stack frame in the main thread in Java stacks area.

Note:-
Static Block is always executed before the main method.

21.The Valid Visibility Levels for Classes, Methods, and Class Variables in Java:-

a.private

c.public

e.protected

g.transient

Explanation:-

In Java we have 50 Keywords.

Transient Variable:-
The class level variable that has tansient keyword in its definition is called transient variable.
Local variables can not be declared as transient else it leads to illegal start expression.

Example:-

class EXample
{
static transient int x=10;
transient int y=20;
staic voidm1()
{
transient int z =30; //Compile time Error
}
}

S.No Name of the Java keyword S.No Name of the Java keyword 1. Class 26. protected 2. Interface 27. private 3. enum 28. public 4. byte 29. final 5. short 30. abstract 6. int 31. native 7. long 32. transient 8. float 33. volatile 9. double 34. synchronized 10. char 35. strictfp 11. boolean 36. extends 12. void 37. Implements 13. static 38. this 14. new 39. super 15. if 40. Instanceof 16. else 41. package 17. switch 42. import 18. case 43. try 19. default 44. catch 20. while 45. finally 21. do 46. throw 22. for 47. throws 23. break 48. assert 24. continue 49. const 25. return 50. goto