Exercise 1. Choose the best answer for each of the following questions. (1)Which of the following can not be used as the scope when using a JavaBean with JSP a. application b session c request d response (2)How do you display a border like th The top border= 12 pixels The bottom border=5 pixels The left border=20 pixels The right border= 2pixel by CSS? a. border-width: 12px 20px 5px 2px b border-width: 12px 5px 20px 2px c border-width: 12px 2px 5px 20px d border-width 5px 20px 12px 2px (3)What is the correct HTML for adding a background color? a b yellow c. d (4) How many different kinds of loops are there in Java Script? a. Four. The"for"loop, the"while"loop, the " do.. while"loop, and the"loop. until"loop b Two. The"for"loop and the while"loop One. The"for"loop d Three. The"for"loop, the"while"loop and the"do.while"loop (5)With SQL, how do you select all the records from a table named"Persons"where the value of the column "firstName" starts with a"sea" a select* FRoM Persons where firstName ='seal b SEleCt* FROM Persons WhERE FirstName ='%sea% c SELECT* FROM Persons WhERE FirstName LIKE'sea% d SELECT* FROM Persons WhERE FirstName liKe%se (6)How can you make an e-mail link? a b xxx @yyy d <a href="mailto: xxX @yyy
Exercise 1. Choose the best answer for each of the following questions. (1) Which of the following can not be used as the scope when using a JavaBean with JSP? a. application b. session c. request d. response (2) How do you display a border like this: The top border = 12 pixels The bottom border = 5 pixels The left border = 20 pixels The right border = 2pixel by CSS? a. border-width:12px 20px 5px 2px b. border-width:12px 5px 20px 2px c. border-width:12px 2px 5px 20px d. border-width:5px 20px 12px 2px (3) What is the correct HTML for adding a background color? a. b. yellow c. d. (4) How many different kinds of loops are there in JavaScript? a. Four. The "for" loop, the "while" loop, the "do...while" loop, and the "loop...until" loop b. Two. The "for" loop and the "while" loop c. One. The "for" loop d. Three. The "for" loop, the "while" loop and the "do...while" loop (5) With SQL, how do you select all the records from a table named "Persons" where the value of the column "FirstName" starts with a "sea"? a. SELECT * FROM Persons WHERE FirstName = 'sea' b. SELECT * FROM Persons WHERE FirstName = '%sea%' c. SELECT * FROM Persons WHERE FirstName LIKE 'sea%' d. SELECT * FROM Persons WHERE FirstName LIKE '%sea' (6) How can you make an e-mail link? a. b. c. xxx@yyy d
(7)What is the correct Java script syntax to write"Hello world"? a doc write"Hello World b document. write("Hello World") lo World") d. doc. write("Hello world") (8)What is a benefit of using Java Beans to separate business logic from presentation markup a. It allows the jSP to access middleware b. It creates a cleaner role tion between the web-production team and the software development team, so that the web-production team can focus on presentation markup, while the software team can focus on building reusable software components for helping to generate c. It provides a dynamic markup environment, such that JavaBeans are integrated seamlessly with the template presentation content, in order to create the dynamic display for the client d. It provides the developer with full access to the Java 2 Platform Enterprise Edition (J2EE which is unavailable from outside the javaBean environment (9)Which CSS property controls the text size? a. text-size b. font-style c. text-style d. font-size (10)Which statement is true? a. XML elements must be properly nested b. XMl documents must have a root tag c. XML tags are case sensitive d. All of the above (1) How can you open a link in a new browser window? b. d. <a href="url"target="to ( 12)Which of the following is not a standard method called as part of the JSP life cycle? (13)How do you write a conditional statement for executing some statements only if"i"is NOT equal to 9 in JavaScript?
(7) What is the correct JavaScript syntax to write "Hello World"? a. doc.write"Hello World"; b. document.write("Hello World"); c. response.write("Hello World"); d. doc.write("Hello World"); (8) What is a benefit of using JavaBeans to separate business logic from presentation markup within the JSP environment? a. It allows the JSP to access middleware. b. It creates a cleaner role separation between the web-production team and the software development team, so that the web-production team can focus on presentation markup, while the software team can focus on building reusable software components for helping to generate dynamic displays. c. It provides a dynamic markup environment, such that JavaBeans are integrated seamlessly with the template presentation content, in order to create the dynamic display for the client. d. It provides the developer with full access to the Java 2 Platform Enterprise Edition (J2EE), which is unavailable from outside the JavaBean environment. (9) Which CSS property controls the text size? a. text-size b. font-style c. text-style d. font-size (10) Which statement is true? a. XML elements must be properly nested b. XML documents must have a root tag c. XML tags are case sensitive d. All of the above (11) How can you open a link in a new browser window? a. b. c. d. (12) Which of the following is not a standard method called as part of the JSP life cycle? a. jspInit() b. _jspService() c. jspService() d. jspDestroy() (13) How do you write a conditional statement for executing some statements only if "i" is NOT equal to 9 in JavaScript?
a. if(i!=9) b if =!9 then c.f(<>9) d.if(9) ( 14)Which HTML tag is used to define an internal style sheet? a. b. c (15)which statement is true about using HttpservletResponse. sendredirect()and jsp forward>? a. executes on the client while sendRedirect( ) executes on the server b. executes on the server while sendRedirect()executes on the client c Both jsp: forward> and sendRedirect()execute on the client d. Both and sendRedirect() execute on the server (16) How do you make a list that lists its items with squares? a. list-type: square 2 c. ty d. list-style-type: square (17) How do you find the client's browser name in JavaScript? a browser. appName b. navigator. ap c browser name d. client nay Name (18)Choose the statement that best describes the relationship between JSP and servlet a. Servlets are built on JSP semantics and all servlets are compiled to JSP pages for runtime b. Servlets and JSP are competing technologies for handling web requests. Servlets are be superseded by jSP, which is preferred The two technologies are not useful in combination c JSPs are built on servlet semantics and all JSPs are compiled to servlets for runtime usage d. jSP and servlets are unrelated technologies (19)What is the correct JavaScript syntax for opening a new window called"new Window"? a.new.window("http://www.xxx.com","newwindow") b.new("http://www.xxx.com","newwindow") c.open.new("http://www.xxx.com","newWindowo") d.window.open("http://www.xxx","newwindow") (20)When using a Java Bean to get all the parameters from a form, what must the property be set to(??? in the following code) for automatic initialization?
a. if (i ! = 9) b. if = ! 9 then c. if (i 9) d. if (i 9) (14) Which HTML tag is used to define an internal style sheet? a. b. c. d. (15) Which statement is true about using HttpServletResponse.sendRedirect( ) and ? a. executes on the client while sendRedirect( ) executes on the server. b. executes on the server while sendRedirect( ) executes on the client. c. Both and sendRedirect( ) execute on the client. d. Both and sendRedirect( ) execute on the server. (16) How do you make a list that lists its items with squares? a. list-type: square b. type: 2 c. type: square d. list-style-type: square (17) How do you find the client's browser name in JavaScript? a. browser.appName b. navigator.appName c. browser.name d. client.navName (18) Choose the statement that best describes the relationship between JSP and servlets: a. Servlets are built on JSP semantics and all servlets are compiled to JSP pages for runtime usage. b. Servlets and JSP are competing technologies for handling web requests. Servlets are being superseded by JSP, which is preferred. The two technologies are not useful in combination. c. JSPs are built on servlet semantics and all JSPs are compiled to servlets for runtime usage. d. JSP and servlets are unrelated technologies. (19) What is the correct JavaScript syntax for opening a new window called "newWindow" ? a. new.window("http://www.xxx.com", "newWindow") b. new("http://www.xxx.com", "newWindow") c. open.new("http://www.xxx.com", "newWindowo") d. window.open("http://www.xxx", "newWindow") (20) When using a JavaBean to get all the parameters from a form, what must the property be set to (??? in the following code) for automatic initialization?
jsp:setProperty name="formBean"property="929"> b. al (21)If a browser has Javascript turned off it will a ignore all and tags b display the content of tags c.display the content of tags d display the content of and tags (22)JavaBean methods are al a events b. Properties c. Event listeners d. identical to methods of other java classes (23)Which event is triggered automatically at regular intervals in JavaScript? a. onload d. setAutomatic (24)What type of scriptlet code is better-suited to being factored forward into a servlet? a. Code that deals with logic that is common across requests b Code that deals with logic that is vendor specific c. Code that deals with logic that relates to database access d Code that deals with logic that relates to client scope (25)Which one of the following will get the data from the first column of ResultSet rs, returned from executing the following SQL statement SELECT name, rank, serialNo FROM employee a.rsgetString(rs. next()); b. rs getString(name) c.rs getString(1); d rs getInt("name") (26)In JavaScript, an array can contain a. only text b. only numbers c. only numbers or text d any valid variable
a. * b. all c. # d. = (21) If a browser has Javascript turned off it will a. ignore all and tags b. display the content of tags c. display the content of tags d. display the content of and tags (22) JavaBean methods are all a. Events b. Properties c. Event listeners d. Identical to methods of other Java classes (23) Which event is triggered automatically at regular intervals in JavaScript? a. onload b. setTimeout c. setInterval d. setAutomatic (24) What type of scriptlet code is better-suited to being factored forward into a servlet? a. Code that deals with logic that is common across requests. b. Code that deals with logic that is vendor specific. c. Code that deals with logic that relates to database access. d. Code that deals with logic that relates to client scope. (25) Which one of the following will get the data from the first column of ResultSet rs, returned from executing the following SQL statement: SELECT name, rank, serialNo FROM employee. a. rs.getString(rs.next( )); b. rs.getString(name); c. rs.getString(1); d. rs.getInt("name"); (26) In JavaScript, an array can contain a. only text b. only numbers c. only numbers or text d. any valid variable
(27)When you write a get method for a JavaBean property, form the method name as follows a. Use any name you want for the get method b. Use only the property name for the get method c. Use get followed by the property name, with the first letter of the property name capitalized d. none of the above (28)Which of the following is not an event that can trigger a Javascript a. mouse actions b operating system actions c keyboard actions d. timed actions (29)A property defined in a Java Bean typically a. Is declared as a private type b. Has a corresponding get method and set method c. Can be saved and retrieved at a later time d. all of the above (30)Which is true about TLD files? a. TLD files may be placed in any subdirectory of WEB-INF b. tLD files are used to configure JSP environment attributes such as scripting- invalid c. TLD files may not be placed in WETA-INF directory of the WAR file d. TLD files can declare both Simple and Classic tags, but TLD files are NOT used to declare Tag 2. Question. (I)What is the difference between"GET" and"POST"methods?(5 points (2)What is MVC architecture? How to use the Mvc in Java Server Pages? You can draw a diagram to clarify your idea. (5 points) (3)What are two ways to cause a block to disappear by using JavaScript?(5 points) (4)Consider the following HTML file. Fill in the blanks with the correct color of text that will be displayed in browsers (10 points) Colors/title> <! hI color: red ! important; i h2 [id="warning"](color: yellow; h3(color: green;
(27) When you write a get method for a JavaBean property, form the method name as follows: a. Use any name you want for the get method. b. Use only the property name for the get method. c. Use get followed by the property name, with the first letter of the property name capitalized. d. None of the above. (28) Which of the following is not an event that can trigger a Javascript? a. mouse actions b. operating system actions c. keyboard actions d. timed actions (29) A property defined in a JavaBean typically a. Is declared as a private type. b. Has a corresponding get method and set method. c. Can be saved and retrieved at a later time. d. All of the above. (30) Which is true about TLD files? a. TLD files may be placed in any subdirectory of WEB-INF. b. TLD files are used to configure JSP environment attributes such as scripting- invalid. c. TLD files may not be placed in WETA-INF directory of the WAR file. d. TLD files can declare both Simple and Classic tags, but TLD files are NOT used to declare Tag Files. 2. Question. (1) What is the difference between "GET" and "POST" methods? (5 points) (2) What is MVC architecture? How to use the MVC in Java Server Pages? You can draw a diagram to clarify your idea. (5 points) (3) What are two ways to cause a block to disappear by using JavaScript? (5 points) (4) Consider the following HTML file. Fill in the blanks with the correct color of text that will be displayed in browsers. (10 points) Color <!-- h1 {color: red !important;} h2 [id="warning"] {color: yellow;} h3 {color: green;}
ol icolor: aqua; or: gr h3(color: purple, focus (color: black ning (color: Maroon; i #important (color: Olive 11 id="highlight">CourseCSS Outline Beginner Intermediate Advanced Text Color Course Outline Advanced (5)Consider the employee database of Figure 1, where the primary keys are underlined Give an expression in SQL for each of the following queries(15 point) employee(emplovee-name, street, city) orks(emplovee-name, branch-name, salary branch(branch-name, cit Figure 1. Employee database (a) find the names and their salary of all employees (b) Find all employees in the database who live in the same cities as the branches for which they
ol {color: aqua;} * {color: gray;} h3 {color: purple;} .focus {color: black;} #warning {color: Maroon;} #highlight {color: blue;} #important {color: Olive;} --> Course CSS Outline Beginner Intermediate Advanced (5) Consider the employee database of Figure 1, where the primary keys are underlined. Give an expression in SQL for each of the following queries (15 point) employee (employee-name, street, city) works (employee-name, branch-name, salary) branch (branch-name, city) Figure 1. Employee database. (a) Find the names and their salary of all employees. (b) Find all employees in the database who live in the same cities as the branches for which they work. Text Color Course (a) CSS (b) Outline (c) Intermediate (d) Advanced (e)
(c)Find the branch that has the most employees (d) Modify the database so that Jones now lives in Beijing (e) Give all employees a 10 percent raise unless the salary becomes greater that RMB 120,000; in such cases, give only a 3 percent raise
(c) Find the branch that has the most employees. (d) Modify the database so that Jones now lives in Beijing. (e) Give all employees a 10 percent raise unless the salary becomes greater that RMB 120,000; in such cases, give only a 3 percent raise