MauryaHub PYQ Practice

Application Development - 1 · Quiz 2 · May 2025

Application Development - 1 · Quiz 2 · May 2025

← Course papers · Start practice / exam

Questions and published explanations below are available without starting a test. Some questions may not have a published solution yet.

13 / 16 published solutions

Question 36 MCQ · 2.0 marks

You manage a datacenter where each server has a 10 Gigabit per second network connection and the facility’s backbone link is also 10 Gbps. Your application is handling 10,000 requests per second, each with a 50 KB response, which translates to about 4 Gbps of required throughput. So, if each request involves minimal CPU processing, and the existing server has sufficient resources to handle the load. Which of the following scaling strategies is most appropriate to meet this demand?
6406534434897.
Scale up on a single server
6406534434898.
Scale out to multiple servers in the datacenter
6406534434899.
Both will produce similar results
6406534434900.
None of these

A published solution is not available for this question yet.

Report a correction for Q36

Question 37 MCQ · 2.0 marks

Which of the following statements **BEST** describes a key advantage of Jinja2 server-side rendering over JavaScript/JSON-based client-side rendering?
6406534434901.
It guarantees that dynamic updates on user interactions never require additional data fetches.
6406534434902.
It provides faster initial page load and improved Search Engine Optimization without requiring client-side template logic.
6406534434903.
It allows the client to handle all template rendering, reducing load on the server.
6406534434904.
None of these

Published solution

**1. Identify what the browser receives:** Jinja renders the template on the server and sends populated HTML. The browser can display the initial content without first downloading and executing a client-side template/data-rendering pipeline. **2. Connect this to discoverability and first content:** Rendered HTML exposes content directly to crawlers and can improve initial content display relative to a JavaScript-only shell. These are the intended benefits in B. **3. Avoid universal guarantees:** SSR can still need later requests for interactive updates, and rendering happens on the server rather than being delegated entirely to the client. **Answer: B — faster initial content and improved SEO without client-side template logic.** **Convention note:** Actual load speed depends on implementation, server time and caching. SSR can improve initial rendering; it does not guarantee lower latency in every application, and modern search engines can also process many JavaScript-rendered pages. A: **Incorrect:** Dynamic interactions can still need additional data fetches; SSR does not guarantee otherwise. B: **Correct:** Populated initial HTML can improve initial content display and search discoverability without client template logic. C: **Incorrect:** This describes client-side rather than Jinja server-side rendering. D: **Incorrect:** B correctly describes the intended advantage.

Report a correction for Q37

Question 38 MCQ · 2.0 marks

Source diagram or notation
6406534434905.Source diagram or notation
6406534434906.Source diagram or notation
6406534434907.Source diagram or notation
6406534434908.Source diagram or notation

Published solution

**1. Request a database aggregate:** func.max(ExamScores.score) constructs SQL MAX(score), whose result for 57,98,83 is 98. The aggregate expression must be passed into a query. **2. Execute and extract the scalar:** db.session.query(func.max(ExamScores.score)).scalar() executes the aggregate query and returns its first scalar value, 98. Wrapping that in print outputs the number. **3. Distinguish constructing a query from fetching it:** Printing a Query object without .scalar() prints its SQL representation rather than the maximum score. db.session.query is a method and has no .max attribute; scalar also belongs to the query, not the mapped score column. **Answer: B — print(db.session.query(func.max(ExamScores.score)).scalar()), which prints 98.** A: **Incorrect:** db.session.query is a method, not an object with a max aggregate method. B: **Correct:** The SQL aggregate is executed and its value 98 is extracted. C: **Incorrect:** This prints the constructed query representation rather than executing it to obtain the value. D: **Incorrect:** query.max is invalid, and scalar() is not an operation on the score column.

Report a correction for Q38

Question 39 MCQ · 2.0 marks

What is the right syntax to use an external JavaScript file(.js) into the current html file?
6406534434909.Source diagram or notation
6406534434910.Source diagram or notation
6406534434911.Source diagram or notation
6406534434912.Source diagram or notation

Published solution

**1. Choose the correct HTML element and attribute:** An external JavaScript resource is loaded by a script element whose src attribute identifies the .js file. The shown valid form has script src="jsfile.js" followed by the matching closing script tag. **2. Distinguish other mechanisms:** href is not the external-source attribute for script. An import element is not the standard way to load a JavaScript file in HTML; JavaScript module import is separate language syntax. **Answer: A — a script element with src="jsfile.js" and a closing script tag.** A: **Correct:** A script element with src and its closing tag is the correct form. B: **Incorrect:** A script element needs src rather than href to identify external JavaScript. C: **Incorrect:** HTML does not define this import-element mechanism for loading JavaScript. D: **Incorrect:** Neither an import element nor its link attribute provides the required script loading.

Report a correction for Q39

Question 40 MCQ · 3.0 marks

Source diagram or notation
6406534434913.Source diagram or notation
6406534434914.Source diagram or notation
6406534434915.Source diagram or notation
6406534434916.Source diagram or notation

Published solution

**1. Read the route’s path order:** The registered path is /text/size/<int:size>/<color>. The first dynamic segment must be an integer size; the next supplies the color string. **2. Supply the required values:** /text/size/20/red binds size=20 and color="red". The view constructs font-size="20px" and color="red", passes them as css_style, and the template places them into the element’s inline style. **3. Reject query-string substitutes and reversed segments:** Query parameters do not replace required path segments. The reversed /text/size/red/20 cannot match the integer converter because red is not an integer. **Answer: D — http://127.0.0.1:5000/text/size/20/red.** A: **Incorrect:** The required dynamic path is absent; these query parameters do not match the route. B: **Incorrect:** Changing query-parameter order still does not provide the required route path. C: **Incorrect:** red occupies the integer-size position and fails route matching. D: **Correct:** 20 is accepted by the integer converter and red supplies the intended color.

Report a correction for Q40

Question 41 MCQ · 3.0 marks

Source diagram or notation
6406534434917.
10
6406534434918.
9
6406534434919.
3
6406534434920.
4

Published solution

**1. Apply the decorator binding:** @calculate is equivalent to replacing foo with calculate(original_foo). The returned wrapper receives the later call’s arguments 5 and 2. **2. Evaluate the wrapped function:** wrapper calls the original subtraction function, giving \(x=5-2=3\). **3. Apply the wrapper’s transformation:** It returns \(x^2=3^2=9\). Therefore print(foo(5,2)) displays 9 rather than the undecorated result 3. **Answer: B — 9.** A: **Incorrect:** The original function subtracts rather than multiplies its two arguments. B: **Correct:** The difference 3 is squared by the decorator, producing 9. C: **Incorrect:** 3 is the intermediate undecorated result, before the wrapper squares it. D: **Incorrect:** 4 is the square of the second argument, not the returned difference.

Report a correction for Q41

Question 42 MCQ · 3.0 marks

Source diagram or notation
6406534434921.Source diagram or notation
6406534434922.Source diagram or notation
6406534434923.Source diagram or notation
6406534434924.Source diagram or notation

Published solution

**1. List the required placeholders:** The Template string contains $lang, $desc and $useful. substitute requires values for every referenced name. **2. Check the incomplete strict substitution:** Option A supplies only lang. Substitution reaches the missing desc placeholder and raises KeyError; useful is also missing but is not reached first. **3. Compare safe_substitute:** Both safe_substitute choices preserve any unknown placeholders literally rather than raising a KeyError for those absent mapping entries. The complete substitute mapping in B supplies all three names. **Answer: A — template.substitute({"lang":"Python"}) raises KeyError.** A: **Correct:** Strict substitute raises KeyError for missing desc. B: **Incorrect:** All three placeholder values are supplied, so substitution succeeds. C: **Incorrect:** safe_substitute leaves $desc and $useful in the text rather than raising for their absence. D: **Incorrect:** safe_substitute replaces lang and desc while leaving $useful unchanged.

Report a correction for Q42

Question 43 MCQ · 3.0 marks

Source diagram or notation
6406534434925.
You are authorized!!
6406534434926.
You are unauthorized!!
6406534434927.
Not Found
6406534434928.
Internal Server Error

Published solution

**1. Parse the supplied request:** /signin?uid=professor&pwd=54321 matches the signin view and provides both required query parameters. The professor credentials do appear in the second valid_users entry. **2. Follow the actual loop indentation:** The first iteration compares against student/12345. That comparison fails, and the else belongs to the if inside the loop, so the function immediately returns You are unauthorized!!. **3. Explain why the later match is never checked:** return exits the entire function, not just the current iteration. The professor entry is therefore never reached. To check every account before rejecting, the unauthorized return would need to occur after the loop. **Answer: B — You are unauthorized!!.** A: **Incorrect:** Although the credentials match a later entry, the function returns during the first failed iteration. B: **Correct:** The first student comparison fails and immediately executes this return. C: **Incorrect:** The signin route exists and is correctly matched. D: **Incorrect:** Both request parameters are present; this execution returns a normal string instead of raising.

Report a correction for Q43

