Question
Java | Answer them all 1. Any Java interface must contain certain number of methods. If an interface does not have any method declared, then
Java | Answer them all
1. Any Java interface must contain certain number of methods. If an interface does not have any method declared, then it is useless.
(a)true
(b)false
2. The Java generics are used to reduce errors in Java programs using collection-type objects. Which of the following gives what the Java generics do?
(a) converting compile errors to runtime errors
(b) converting runtime errors to compile errors
3. In which of the following situations, the EL engine would complain?
(a) When an EL expression accesses a session attribute by the name, but the attribute object does not exist.
(b) When an EL expression access a JavaBean property through its bean reference, but the property does not exist.
4. If you use the data binding feature that copies data from an HTML form to the properties of a JavaBean, you need to make sure that the input field names of the HTML form exactly match their corresponding JavaBean property names. Other-wise you can never make the data copy successful.
(a) true
(b) false
5. Suppose the value of a parameter called chap is not available. If we use the EL expression ${param.chap} to access the parameter, which of the following would happen?
(a)an empty string
(b)null
(c)An error message is displayed.
6. Which of the following ways of using an EL expression is legal?
(a)${paramValue.names[0]}
(b)${cookies.user}
(c)${headerValues["Accept-Language"][0]}
(d)${headerValues.Accept-Language[0]}
(e)${out.println("Done!")}
7. Suppose that we use the following two lines in a servlet to set values for the book attribute, request.setAttribute("book", "java1"); session.setAttribute("book", "java2"); Then when we display the value of the book attribute in the JSP forwarded by this servlet using the EL expression ${book}, what is its result?
(a)java1
(b)java2
(c)empty string
(d)java1, java2
(e)error
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started