GATE 2005
203 questions
MCQ 2031-mark 203
Questions 201–203 of 203
The Function Point (FP) calculated for a software project are often used to obtain an estimate of Lines of Code (LOC) required for that project. Which of the following statements is FALSE in this context.
Answer: (D)
Function points measure functionality, and lines of code needed per function point depend on the language. Typical figures are about 300 LOC per FP for assembly, about 100 to 110 for COBOL and FORTRAN, and about 60 to 65 for C++.
(A) is true: LOC per FP changes with the language.
(B) is true: assembly needs about 300 LOC per FP, much more than COBOL.
(C) is true: FORTRAN needs about 1.6 times as many lines as C++ for the same functionality (roughly ).
(D) is false: FP is used to estimate LOC, so the two are related, through a language-dependent factor.
Answer: (D)
(A) is true: LOC per FP changes with the language.
(B) is true: assembly needs about 300 LOC per FP, much more than COBOL.
(C) is true: FORTRAN needs about 1.6 times as many lines as C++ for the same functionality (roughly ).
(D) is false: FP is used to estimate LOC, so the two are related, through a language-dependent factor.
Answer: (D)
Given below is an excerpt of an xml specification.
Given below are several possible excerpts from "library.dtd". For which excerpt would the above specification be valid?
<!DOCTYPE library SYSTEM "library.dtd">
<Book>
<title> GATE 2005 </title>
<type value = "BROCHURE"/>
<accno>10237623786</accno>
</Book>
<Book>
<type value = "FICTION"/>
<accno>0024154807</accno>
</Book>Given below are several possible excerpts from "library.dtd". For which excerpt would the above specification be valid?
A. <!ELEMENT Book (title+, type, accno)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT type EMPTY>
<!ATTLIST type value (BROCHURE/FICTION/TECHNICAL)>
<!ELEMENT accno (#PCDATA)>
B. <!ELEMENT Book (title?, type, accno)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT type ATTLIST>
<!ATTLIST type value (BROCHURE/FICTION/TECHNICAL)>
<!ATTLIST accno value (#PCDATA)>
C. <!ELEMENT Book (title*, type, accno)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT type ATTLIST>
<!ATTLIST type value (BROCHURE/FICTION/TECHNICAL)>
<!ELEMENT accno (#PCDATA)>
D. <!ELEMENT Book (title?, type, accno)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT type EMPTY>
<!ATTLIST type value (BROCHURE/FICTION/TECHNICAL)>
<!ELEMENT accno (#PCDATA)>Answer: (D)
The first Book has a title, a type and an accno. The second Book has no title, a type and an accno. So the DTD must allow the title to be missing, and "type" must be declared as an element with only an attribute, that is,
- A:
- B:
- C:
- D:
All four write the attribute values with "/" where a DTD uses "|", so this does not separate them.
Answer: (D)
EMPTY.- A:
title+ needs at least one title, so the second Book is invalid.- B:
<!ELEMENT type ATTLIST> is not a valid declaration (it should be EMPTY), and <!ATTLIST accno value (#PCDATA)> does not declare the element accno and misuses #PCDATA.- C:
title* allows no title, but it also has the invalid type ATTLIST.- D:
title? allows zero or one title, and type EMPTY with an attribute list is correct.All four write the attribute values with "/" where a DTD uses "|", so this does not separate them.
Answer: (D)
A HTML form is to be designed to enable purchase of office stationery. Required items are to be selected (checked). Credit card details are to be entered and then the submit button is to be pressed. Which one of the following options would be appropriate for sending the data to the server. Assume that security is handled in a way that is transparent to the form design.
Answer: (B)
A purchase form changes something on the server (it places an order), and it carries private data (card details).
GET puts the form data in the URL. That is meant for fetching data without side effects. URLs have a length limit, and they are stored in browser history, bookmarks, caches and server logs, so card details would be exposed there. Re-sending a GET (refresh, back button) is also treated as harmless, which is wrong for an order.
POST sends the data in the body of the request. It has no practical size limit, it is not cached or bookmarked, and the browser warns before re-submitting it, so it suits an action that creates an order.
Transparent security (such as HTTPS) protects the data on the wire, but it does not change these properties of GET, so POST is the proper method.
Answer: (B)
GET puts the form data in the URL. That is meant for fetching data without side effects. URLs have a length limit, and they are stored in browser history, bookmarks, caches and server logs, so card details would be exposed there. Re-sending a GET (refresh, back button) is also treated as harmless, which is wrong for an order.
POST sends the data in the body of the request. It has no practical size limit, it is not cached or bookmarked, and the browser warns before re-submitting it, so it suits an action that creates an order.
Transparent security (such as HTTPS) protects the data on the wire, but it does not change these properties of GET, so POST is the proper method.
Answer: (B)