Question 44 MCQ · 4.5 marks

Source diagram or notation
Source diagram or notation
6406534434929.
Greet4
6406534434930.
Greet3
6406534434931.
Greet2
6406534434932.
Greet1

Published solution

**1. Match each event handler to its output destination:** Greet1 calls alert, which opens a browser dialog. Greet2 calls console.log, Greet3 calls document.write, and Greet4 calls console.error. **2. Select the dialog-producing handler:** Only alert("Hello, welcome") displays the greeting in a dialog box, so the requested button is Greet1. Console output and document output are different destinations. **Answer: D — Greet1.** A: **Incorrect:** console.error writes to the developer console, not a dialog. B: **Incorrect:** document.write writes into the document stream rather than opening a dialog. C: **Incorrect:** console.log writes to the developer console. D: **Correct:** alert opens the greeting dialog.

Report a correction for Q44

Question 45 MCQ · 4.5 marks

Source diagram or notation
6406534434933.Source diagram or notation
6406534434934.Source diagram or notation
6406534434935.Source diagram or notation
6406534434936.Source diagram or notation

A published solution is not available for this question yet.

Report a correction for Q45

Question 46 MSQ · 3.0 marks

Which of the following statements is/are **false** about caching in REST APIs?
6406534434937.
Caching allows storing server responses in a proxy or frontend so that a client need not make requests to the server for the same resources repeatedly.
6406534434938.
Caching **degrades** the overall quality of service and **increases** load on the servers.
6406534434939.
Browsers treat all GET and POST requests cacheable by default.
6406534434940.
Caching optimizes the network by increasing the latency.

Published solution

**1. Recall the intended benefit of caching:** A reusable response can be served from a browser or intermediary cache, avoiding a repeated origin-server request while freshness and validation rules permit. This typically lowers origin load and improves response time. **2. Evaluate the performance claims:** B claims caching degrades service and increases server load; D claims it optimizes by increasing latency. These reverse the intended benefits, so they are false statements and must be selected. **3. Evaluate the method claim:** Browsers do not treat every GET and POST response as cacheable by default. Response directives, status and other conditions matter; POST reuse requires explicitly appropriate caching semantics and is not a blanket default. Thus C is also false. **Answer: B, C, D — B, C and D are false.** **Convention note:** Caching is conditional: Cache-Control, freshness, authentication/privacy rules and validation can restrict or prevent reuse. A bad cache policy can serve stale content, but that is not the general performance property asserted by the false options. A: **Incorrect:** This is a true description of response reuse, so do not select it as false. B: **Correct:** Select: appropriate caching generally reduces, rather than increases, repeated origin work. C: **Correct:** Select: blanket default cacheability for every GET and POST is false. D: **Correct:** Select: reducing latency is the intended optimization, not increasing it.

Report a correction for Q46

Question 47 MSQ · 3.0 marks

Which of the following is/are correct with respect to storing data in graphs?
6406534434941.
Data on social networks can be stored with the help of graphs.
6406534434942.
Graphs support storing attributes such as node degree, edge weights ,and other metadata.
6406534434943.
Data is stored as a key-value pair.
6406534434944.
In graphs, path finding is not as important as just searching the data.

Published solution

**1. Describe the graph data model:** Nodes represent entities, edges represent relationships, and properties can attach metadata to either. A social graph naturally uses people/accounts as nodes and follows/friendship links as edges. **2. Check metadata and traversal:** Edge weights, labels and other properties can be stored; a node’s degree can be computed or maintained as metadata. Traversal and path-finding are central graph operations because relationships are part of the stored information. **3. Distinguish another database model:** Saying the data is stored merely as key–value pairs describes a different logical model. Graph engines may internally use key–value structures or key–value properties, but their defining user-facing structure is vertices and relationships. **Answer: A, B — social-network data can use graphs, and graphs support attributes/metadata.** A: **Correct:** Relationships in social networks have a natural graph representation. B: **Correct:** Graphs can carry weights, degree-related information and additional metadata. C: **Incorrect:** As a description of the logical database model, this confuses graphs with a key–value store. D: **Incorrect:** Path queries and traversal are important graph capabilities; their relevance is application-dependent, not generally secondary.

Report a correction for Q47

Question 48 MSQ · 4.5 marks

Source diagram or notation
6406534434945.Source diagram or notation
6406534434946.Source diagram or notation
6406534434947.Source diagram or notation
6406534434948.Source diagram or notation
6406534434949.Source diagram or notation

Published solution

**1. Follow the API’s supported operators:** The POST method reads JSON fields val1,val2,operator, converts the two values to integers, and recognizes only +, − and *. For inputs 27 and 3, it returns \(27+3=30\), \(27-3=24\) or \(27\cdot3=81\). **2. Check the successful requests:** A sends JSON with +, B with *, and E with −. All three provide Content-Type: application/json and receive their calculated result with HTTP 200. **3. Reject division and the missing JSON media type:** C supplies /, which reaches the explicit invalid-option branch and returns an error, not a calculation. D also requests unsupported division and omits the JSON content type, so request.json can fail before the operator branch. **Answer: A, B, E — A, B and E.** **Convention note:** The prompt explicitly asks us to treat the shell-supplied data as valid; quoting differences among cmd/PowerShell are therefore outside this question. The exact error status for an undeclared JSON payload depends on Flask version (current versions commonly use 415), but it does not yield the requested calculation. A: **Correct:** This gives the supported addition operation and returns Sum=30. B: **Correct:** This gives multiplication and returns Product=81. C: **Incorrect:** Division is unsupported and reaches the Error: Invalid option response with status 401. D: **Incorrect:** The payload is not declared JSON, and division is unsupported anyway. E: **Correct:** This gives subtraction and returns Difference=24.

Report a correction for Q48

Question 49 NAT · 3.0 marks

Source diagram or notation

Published solution

**1. Count the original alphabet:** L1 contains eight symbols x,y,z,w,v,u,t,s. A fixed-width code needs \(\lceil\log_2 8\rceil=3\) bits per character, so 2000 characters occupy 6000 bits. **2. Count the expanded alphabet:** Adding five distinct digits 1,2,3,4,5 increases the alphabet to 13 symbols. It now needs \(\lceil\log_2 13\rceil=4\) bits per character, because 3 bits encode only 8 symbols and 4 bits encode 16. **3. Compute the document’s size increase:** The new fixed-width size is 8000 bits, an increase of \(2000(4-3)=2000\) bits. **Answer: 2000.** **Convention note:** The answer uses the intended optimal fixed-width per-character representation. Variable-length entropy coding would require symbol frequencies and does not necessarily expand an unchanged document simply because additional unused symbols are available.

Report a correction for Q49

Question 50 MSQ · 4.5 marks

Source diagram or notationSource diagram or notation
6406534434951.Source diagram or notation
6406534434952.Source diagram or notation
6406534434953.Source diagram or notation
6406534434954.Source diagram or notation

Published solution

**1. Use the model’s Python date values:** Querying GlassRepair objects materializes broken_at and fixed_at as datetime.date objects. Subtracting two such dates gives a datetime.timedelta, whose .days attribute is the desired integer day count. **2. Compare the two valid approaches:** A uses a list comprehension over GlassRepair.query.all(). B uses db.session.query(GlassRepair).all(), then computes the same subtraction in a loop and appends (id,delta.days). Both produce the requested list of pairs. **3. Reject the malformed alternatives:** C treats GlassRepair.query, already a Query object, as a callable function with column arguments. D passes an existing timedelta as the days= argument of a new timedelta, but that argument must be a numeric count. **Answer: A, B — A and B.** **Convention note:** Both shown date columns are non-null, so the stated rows permit the Python subtraction without an extra missing-date guard. Moving date arithmetic into SQL is backend-dependent and should not be assumed equivalent without checking its date operators. A: **Correct:** Python date subtraction followed by .days computes the intended elapsed-day integer. B: **Correct:** The loop performs the same correct Python date arithmetic and builds the same pair list. C: **Incorrect:** GlassRepair.query is a Query object, not the db.session.query(...) callable used for selecting expressions. D: **Incorrect:** r.fixed_at−r.broken_at is already a timedelta and cannot be supplied as the numeric days= constructor argument.

Report a correction for Q50

Question 51 MSQ · 3.0 marks

Source diagram or notationSource diagram or notation
6406534434955.Source diagram or notation
6406534434956.Source diagram or notation
6406534434957.Source diagram or notation
6406534434958.Source diagram or notation
      **MLF** **Section Id :** 64065394377 **Section Number :** 4 **Section type :** Online **Mandatory or Optional :** Mandatory **Number of Questions :** 12 **Number of Questions to be attempted :** 12 **Section Marks :** 40 **Display Number Panel :** Yes **Section Negative Marks :** 0 **Group All Questions :** No **Enable Mark as Answered Mark for Review and** No **Clear Response :** **Section Maximum Duration :** 0 **Section Minimum Duration :** 0 **Section Time In :** Minutes **Maximum Instruction Time :** 0

A published solution is not available for this question yet.

Report a correction for Q51