-
1
Show your GitHub repository and collaborator.Times asked 16Official solution
SimpleGitHub repo public/private policy ke hisaab, MAD-1 collaborator add, commits dikhao.
Repo → Settings → Collaborators → instructor added.
Commits: git log / GitHub History — regular commits better, ek dum 1 commit suspicious.
README + report mein AI usage likha hona chahiye agar use kiya.Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
2
Confirm GitHub form submission.Times asked 1Official solution
SimpleGitHub repo public/private policy ke hisaab, MAD-1 collaborator add, commits dikhao.
Repo → Settings → Collaborators → instructor added.
Commits: git log / GitHub History — regular commits better, ek dum 1 commit suspicious.
README + report mein AI usage likha hona chahiye agar use kiya.Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
3
Download the project from the Viva Portal or perform checksum.Times asked 5Official solution
SimpleChecksum file ka hash (jaise SHA256) — file change hui ya nahi verify.
Portal pe submitted ZIP ka checksum diya hota hai. Local file ka hash nikaalo, match hona chahiye.
Linux: sha256sum project.zip
Mismatch = galat file / corrupt download. Examiner integrity check karta hai ki tumhari submitted copy hi run ho rahi hai.Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
4
Run the application.Times asked 8Official solution
SimpleExaminer submitted ZIP chahta hai, local extra changes nahi.
Portal se ZIP download → extract → venv → pip install -r requirements.txt → flask run / python app.py.
Checksum maange to hash match karke dikhao. Camera/OPPE setup unke instructions.
Linux/Mac: paths, gunicorn; Windows paths alag ho to relative paths use karo.
Do browsers: admin + user parallel demo impressive lagta hai.Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
5
Demonstrate the complete application.Times asked 33Official solution
SimpleDemo script pehle se practice karo, 5-7 minute, saari roles.
Suggested flow
1) Register/login user 2) Admin login — CRUD 3) Approval/blacklist 4) Booking/apply 5) Search 6) Validation edge (slots 0, duplicate) 7) Logout
Bolte-bolte dikhao: 'Yahan overbooking rokta hoon'. Code tab kholna jab poochhein.
Crash ho to debug calmly: terminal error, typo, DB path.
Mandatory features skip mat karna — examiner list tick karta hai.Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
6
Show all core functionalities.Times asked 5Official solution
SimpleDemo script pehle se practice karo, 5-7 minute, saari roles.
Suggested flow
1) Register/login user 2) Admin login — CRUD 3) Approval/blacklist 4) Booking/apply 5) Search 6) Validation edge (slots 0, duplicate) 7) Logout
Bolte-bolte dikhao: 'Yahan overbooking rokta hoon'. Code tab kholna jab poochhein.
Crash ho to debug calmly: terminal error, typo, DB path.
Mandatory features skip mat karna — examiner list tick karta hai.Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
7
Demonstrate Admin, User/Student, Company/Staff features.Times asked 1Official solution
SimpleDemo script pehle se practice karo, 5-7 minute, saari roles.
Suggested flow
1) Register/login user 2) Admin login — CRUD 3) Approval/blacklist 4) Booking/apply 5) Search 6) Validation edge (slots 0, duplicate) 7) Logout
Bolte-bolte dikhao: 'Yahan overbooking rokta hoon'. Code tab kholna jab poochhein.
Crash ho to debug calmly: terminal error, typo, DB path.
Mandatory features skip mat karna — examiner list tick karta hai.Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
8
Create, update, and delete records (CRUD operations).Times asked 1Official solution
SimpleCRUD = Create, Read, Update, Delete — kisi bhi resource ke 4 basic operations.
Create: POST, db.session.add(new_user); commit() — register, add trek.
Read: GET, User.query.all() — dashboard list.
Update: POST/PUT, user.name = 'Ram'; commit() — edit profile.DeletePOST/DELETE, db.session.delete(obj); commit().
REST mapping: POST create, GET read, PUT/PATCH update, DELETE delete.
Admin panel mein yeh 4 dikhana viva demo ka common task hai.Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
9
Show booking history, summary/dashboard, search, profile update, approval flow, etc.Times asked 1Official solution
Yeh feature demo hai. Account ready rakho, steps bol ke dikhao.
Role ke hisaab login → action (create/approve/book) → DB/UI pe result → edge case (fail when slots=0 / blacklisted).
Do browser windows: admin + user. Search/filter alag se dikhao.
Agar feature nahi hai to sach bolo aur 2 minute mein kaise add karoge (query + template) explain karo.Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
10
Explain any extra features.Times asked 1Official solution
Examiner code pe ungli rakh ke poochta hai — panic mat karo, 4-line formula bolo.
1) Yeh file/line kya role hai (model / route / template / config)?
2) Input kahan se aata hai (form, URL <id>, session, JSON)?
3) DB pe kya query/write?
4) Output kya (render_template / redirect / jsonify)?Example
@app.route('/book/<int:id>', methods=['POST']) — logged-in user session se, trek id URL se, Booking add, slots--, redirect history.Unknown line: imports (request, url_for, flash), decorators, if checks, commit — har keyword ka reason ready rakho.
Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
11
Explain booking/timestamp calculations.Times asked 1Official solution
Examiner code pe ungli rakh ke poochta hai — panic mat karo, 4-line formula bolo.
1) Yeh file/line kya role hai (model / route / template / config)?
2) Input kahan se aata hai (form, URL <id>, session, JSON)?
3) DB pe kya query/write?
4) Output kya (render_template / redirect / jsonify)?Example
@app.route('/book/<int:id>', methods=['POST']) — logged-in user session se, trek id URL se, Booking add, slots--, redirect history.Unknown line: imports (request, url_for, flash), decorators, if checks, commit — har keyword ka reason ready rakho.
Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
12
Explain how treatment details or other project-specific workflows are implemented.Times asked 1Official solution
Examiner code pe ungli rakh ke poochta hai — panic mat karo, 4-line formula bolo.
1) Yeh file/line kya role hai (model / route / template / config)?
2) Input kahan se aata hai (form, URL <id>, session, JSON)?
3) DB pe kya query/write?
4) Output kya (render_template / redirect / jsonify)?Example
@app.route('/book/<int:id>', methods=['POST']) — logged-in user session se, trek id URL se, Booking add, slots--, redirect history.Unknown line: imports (request, url_for, flash), decorators, if checks, commit — har keyword ka reason ready rakho.
Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
13
Demonstrate duplicate application prevention.Times asked 1Official solution
SimpleDuplicate/overbook rokne ke liye DB constraint + route check dono.
Pehle query: Booking.query.filter_by(user_id=uid, trek_id=tid).first()
Agar exists: flash('Already booked'); return
Slots: if trek.available <= 0: reject else trek.available -= 1; commit
Race condition: unique(user_id, trek_id) constraint — do tabs se double click pe bhi ek hi row.
Blacklist: login pe is_blacklisted check.
Active drive limit: if Company ke paas status=open drive hai to naya mat banne do.Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
14
Explain the project organization/architecture.Times asked 1Official solution
Examiner code pe ungli rakh ke poochta hai — panic mat karo, 4-line formula bolo.
1) Yeh file/line kya role hai (model / route / template / config)?
2) Input kahan se aata hai (form, URL <id>, session, JSON)?
3) DB pe kya query/write?
4) Output kya (render_template / redirect / jsonify)?Example
@app.route('/book/<int:id>', methods=['POST']) — logged-in user session se, trek id URL se, Booking add, slots--, redirect history.Unknown line: imports (request, url_for, flash), decorators, if checks, commit — har keyword ka reason ready rakho.
Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
15
Show the main Python file (app.py).Times asked 1Official solution
SimpleRoutes/controllers URLs handle karte hain. app.py app banata hai, models.py data, templates/ views, static/ CSS-JS.
Typical structure:
app.py / __init__.py → Flask app, db.init, register blueprints
models.py → tables
routes.py / views → @app.route functions
templates/ → Jinja HTML
static/ → css, images
instance/*.db → SQLiteEk route explain karne ka template:
1) URL + methods 2) Auth/role check 3) Form/query se data 4) Business rule (duplicate, slots) 5) db.session 6) render ya redirectExample GET+POST same route: GET form, POST save.
Data HTML se: form name= → request.form. Data HTML ko: render_template(..., items=query).
Nayi .py file: import karke use karo, warna Flask ko pata nahi. Folder rename: imports/paths/templates check.Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
16
Show where the database is initialized.Times asked 1Official solution
Yeh feature demo hai. Account ready rakho, steps bol ke dikhao.
Role ke hisaab login → action (create/approve/book) → DB/UI pe result → edge case (fail when slots=0 / blacklisted).
Do browser windows: admin + user. Search/filter alag se dikhao.
Agar feature nahi hai to sach bolo aur 2 minute mein kaise add karoge (query + template) explain karo.Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
17
Explain routes/controllers.Times asked 1Official solution
SimpleRoutes/controllers URLs handle karte hain. app.py app banata hai, models.py data, templates/ views, static/ CSS-JS.
Typical structure:
app.py / __init__.py → Flask app, db.init, register blueprints
models.py → tables
routes.py / views → @app.route functions
templates/ → Jinja HTML
static/ → css, images
instance/*.db → SQLiteEk route explain karne ka template:
1) URL + methods 2) Auth/role check 3) Form/query se data 4) Business rule (duplicate, slots) 5) db.session 6) render ya redirectExample GET+POST same route: GET form, POST save.
Data HTML se: form name= → request.form. Data HTML ko: render_template(..., items=query).
Nayi .py file: import karke use karo, warna Flask ko pata nahi. Folder rename: imports/paths/templates check.Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
18
Explain a specific route.Times asked 2Official solution
SimpleRoutes/controllers URLs handle karte hain. app.py app banata hai, models.py data, templates/ views, static/ CSS-JS.
Typical structure:
app.py / __init__.py → Flask app, db.init, register blueprints
models.py → tables
routes.py / views → @app.route functions
templates/ → Jinja HTML
static/ → css, images
instance/*.db → SQLiteEk route explain karne ka template:
1) URL + methods 2) Auth/role check 3) Form/query se data 4) Business rule (duplicate, slots) 5) db.session 6) render ya redirectExample GET+POST same route: GET form, POST save.
Data HTML se: form name= → request.form. Data HTML ko: render_template(..., items=query).
Nayi .py file: import karke use karo, warna Flask ko pata nahi. Folder rename: imports/paths/templates check.Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
19
Explain imported modules and why they are used (e.g., request, url_for, session, flash, redirect).Times asked 1Official solution
Simpleurl_for sirf URL string banata hai, redirect us URL pe browser ko bhejta hai.
url_for('home') → '/home' (function name se URL nikalta hai)
redirect(url_for('home')) → browser ko /home pe le jaata haiExample
return redirect(url_for('dashboard')) # sahi return redirect('/dashboard') # hardcode, route change pe toot jaayega Agar redirect se url_for hata do to khud path string dena padega: redirect('/dashboard'). Agar url_for('home') ko url_for('home_page') kar do aur home_page naam ka function nahi hai to BuildError aayega.url_for ko function ka naam chahiye, URL path nahi.
SimpleFlask session request-across data store karta hai, generally signed cookie mein.
session['user_id'] = user.id
uid = session.get('user_id')
session.clear() # logoutType: dictionary-like (SecureCookieSession). SECRET_KEY se sign — tamper detect.
Store kahan: default client cookie. Server-side Redis/filesystem bhi laga sakte ho.
Browser storage: cookies, localStorage, sessionStorage. Session cookie tab-close pe jaa sakti hai.
Remember-me: permanent session ya alag token cookie.Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
20
Explain where SQLAlchemy is initialized.Times asked 1Official solution
SimpleSQLAlchemy Python ka sabse popular ORM hai. MAD1 mein Flask-SQLAlchemy wrapper use hota hai.
db = SQLAlchemy(app)
class Book(db.Model): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(80), nullable=False) Operations: db.session.add(obj), .commit(), .delete(obj), Model.query.all(), .filter_by(), .get_or_404(id). db.Model ek class hai (function nahi). db object engine + session + metadata hold karta hai.SQLALCHEMY_TRACK_MODIFICATIONS=False extra signals band karta hai, performance warning hatati hai.
Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
21
Explain where Flask is initialized.Times asked 1Official solution
Simpledb Flask-SQLAlchemy ka object hai. Models db.Model se inherit karti hain, tables db.create_all() se banti hain.
db = SQLAlchemy()
db.init_app(app) # factory patternwith app.app_context(): db.create_all() db.Model SQLAlchemy declarative base (class). Columns se table schema.db properties engine/session/metadata se aati hain, Flask app config (SQLALCHEMY_DATABASE_URI) se bind.
Admin user: create_all sirf tables; admin seed alag function mein (if not User.query.filter_by(role='admin').first(): ...).
Live schema change: Flask-Migrate/Alembic. create_all nayi tables add kare, existing columns alter nahi karta generally.Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
22
Explain code logic for a project-specific feature.Times asked 1Official solution
Examiner code pe ungli rakh ke poochta hai — panic mat karo, 4-line formula bolo.
1) Yeh file/line kya role hai (model / route / template / config)?
2) Input kahan se aata hai (form, URL <id>, session, JSON)?
3) DB pe kya query/write?
4) Output kya (render_template / redirect / jsonify)?Example
@app.route('/book/<int:id>', methods=['POST']) — logged-in user session se, trek id URL se, Booking add, slots--, redirect history.Unknown line: imports (request, url_for, flash), decorators, if checks, commit — har keyword ka reason ready rakho.
Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
23
What is ORM / SQLAlchemy?Times asked 1Official solution
SimpleORM = Object Relational Mapping. Database tables ko Python classes/objects se map karta hai, raw SQL kam likhni padti hai.
Bina ORM: cursor.execute('SELECT * FROM user WHERE id=?', [5])
ORM se: User.query.get(5) ya db.session.get(User, 5)Example model
class User(db.Model): id = db.Column(db.Integer, primary_key=True) email = db.Column(db.String(120), unique=True)FaydePython mein soch sakte ho, SQL injection se protection (parameterized), relationships easy, DB switch thoda aasan.
Nuksaancomplex queries slow/abstract, seekhne ki layer extra, kabhi raw SQL phir bhi chahiye.
MAD1: SQLAlchemy (Flask-SQLAlchemy). Tables db.create_all() ya migrations se banti hain.
Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
24
Explain database schema.Times asked 2Official solution
Simplemodels.py har table ki class hai — columns, PK/FK, relationships. Yeh Model layer hai.
Viva mein file khol ke bolo:
1) Kaunsi classes/tables hain (User, Role-specific, Booking...)
2) Har table ka kaam 1 line
3) Relationships: 1-1 / 1-M / M-M, backref, cascade, lazy
4) Constraints: unique email, nullable, default statusExample skeleton
class User(db.Model): id = db.Column(db.Integer, primary_key=True) email = db.Column(db.String(120), unique=True, nullable=False) role = db.Column(db.String(20), default='user') bookings = db.relationship('Booking', backref='user', cascade='all, delete-orphan')ER diagram: rectangles entities, lines relationships, PK/FK mark. Schema = yahi structure.
Tables create: db.create_all() ya migrations. SQLite file SQL viewer se dikha sakte ho.Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
25
Explain any two database tables.Times asked 1Official solution
Simplemodels.py har table ki class hai — columns, PK/FK, relationships. Yeh Model layer hai.
Viva mein file khol ke bolo:
1) Kaunsi classes/tables hain (User, Role-specific, Booking...)
2) Har table ka kaam 1 line
3) Relationships: 1-1 / 1-M / M-M, backref, cascade, lazy
4) Constraints: unique email, nullable, default statusExample skeleton
class User(db.Model): id = db.Column(db.Integer, primary_key=True) email = db.Column(db.String(120), unique=True, nullable=False) role = db.Column(db.String(20), default='user') bookings = db.relationship('Booking', backref='user', cascade='all, delete-orphan')ER diagram: rectangles entities, lines relationships, PK/FK mark. Schema = yahi structure.
Tables create: db.create_all() ya migrations. SQLite file SQL viewer se dikha sakte ho.Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
26
Explain relationships between tables.Times asked 3Official solution
SimpleRelationships tables ko jodti hain taaki related data object se mil jaaye.
One-to-Many: User → kai Posts. posts = relationship('Post', backref='author'). FK post.user_id.
One-to-One: User → Profile. uselist=False + unique FK. Profile.user_id unique.
Many-to-Many: Student ↔ Drive. Junction/secondary table (student_id, drive_id).Example 1-1:
class Profile(db.Model): user_id = db.Column(db.Integer, db.ForeignKey('user.id'), unique=True) user = db.relationship('User', back_populates='profile', uselist=False)1-M ko 1-1: child FK pe unique=True + uselist=False.
Parent-child: parent PK, child FK. Junction table extra columns bhi rakh sakti hai (applied_on).Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
27
Explain Primary Key and Foreign Key.Times asked 3Official solution
SimplePrimary Key row ki unique ID hai, Foreign Key doosri table ki Primary Key ko point karti hai.
Primary Key: unique + not null. Har table mein hota hai. Example: user.id = 5
Foreign Key: relationship banati hai. post.user_id = 5 matlab yeh post user 5 ki hai.Example
class User(db.Model): id = db.Column(db.Integer, primary_key=True) class Post(db.Model): id = db.Column(db.Integer, primary_key=True) user_id = db.Column(db.Integer, db.ForeignKey('user.id'))FK Primary Key bhi ho sakti hai (1-to-1 profile table). FK unique ho to One-to-One, nahi to One-to-Many.
Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
28
Explain backref.Times asked 5Official solution
Simplebackref relationship ki reverse side automatically bana deta hai.
class Post(db.Model): user_id = db.Column(db.Integer, db.ForeignKey('user.id')) user = db.relationship('User', backref='posts')Ab post.user milta hai, aur user.posts bhi — Post model pe sirf ek line.
secondary Many-to-Many junction table ke liye: relationship(..., secondary=likes_table, backref='liked_by').
Explicit chahiye to back_populates use karo.Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
29
Explain lazy loading.Times asked 3Official solution
Simplelazy loading related objects tab load karta hai jab attribute access karte ho, pehle nahi.
user = User.query.get(1) # posts query nahiuser.posts # ab query
lazy=True / 'select' default. lazy='joined' eager join. lazy='dynamic' query object.
uselist=False One-to-One (single object, list nahi). Hataoge to list mil sakti hai.
Frontend lazy loading images alag cheez hai (viewport mein aaye tab load).Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
30
What frameworks/technologies did you use?Times asked 1Official solution
Definition style question: 1 line simple Hinglish + project example + mini code.
Template'X ka kaam Y hai. Mere project mein Z jagah use hua.'
Example'Session login state rakhta hai. session[user_id]=u.id login pe, logout pe session.clear().'
Agar topic Vue/Celery/Redis ho aur project mein nahi hai to sach bolo, theory example do.
Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
31
Explain any template.Times asked 1Official solution
Examiner code pe ungli rakh ke poochta hai — panic mat karo, 4-line formula bolo.
1) Yeh file/line kya role hai (model / route / template / config)?
2) Input kahan se aata hai (form, URL <id>, session, JSON)?
3) DB pe kya query/write?
4) Output kya (render_template / redirect / jsonify)?Example
@app.route('/book/<int:id>', methods=['POST']) — logged-in user session se, trek id URL se, Booking add, slots--, redirect history.Unknown line: imports (request, url_for, flash), decorators, if checks, commit — har keyword ka reason ready rakho.
Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
32
Where have you used Jinja?Times asked 1Official solution
SimpleJinja2 Flask ka template engine hai. HTML ke andar Python-jaisa data print/loop/if kar sakte ho.
Bina Jinja har user ke liye alag HTML file. Jinja se ek template + data.
{{ user.name }} print, {% for x in items %} loop, {% if %} condition, {% extends %} layout.Example routereturn render_template('dash.html', treks=treks)
dash.html: {% for t in treks %}<li>{{ t.name }}</li>{% endfor %}
HTML files templates/ folder mein isliye kyunki Flask default wahan dhundhta hai. render_template Jinja ko run karta hai.
Boolean Jinja handle karta hai: {% if user.is_admin %}.Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
33
Have you used Template Inheritance? Where?Times asked 1Official solution
Simpleextends poora layout inherit karta hai, include chhota piece insert karta hai.
extends: child page base.html ka structure use karti hai, blocks override karti hai. Ek hi parent.
include: navbar.html / footer.html jahan chaho insert. Kai baar use ho sakta hai.base.html:
{% block content %}{% endblock %} home.html: {% extends 'base.html' %} {% block content %}<h1>Home</h1>{% endblock %} {% include 'navbar.html' %} → navbar har page peFayda: header/footer ek jagah, change once — saari pages update. MAD1 mein almost har project use karta hai.
Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
34
Explain get_or_404().Times asked 1Official solution
SimpleStatus code number batata hai request ka result.
200 OK — success, page/data mil gaya.
201 Created — POST se naya resource.
302/303 Found/See Other — redirect (login ke baad).
304 Not Modified — cache use karo.
400 Bad Request — galat input.
401 Unauthorized — login nahi (ironically authentication missing).
403 Forbidden — login hai, permission nahi.
404 Not Found — route/record nahi.
500 Internal Server Error — server crash (DB error, NoneType). debug=True pe traceback.
501 Not Implemented — method server nahi sambhalta.abort(404) Flask mein. get_or_404(id) record na ho to 404.
User ID GET pe exist na kare to 404 return karo, 500 nahi.Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
35
Explain redirect().Times asked 2Official solution
Simpleredirect browser ko naya URL pe GET karne ko kehta hai (generally 302).
return redirect(url_for('dashboard'))Login/register/delete ke baad use karo taaki refresh duplicate POST na kare.
Doosra page dikhana hai with new request — redirect. Same request pe HTML — render_template.Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
36
Explain session.Times asked 1Official solution
SimpleFlask session request-across data store karta hai, generally signed cookie mein.
session['user_id'] = user.id
uid = session.get('user_id')
session.clear() # logoutType: dictionary-like (SecureCookieSession). SECRET_KEY se sign — tamper detect.
Store kahan: default client cookie. Server-side Redis/filesystem bhi laga sakte ho.
Browser storage: cookies, localStorage, sessionStorage. Session cookie tab-close pe jaa sakti hai.
Remember-me: permanent session ya alag token cookie.Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
37
Explain flash().Times asked 1Official solution
Simpleflash() ek baar dikhne wala message session mein store karta hai — 'Login successful'.
flash('Invalid password', 'danger')
Template
{% with messages = get_flashed_messages(with_categories=True) %}JS se auto-hide bhi kar sakte ho.
SECRET_KEY chahiye kyunki flash session use karta hai.Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
38
Explain url_for().Times asked 2Official solution
Simpleurl_for Flask function/endpoint name se URL generate karta hai, hardcode path nahi.
url_for('home') → '/' url_for('edit_user', id=5) → '/user/5/edit' Templates: href="{{ url_for('login') }}"Parameter: endpoint ka naam (function name), plus route variables.
Galat naam: BuildError. Route rename karo to url_for automatic naya path dega — yahi fayda hai.Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
39
Why do we use render_template()?Times asked 1Official solution
Simplerender_template HTML file ko Jinja se process karke browser ko bhejta hai. Backend data ko frontend se jodta hai.
return render_template('dashboard.html', user=user, treks=treks)File templates/dashboard.html honi chahiye.
Keyword arguments template mein variables ban jaate hain: {{ user.name }}.
Route kuch return na kare to Flask error. Boolean return typical HTML view ke liye nahi — string/Response chahiye.Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
40
How does data move from frontend to backend?Times asked 1Official solution
SimpleFrontend user jo dekhta/click karta hai, Backend server logic + database.
Frontend: HTML, CSS, Bootstrap, Jinja templates, thoda JS. Browser pe chalta hai.
Backend: Flask routes, SQLAlchemy, session, validation. Python server pe.
Data flow: form POST → Flask request.form → DB save → render_template/redirect → HTML dikha.
MAD1 typical stack: Flask + Jinja + SQLAlchemy + SQLite + Bootstrap.Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
41
How does data move from backend to frontend?Times asked 1Official solution
Simple flow: Browser → Route (controller) → Model/DB → phir template (view) → Browser.
Submit example:
1) HTML form POST /register, name='email'
2) register() request.form.get('email')
3) User(email=...) ; db.session.add; commit
4) redirect dashboard
5) dashboard query + render_template
6) Jinja {{ user.email }} / {% for %}GET search: /search?q=flask → request.args.get('q') → filter ilike → template list.
JSON API: jsonify, frontend fetch().Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
42
Are frontend and backend validations implemented?Times asked 1Official solution
SimpleFrontend user jo dekhta/click karta hai, Backend server logic + database.
Frontend: HTML, CSS, Bootstrap, Jinja templates, thoda JS. Browser pe chalta hai.
Backend: Flask routes, SQLAlchemy, session, validation. Python server pe.
Data flow: form POST → Flask request.form → DB save → render_template/redirect → HTML dikha.
MAD1 typical stack: Flask + Jinja + SQLAlchemy + SQLite + Bootstrap.Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
43
Write HTML <form> syntax.Times asked 1Official solution
SimpleForm user input server ko bhejti hai. Table rows/columns dikhati hai.
<form action="{{ url_for('register') }}" method='POST' enctype='multipart/form-data'> <input name='email' required> <button type='submit'>Go</button> </form>name attribute server pe key ban'ti hai: request.form['email']. id JS/CSS, value default/dikhta hua text.
action URL. method GET/POST. enctype file upload pe multipart.
required frontend empty submit rokta hai (backend phir bhi check).<table><thead><tr><th>Name</th></tr></thead><tbody><tr><td>{{ u.name }}</td></tr></tbody></table>th header, td data, tr row. Nested table: td ke andar table (avoid, messy).
method hataoge to GET, password URL mein — buri baat.Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
44
Explain how form submission works.Times asked 1Official solution
Simple flow: Browser → Route (controller) → Model/DB → phir template (view) → Browser.
Submit example:
1) HTML form POST /register, name='email'
2) register() request.form.get('email')
3) User(email=...) ; db.session.add; commit
4) redirect dashboard
5) dashboard query + render_template
6) Jinja {{ user.email }} / {% for %}GET search: /search?q=flask → request.args.get('q') → filter ilike → template list.
JSON API: jsonify, frontend fetch().Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
45
Types of CSS (Inline, Internal, External).Times asked 3Official solution
SimpleCSS 3 tarikon se lagti hai, priority Inline > Internal > External (same specificity pe).
Inline: style='color:red' element pe. Highest priority, lekin reuse nahi. Debugging mushkil.
Internal: <style> tag HTML head mein. Us page tak limited.
External: style.css file. Large project ke liye best — ek jagah change, saari pages update.Example same button pe teeno:
/* external */ .btn { color: blue; }
/* internal */ .btn { color: green; }
<!-- inline --> <button class='btn' style='color:red'> → red jeetegaID (#box) class (.btn) se strong, class element (button) se strong.
!important sabko override karta hai — avoid karo.
Large project: external CSS preferred.Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
46
CSS priority/order of execution.Times asked 1Official solution
SimpleCSS 3 tarikon se lagti hai, priority Inline > Internal > External (same specificity pe).
Inline: style='color:red' element pe. Highest priority, lekin reuse nahi. Debugging mushkil.
Internal: <style> tag HTML head mein. Us page tak limited.
External: style.css file. Large project ke liye best — ek jagah change, saari pages update.Example same button pe teeno:
/* external */ .btn { color: blue; }
/* internal */ .btn { color: green; }
<!-- inline --> <button class='btn' style='color:red'> → red jeetegaID (#box) class (.btn) se strong, class element (button) se strong.
!important sabko override karta hai — avoid karo.
Large project: external CSS preferred.Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
47
Write a Jinja for loop.Times asked 9Official solution
Simple Jinja loop + if — examiner notepad mein likhwaata hai:
{% for t in treks %} <p>{{ t.name }} — {{ t.location }}</p> {% else %} <p>No treks</p> {% endfor %} {% if user.role == 'admin' %} <button>Delete</button> {% endif %}List filter: {% if x > 10 %}{{ x }}{% endif %}
Length: {{ items|length }} Upper: {{ name|upper }}
Table: loop ke andar <tr><td>Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
48
Write a Jinja if-else statement.Times asked 1Official solution
Simple Jinja loop + if — examiner notepad mein likhwaata hai:
{% for t in treks %} <p>{{ t.name }} — {{ t.location }}</p> {% else %} <p>No treks</p> {% endfor %} {% if user.role == 'admin' %} <button>Delete</button> {% endif %}List filter: {% if x > 10 %}{{ x }}{% endif %}
Length: {{ items|length }} Upper: {{ name|upper }}
Table: loop ke andar <tr><td>Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
49
Explain HTTP status/error codes (e.g., 500 Internal Server Error, 301, 303 See Other).Times asked 1Official solution
SimpleStatus code number batata hai request ka result.
200 OK — success, page/data mil gaya.
201 Created — POST se naya resource.
302/303 Found/See Other — redirect (login ke baad).
304 Not Modified — cache use karo.
400 Bad Request — galat input.
401 Unauthorized — login nahi (ironically authentication missing).
403 Forbidden — login hai, permission nahi.
404 Not Found — route/record nahi.
500 Internal Server Error — server crash (DB error, NoneType). debug=True pe traceback.
501 Not Implemented — method server nahi sambhalta.abort(404) Flask mein. get_or_404(id) record na ho to 404.
User ID GET pe exist na kare to 404 return karo, 500 nahi.Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
50
What error code is returned for a database/server issue?Times asked 1Official solution
SimpleStatus code number batata hai request ka result.
200 OK — success, page/data mil gaya.
201 Created — POST se naya resource.
302/303 Found/See Other — redirect (login ke baad).
304 Not Modified — cache use karo.
400 Bad Request — galat input.
401 Unauthorized — login nahi (ironically authentication missing).
403 Forbidden — login hai, permission nahi.
404 Not Found — route/record nahi.
500 Internal Server Error — server crash (DB error, NoneType). debug=True pe traceback.
501 Not Implemented — method server nahi sambhalta.abort(404) Flask mein. get_or_404(id) record na ho to 404.
User ID GET pe exist na kare to 404 return karo, 500 nahi.Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
51
Write a simple Flask route.Times asked 3Official solution
Simple Hello World — notepad mein yeh likh ke run karke dikhao:
from flask import Flask app = Flask(__name__) @app.route('/') def home(): return 'Hello World' if __name__ == '__main__': app.run(debug=True) Jinja version: return render_template('hello.html', name='Shubham')hello.html: <h1>Hello {{ name }}</h1>
POST-only: @app.route('/x', methods=['POST'])Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
52
Write a route that returns Hello World.Times asked 1Official solution
Simple Hello World — notepad mein yeh likh ke run karke dikhao:
from flask import Flask app = Flask(__name__) @app.route('/') def home(): return 'Hello World' if __name__ == '__main__': app.run(debug=True) Jinja version: return render_template('hello.html', name='Shubham')hello.html: <h1>Hello {{ name }}</h1>
POST-only: @app.route('/x', methods=['POST'])Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
53
Write a route that returns the square of a number.Times asked 1Official solution
SimpleURL parameters se numbers lo, calculate karke return/render.
@app.route('/sum/<int:a>/<int:b>') def add(a, b): return f'Hello, sum is {a+b}'Product: a*b. Square: n*n. Even/odd: 'even' if n%2==0 else 'odd'.
Form se: request.form.get('a', type=int). Background color even/odd:
color = 'green' if n%2==0 else 'red'return render_template('page.html', color=color)CSS: body { background: {{ color }}; }
Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
54
Write a route with URL parameters (e.g., ID).Times asked 1Official solution
Simple<int:id> URL se integer nikalta hai. Alternatives: query string, POST form, slug string.
@app.route('/user/<int:id>') # /user/5 @app.route('/user/<string:name>')request.args.get('id') # /user?id=5
request.form.get('id') # hidden field
int converter galat 'abc' pe 404 — yeh protection hai.Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
55
Write a route that accepts input from an HTML form and displays it.Times asked 1Official solution
Patternfilter query → template/JSON. Examiner jo entity bole us class ka naam use karo.
@app.route('/admin/blacklisted') def blacklisted(): rows = User.query.filter_by(is_blacklisted=True).all() return render_template('list.html', rows=rows) JSON: return jsonify([{'id': r.id, 'name': r.name} for r in rows]) ID se: User.query.get_or_404(id) Do filters: .filter(Drive.approved==False, Drive.title=='Data Scientist')Join example: students jinhone blacklisted company ke drive pe apply kiya — join Application-Drive-Company.
PUT@app.route('/x/<int:id>', methods=['PUT']) + request.get_json()
url param display: @app.route('/show/<int:id>') return render_template('show.html', id=id)
Form → next page: POST values render_template('out.html', **request.form)
Count: return str(User.query.filter_by(is_blacklisted=True).count())Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
56
Write a route that renders a list in a template using Jinja.Times asked 1Official solution
Patternfilter query → template/JSON. Examiner jo entity bole us class ka naam use karo.
@app.route('/admin/blacklisted') def blacklisted(): rows = User.query.filter_by(is_blacklisted=True).all() return render_template('list.html', rows=rows) JSON: return jsonify([{'id': r.id, 'name': r.name} for r in rows]) ID se: User.query.get_or_404(id) Do filters: .filter(Drive.approved==False, Drive.title=='Data Scientist')Join example: students jinhone blacklisted company ke drive pe apply kiya — join Application-Drive-Company.
PUT@app.route('/x/<int:id>', methods=['PUT']) + request.get_json()
url param display: @app.route('/show/<int:id>') return render_template('show.html', id=id)
Form → next page: POST values render_template('out.html', **request.form)
Count: return str(User.query.filter_by(is_blacklisted=True).count())Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
57
Write a route that passes data to a template using render_template().Times asked 1Official solution
Simplerender_template HTML file ko Jinja se process karke browser ko bhejta hai. Backend data ko frontend se jodta hai.
return render_template('dashboard.html', user=user, treks=treks)File templates/dashboard.html honi chahiye.
Keyword arguments template mein variables ban jaate hain: {{ user.name }}.
Route kuch return na kare to Flask error. Boolean return typical HTML view ke liye nahi — string/Response chahiye.Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
58
Change the page background/UI.Times asked 1Official solution
Yeh live UI/CSS change hai. Examiner jo element bole uski CSS turant badlo.
Bootstrap class badlo (btn-primary → btn-success, bg-dark → bg-warning) ya inline style='color:red; background:#eee'.
Center: d-flex justify-content-center text-center. Navbar neeche: navbar fixed-bottom.Example
<button class='btn btn-success' style='background:#16a34a'>Book</button>Pehle browser inspect karke class dhundo, phir template mein change karke refresh.
Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
59
Write a route to retrieve a record from the database using an ID.Times asked 1Official solution
Patternfilter query → template/JSON. Examiner jo entity bole us class ka naam use karo.
@app.route('/admin/blacklisted') def blacklisted(): rows = User.query.filter_by(is_blacklisted=True).all() return render_template('list.html', rows=rows) JSON: return jsonify([{'id': r.id, 'name': r.name} for r in rows]) ID se: User.query.get_or_404(id) Do filters: .filter(Drive.approved==False, Drive.title=='Data Scientist')Join example: students jinhone blacklisted company ke drive pe apply kiya — join Application-Drive-Company.
PUT@app.route('/x/<int:id>', methods=['PUT']) + request.get_json()
url param display: @app.route('/show/<int:id>') return render_template('show.html', id=id)
Form → next page: POST values render_template('out.html', **request.form)
Count: return str(User.query.filter_by(is_blacklisted=True).count())Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
60
How are User, Admin, Doctor/Staff roles separated in the application?Times asked 1Official solution
SimpleRBAC = Role-Based Access Control — permission role se (admin/staff/user), har user pe alag nahi.
user.role = 'admin'
if current_user.role != 'admin': abort(403)Same login page, role ke hisaab dashboard. Multiple roles: roles table Many-to-Many, ya comma field (behtar normalized table).
Unapproved staff: is_approved flag, login pe check.
Flask-Security/UserMixin is_authenticated, is_active, get_id dete hain.Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
61
What is datetime used for?Times asked 1Official solution
Simple mix of small concepts examiners poochte hain:
Enum: fixed choices (status = pending/approved). Python Enum ya DB Enum column.
Lambda: one-line anonymous function. key=lambda x: x.name sort ke liye.
datetime: dates/times. timedelta(days=1) yesterday. default=datetime.utcnow.
os.getenv('SECRET_KEY') environment se config, hardcode nahi. .env alternative: actual OS env, config.py, vault.
HTML metadata: <meta charset>, <meta name='viewport'> — page ke baare mein, body content nahi.
HTTP metadata: headers (Content-Type, Set-Cookie).
Request payload: body data (JSON/form).
Namespace: naam collide na hon (Blueprint name, Python packages).
Plugins: extra packages (Flask-Login). Package vs module: package folder with __init__, module ek .py file.Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
62
Where is request used and why?Times asked 1Official solution
Definition style question: 1 line simple Hinglish + project example + mini code.
Template'X ka kaam Y hai. Mere project mein Z jagah use hua.'
Example'Session login state rakhta hai. session[user_id]=u.id login pe, logout pe session.clear().'
Agar topic Vue/Celery/Redis ho aur project mein nahi hai to sach bolo, theory example do.
Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet