**Step 1 — Identify the matching rules.** The element is a div with class cdiv and ID div1. All three selectors match it: the element selector, the class selector and the ID selector.
**Step 2 — Compare specificity.**
Selector
Colour
Specificity
div
Green
\((0,0,1)\)
.cdiv
Red
\((0,1,0)\)
#div1
Blue
\((1,0,0)\)
For declarations with the same origin and importance, an ID selector outranks a class selector, which outranks an element selector.
**Step 3 — Apply the winning declaration.** The ID rule sets the colour to blue, so the text **IITM BS Degree in Data Science** appears in **blue**.
**Answer: B.**
A: Red belongs to the class rule, which loses to the ID rule.
B: Correct: the ID selector has the highest specificity.
C: Green belongs to the element rule, which has the lowest specificity here.
D: The matching CSS colour rule overrides the browser's default text colour.
**Step 1 — Use the default display behaviour.** A block element normally begins on a new line and occupies the available width. An inline element normally participates within the current line. CSS can override these defaults, but no override is given here.
**Step 2 — Classify the listed elements.**
Element
Default display
div, h1, h5, p
Block
span, a
Inline
**Step 3 — Match the required order.** We need **block first, inline second**. Only **div followed by a** satisfies both conditions.
**Answer: B.**
A: Reverses the default roles: span is inline and div is block.
B: Correct: div is block and a is inline by default.
C: h1 is block, but p is also block rather than inline.
D: span is inline and h5 is block, so both labels are reversed.
Consider the following HTML and Python flask code.
Assume that the Flask app is running at http://127.0.0.1:5000.
Based on the above data, answer the given subquestions.
Which of the following statements are correct?
**Statement 1:** Accessing the URL: http://127.0.0.1:5000 directly in the browser makes a GET
request.
**Statement 2:** Clicking on the Submit button will invoke the POST request method.
6406537022612.
Both statements are correct
6406537022613.
Both statements are incorrect.
6406537022614.
Statement 1 is incorrect, but statement 2 is correct.
6406537022615.
Statement 2 is incorrect, but statement 1 is correct.
Published solution
**Step 1 — Follow direct browser navigation.** Entering the root URL in the address bar sends a GET request. The route accepts GET, so the function takes its else branch and renders numbers.html.
**Step 2 — Inspect the form declaration.** Its method is explicitly POST and its action is the root path. Clicking Submit therefore sends the form fields to the same route using POST.
**Step 3 — Decide each statement.**
- Statement 1 is true: direct navigation uses GET.
- Statement 2 is true: this particular form submits using POST.
**Answer: A — both statements are correct.** A submit button does not always imply POST; it is the form's method attribute that determines it here.
A: Correct: both claims follow from the route and the form method.
B: Both claims are true, not false.
C: Direct navigation does make a GET request, so statement 1 is true.
D: The form explicitly uses POST, so statement 2 is also true.
Consider the following HTML and Python flask code.
Assume that the Flask app is running at http://127.0.0.1:5000.
Based on the above data, answer the given subquestions.
What will be the rendered output for the following input in the form?
6406537022616.
404 Not Found
6406537022617.
[0, 1, 2, 3, 4]
6406537022618.
[ ]
6406537022619.
[1, 2, 3, 4, 5]
Published solution
**Step 1 — Read the submitted value.** The input field is named txtn and contains 5. The POST branch reads that field and converts its string value to the integer \(n=5\).
**Step 2 — Trace the loop.** The list starts empty. Python's range(5) produces 0, 1, 2, 3, 4; its upper endpoint is excluded. Each value is appended to the list.
**Step 3 — Read the returned response.** The function returns the string representation of the completed list:
\[
\boxed{\texttt{[0, 1, 2, 3, 4]}}.
\]
**Answer: B.**
A: The root route exists and accepts POST, so this is not a missing-route error.
B: Correct: range(5) appends the five integers from 0 through 4.
C: The loop executes five times, so the list does not remain empty.
D: range(5) starts at 0 and excludes 5.
A web server has an outgoing bandwidth of 6 Gbps, and each client requires 2 Mbps. What is the
maximum number of concurrent requests allowed?
(Use: 1KB= 1000Bytes, 1MB=1000KB and so on.)
6406537022620.
3
6406537022621.
30
6406537022622.
3000
6406537022623.
300
Published solution
**Step 1 — Convert bandwidths to the same unit.** With the given decimal convention,
\[
6\text{ Gbps}=6\times1000=6000\text{ Mbps}.
\]
**Step 2 — Divide capacity by each client's demand.**
\[
N=\left\lfloor\frac{6000\text{ Mbps}}{2\text{ Mbps/client}}\right\rfloor
=\boxed{3000\text{ clients}}.
\]
**Step 3 — Interpret the result.** This is the question's bandwidth-only concurrent-request limit. Processing capacity and protocol overhead are outside the supplied model.
**Answer: C.**
A: Divides 6 by 2 without converting Gbps into Mbps.
B: Does not use the required factor of 1000 between Gbps and Mbps.
C: Correct: 6000/2=3000.
D: Is smaller than the calculated bandwidth limit by a factor of ten.
Consider the following Flask code.
**File name:** app.py
What will be the output when you run the following code in the terminal
and then access in the browser with the following link
?
6406537022632.
Result: 42
6406537022633.
Result: 13
6406537022634.
Result: 7
6406537022635.
Result: 12
Published solution
**Step 1 — Read the command-line argument.** Running python app.py 7 sets the first argument to the string 7. The code converts it to an integer, so MULTIPLIER is 7; the default value 2 is not used.
**Step 2 — Read the URL parameter.** The path ends in /calculate/6. The int converter passes the integer value 6 to the function.
**Step 3 — Evaluate the function's expression.**
\[
\text{value}\times\text{MULTIPLIER}=6\times7=42.
\]
The returned response is **Result: 42**.
**Answer: A.**
A: Correct: the integer URL value 6 is multiplied by the command-line value 7.
B: 13 would result from addition, but the code multiplies.
C: 7 is the multiplier alone, not the result.
D: 12 would use the default multiplier 2, but argument 7 overrides it.
**Step 1 — Check the types of the supplied query values.** For the URL with price=5 and qty=2, request.args.get returns the strings "5" and "2". The defaults 0 and 1 are not used because both query parameters are present.
**Step 2 — Evaluate the multiplication.** The operation is therefore string multiplied by string. Python allows a string multiplied by an integer for repetition, but not a string multiplied by another string. Consequently this operation raises **TypeError**.
**Step 3 — Distinguish the exception from the HTTP response.** No exception handler is provided, so Flask returns a 500 error response to the browser. Among the listed answers, **D** correctly identifies the underlying exception; the application does not successfully return 55, 52 or 10.
A: Would require repeating string 5 with integer 2; qty is a string instead.
B: Would suggest string concatenation, but the code uses multiplication.
C: Would require converting both query parameters to numbers first.
D: Correct: multiplying the two returned strings raises TypeError, leading to an HTTP 500 response.
**Step 1 — Identify the loop's values.** The list contains two names, Siya and Sunita, so the loop executes once for each name.
**Step 2 — Substitute the current name.** Each iteration constructs a Template with the placeholder name and supplies that same placeholder to substitute. Therefore the first iteration produces Student Name: Siya and the second produces Student Name: Sunita.
**Step 3 — Account for print's newline.** print is called inside the loop, so the names appear on separate lines:
\[
\begin{array}{l}
\text{Student Name: Siya}\\
\text{Student Name: Sunita}
\end{array}
\]
**Answer: B.**
A: The two print calls produce separate lines rather than one combined line.
B: Correct: each iteration substitutes and prints its own name.
C: Both iterations print; the first name is not discarded.
D: The required placeholder is supplied, so there is no missing-key error.
**Step 1 — Identify the two possible route patterns.** The application has a variable route for /user followed by a name, and a specific route for /user/admin.
**Step 2 — Apply route matching.** For /user/admin, Flask/Werkzeug gives the matching static path priority over the variable path. The specific admin route therefore handles the request even though it is registered second.
**Step 3 — Read that route's return value.** The admin function returns **Admin Panel**.
**Answer: A.**
A: Correct: the exact static route is selected.
B: This would come from the variable route, which loses to the exact static match.
C: The application has an exact matching route, so it does not return 404.
D: The route declarations are valid and its handler returns normally.
**Step 1 — Read the route structure.** The path requires two integer segments after calculate. Both must be part of the path itself; query parameters cannot replace missing path segments.
**Step 2 — Test all four URLs.**
Option
Does the path match?
Response
A: /calculate/10/5
Yes: both segments are integers
2.0
B: /calculate/3/0.2
No: 0.2 is not accepted by the int converter
404
C: /calculate/3/2?v1=1
Yes: the query does not change path matching
1.5
D: /calculate?v1=5&v2=2
No: both required path segments are absent
404
**Step 3 — Select missing-route responses.** B and D never reach the function, so its try/except block cannot change those 404 responses.
**Answer: B and D.**
A: Not selected: it matches the route and returns 10/5 as 2.0.
B: Correct: the decimal path segment fails integer conversion during route matching.
C: Not selected: the path still supplies 3 and 2; the extra query parameter is unused.
D: Correct: query parameters do not supply the two mandatory path segments.
**Step 1 — Inspect what the template reads.** The program sets course to all command-line arguments after the script name. The template displays course[0], course[1], course[2] and course[3], so these must be exactly four separate course-name arguments.
**Step 2 — Apply shell argument splitting.** Unquoted spaces separate arguments. Quoting each project name individually preserves that name as one argument; quoting the entire four-name sequence instead produces just one argument.
**Step 3 — Compare the options.**
- A splits the project names at the spaces after the underscores, creating unwanted extra arguments.
- B provides the required four arguments.
- C wraps every name in one quoted string, producing one argument.
- D provides four arguments; quotes around the two individual project names do not change their contents.
**Answer: B and D.**
A: Incorrect: MAD1_ Project is split into two arguments, so the displayed first four values are wrong.
B: Correct: each course/project name is a separate argument.
C: Incorrect: the whole quoted sequence becomes a single argument.
D: Correct: individually quoted project names remain separate arguments with the required contents.
Suppose a client machine C is communicating with a data center D located 12,500 km away from
C. Assume that the TCP connection has been established and is kept alive. Calculate the RTT
(Round trip time) in **ms** for an HTTP request. (Assume speed of light in cable is 2e8 m/s).
Published solution
**Step 1 — Convert the one-way distance to metres.**
\[
d=12500\text{ km}=12500\times1000=12{,}500{,}000\text{ m}.
\]
**Step 2 — Calculate one-way propagation time.**
\[
t_{\text{one-way}}=\frac{d}{v}
=\frac{12{,}500{,}000}{2\times10^8}
=0.0625\text{ s}.
\]
**Step 3 — Include the return journey and convert to milliseconds.**
\[
\text{RTT}=2(0.0625)=0.125\text{ s}
=\boxed{125\text{ ms}}.
\]
The TCP connection is already established, so an additional connection handshake is not counted. This calculation uses only the propagation delay specified by the question.
Suppose you have a document which contains only lower case alphabets. How many bits are
required to encode a character such that the size of the document is minimum?
( The document contains all lower case alphabets. Code for each alphabet should be of the same
length )
Published solution
**Step 1 — Count the symbols to represent.** There are 26 lowercase English letters, and every letter must have a distinct code of the same length.
**Step 2 — Relate code length to capacity.** With \(b\) bits, there are \(2^b\) possible bit patterns. We need
\[
2^b\ge26.
\]
**Step 3 — Check the nearest integer lengths.**
\[
2^4=16<26,\qquad2^5=32\ge26.
\]
Four bits are insufficient, while five bits can represent all letters. The minimum fixed length is therefore \(\boxed5\) bits per character.
**Step 1 — Compare the input with the required output.** The input list is 6, 8, 5, 2, 4, while the desired order is 8, 6, 5, 4, 2. This is descending numerical order.
**Step 2 — Choose the Jinja filter.** The sort filter returns a sorted sequence. Setting its reverse argument to True produces the required descending sequence.
**Step 3 — Render one list item per value.** The loop in A iterates over that sorted sequence and creates one li element for each value. The other options either retain the original order, sort ascending or call list.sort, whose return value is None.
**Answer: A.**
A: Correct: sort(reverse=True) returns the required descending sequence.
B: Incorrect: it iterates over the unsorted input list.
C: Incorrect: sort without reverse sorts in ascending order.
D: Incorrect: list.sort mutates the list and returns None, which the loop cannot iterate over.
**Step 1 — Determine the arrangement.** The container uses display: flex. Its default flex direction is row, so boxes 1, 2 and 3 appear next to each other rather than vertically.
**Step 2 — Apply each box's own styling.** Each box has its own blue border and a margin of 5px. Text is centered inside each box. The container has a separate black border enclosing all three.
**Step 3 — Account for the available width.** Flex items can shrink by default, so the given widths do not force wrapping; no flex-wrap rule is present. The result is a horizontal row of three separately bordered boxes with visible spacing.
**Answer: D.**
A: Incorrect: a vertical stack would require a column layout rather than the default flex row.
B: Incorrect: the children remain three separate boxes, each with its own border.
C: Incorrect: it omits the specified spacing around each child.
D: Correct: it shows three spaced, blue-bordered boxes in one row inside the black container.
Which of the following students is classified as "Pass" by the template?
6406537022658.
Alice
6406537022659.
Bob
6406537022660.
Kittu
6406537022661.
Carol
Published solution
**Step 1 — Calculate each average.** The template divides the sum of marks by the number of marks.
Student
Average
First matching condition
Classification
Alice
\((80+90)/2=85\)
Average greater than 75
Distinction
Bob
\((50+40)/2=45\)
Neither threshold is met
Fail
Kittu
\((51+66)/2=58.5\)
Greater than 50, after failing the first test
Pass
Carol
\(100/1=100\)
Average greater than 75
Distinction
**Step 2 — Follow if/elif order.** Only the first matching branch runs. Although Alice and Carol also exceed 50, they already match Distinction and never reach the Pass branch.
**Step 3 — Select the exact classification requested.** Only **Kittu** is classified as Pass.
**Answer: C.**
A: Alice's average 85 selects Distinction before the Pass branch.
B: Bob's average 45 meets neither threshold and selects Fail.
C: Correct: Kittu's average 58.5 selects Pass.
D: Carol's average 100 selects Distinction, not Pass.