Viva prep · Real questions · Student experiences Enroll in Bootcamp

Proctor workspace

Proctor Proctor 800

Share your experience Add your viva experience here
59 Questions
5 Sets
0 Topics
5 Reviews
Tips for this examiner: She was very good. Came on time, and clarified everything properly. I realized i messed up in a few places like forgetting a .all() for the query, but she said i gave a good viva.

Student reviews

Saurav MAD1

She helps very much , just don't get nervouse , take time and explain

Questions remembered
  1. show id, download project and run. Html code to display it using jinja loop. Create /login route which receives the email, password from a html form. now write a sqlalchemy query to get all the users from your database who got blacklisted. What is ORM. What is render template and redirect.
Magic MAD1

She helps very much , just don't get nervouse , take time and explain

Questions remembered
  1. Id card, GitHub, download code
  2. Checks everything thoroughly
  3. Code :
  4. Write a route to get the trek name and date and display it elsewhere.
  5. Html code to display it using jinja loop
  6. Sql query for getting open treks
  7. Theory:
  8. Statelessness of HTTP
  9. Button name for red button in bootstrap
  10. Render template and redirect - difference
Purab MAD1

Very nice proctor. Very polite, patient and helpful. Just be honest with your code with her and she'll help you pass your viva.

Questions remembered
  1. - Show ID Card (Softycopy works)
  2. - Show GIT and Collaboration
  3. - Download from portal or perform checksum. I chose portal.
  4. - Show working of the application. Very detailed check. She made me click almost every button of the app, went through almost each and every feature.
  5. - Asked to show app.py file and then asked what few lines of code in it meant. I did the project myself so I answered every question nicely.
  6. - Asked to show models.py file.
  7. - Aked about constrains/validations if I have used any in front-end/back-end .
  8. Theory Questions:
  9. - What is ORM
  10. - Priority in inline, internal and external css
  11. - Priority in class vs ID
  12. Coding questions:
  13. - Open notepad and make a route that takes trek details and prints it in another page
  14. - Jinja for loop
  15. - How does jinja connects with html? (code)
  16. Viva lasted for 30 mins approximately. Proctor was really helpful. She helped me in between wherever I got stuck in coding. Really patient.
Fellow MAD1

Stay calm

Questions remembered
  1. Proctor 800
  2. She is so calm and patient.
  3. I was so nervous .
  4. Ask me to create form and takes input
  5. , jinja for loop
  6. Enum,
  7. Check all core functionality,
  8. Check GitHub,id,
  9. Ask me to add max slots is 30,
  10. GEt and post method
  11. Secret key, template inheritance,
Princess MAD1

She was very good. Came on time, and clarified everything properly. I realized i messed up in a few places like forgetting a .all() for the query, but she said i gave a good viva.

Questions remembered
  1. - Show ID, github, collaborator added
  2. - Download project from portal, no checksum
  3. - She asked to login to admin dashboard. Add a trek
  4. - She asked to register a staff
  5. - She asked to approve the staff and update the status to open and slot
  6. - She asked to login as a trekker. Book a trek. Edit profile, check booking history.
  7. - She asked to cancel a booking from admin dashboard, and also show search functionality for admin and user
  8. - She checked the app.py and asked about blueprints
  9. - Checked models, and asked why i had to override a property/function
  10. Coding:
  11. - A route to input email and password and display on another page
  12. - Jinja code to display the email
  13. - SQL query for treks with open status
  14. Then she asked about statelessness of HTTP

Approved viva sets

  1. 1
    Id card, GitHub, download code
    Times asked 1
    Official solution

    SimpleCamera pe clearly college/IITM ID dikhao — naam aur photo match hone chahiye.

    Viva tipPehle se ID haath mein rakho, glare mat aane do. Iske baad GitHub + project run.

  2. 2
    Checks everything thoroughly
    Times asked 1
    Official solution

    SimpleViva wrap-up hai. Short thanks + confirm submission ZIP latest hai.

  3. 3
    Write a route to get the trek name and date and display it elsewhere.
    Times asked 1
    Official solution

    SimpleLive Flask coding: chhota route likho, save, browser/curl se test. Syntax error terminal mein padho.

    Example

    @app.route('/ping')
    def ping():
        return jsonify(ok=True)
    
    @app.route('/even/<int:n>')
    def even(n):
        return 'even' if n % 2 == 0 else 'odd'
  4. 4
    Html code to display it using jinja loop
    Times asked 1
    Official solution

    SimpleJinja for loop list render karta hai. loop.index, else branch empty list pe.

    Example

    {% for u in users %}
      <tr><td>{{ loop.index }}</td><td>{{ u.email }}</td></tr>
    {% endfor %}
  5. 5
    Sql query for getting open treks
    Times asked 1
    Official solution

    SimpleProject overview: problem → roles → main entities → key flows (register, book, admin approve).

    Viva tip1 minute elevator pitch ready rakho, phir demo.

  6. 6
    Button name for red button in bootstrap
    Times asked 1
    Official solution

    SimpleBootstrap CSS framework — grid, navbar, buttons jaldi. CDN ya downloaded files.

Advice: She helps very much , just don't get nervouse , take time and explain
  1. 1
    - Show GIT and Collaboration
    Times asked 1
    Official solution

    SimpleGitHub repo open karo: commits, collaborators, README. Examiner check karta hai tumne khud kaam kiya.

    Example

    Settings → Collaborators
    Commits: regular messages, last-day dump nahi.

    Viva tipPrivate repo access pehle de do. Main branch submitted ZIP se match honi chahiye.

  2. 2
    - Download from portal or perform checksum. I chose portal.
    Times asked 1
    Official solution

    SimpleExaminer portal wala submitted ZIP chahta hai. Local extra changes mat dikhana.

    Suggested flow1) Portal ZIP download
    2) Extract
    3) venv + pip install -r requirements.txt
    4) flask run / python app.py

  3. 3
    - Show working of the application. Very detailed check. She made me click almost every button of the app, went through almost each and every feature.
    Times asked 1
    Official solution

    SimpleDemo script pehle se practice: 5–7 min, Admin + User roles, saare mandatory features.

    Suggested flow1) Register/login user
    2) Admin login — CRUD
    3) Approval/blacklist
    4) Booking/apply + edge case
    5) Search
    6) Logout

    Viva tipBolte-bolte dikhao. Code tab kholna jab poochhein.

  4. 4
    - Asked to show app.py file and then asked what few lines of code in it meant. I did the project myself so I answered every question nicely.
    Times asked 1
    Official solution

    SimpleDemo script pehle se practice: 5–7 min, Admin + User roles, saare mandatory features.

    Suggested flow1) Register/login user
    2) Admin login — CRUD
    3) Approval/blacklist
    4) Booking/apply + edge case
    5) Search
    6) Logout

    Viva tipBolte-bolte dikhao. Code tab kholna jab poochhein.

  5. 5
    - Asked to show models.py file.
    Times asked 1
    Official solution

    Simplemodels.py = har table ki class: columns, PK/FK, relationships. Yeh Model layer hai.

    Suggested flow1) Classes list karo
    2) Har table ka kaam 1 line
    3) Relationships (1-M / M-M)
    4) Constraints (unique, nullable)

    Example

    class Lot(db.Model):
        id = db.Column(db.Integer, primary_key=True)
        name = db.Column(db.String(80), nullable=False)
        spots = db.relationship('Spot', backref='lot', lazy=True)
  6. 6
    - Aked about constrains/validations if I have used any in front-end/back-end .
    Times asked 1
    Official solution

    SimpleValidation = input rules: required, email format, length, unique. Frontend UX, backend security — dono.

    Example

    if not email or '@' not in email:
        flash('Invalid email')
        return redirect(request.url)
    if User.query.filter_by(email=email).first():
        flash('Email taken')
  7. 7
    Theory Questions:
    Times asked 2
    Official solution

    SimpleTheory = concepts: ORM, MVC, auth vs authz, Jinja inheritance, sessions. 1-line def + project example.

  8. 8
    - Open notepad and make a route that takes trek details and prints it in another page
    Times asked 1
    Official solution

    SimpleViva wrap-up hai. Short thanks + confirm submission ZIP latest hai.

Advice: Very nice proctor. Very polite, patient and helpful. Just be honest with your code with her and she'll help you pass your viva.
  1. 1
    Proctor 800
    Times asked 1
    Official solution

    SimpleViva wrap-up hai. Short thanks + confirm submission ZIP latest hai.

  2. 2
    She is so calm and patient.
    Times asked 1
    Official solution

    SimpleViva wrap-up hai. Short thanks + confirm submission ZIP latest hai.

  3. 3
    I was so nervous .
    Times asked 1
    Official solution

    SimplePehle 1-line definition, phir apne MAD1 project mein file dikhao, phir chhota example.

    Suggested flow1) Concept kya hai?
    2) Mere code mein kahan?
    3) Example / demo
    4) Edge case

    Example

    # related file: models.py / routes / template
    # formula: request → check/auth → DB → render/redirect

    Viva tipExact line yaad nahi to honestly related part dikhao. Bluff mat karo.

  4. 4
    Ask me to create form and takes input
    Times asked 1
    Official solution

    SimpleORM = Object Relational Mapping. Tables → Python classes. Raw SQL kam likhte ho.

    Example

    class User(db.Model):
        id = db.Column(db.Integer, primary_key=True)
        email = db.Column(db.String(120), unique=True)
    
    User.query.get(5)  # SELECT ... WHERE id=5
  5. 5
    Check all core functionality,
    Times asked 1
    Official solution

    SimpleViva wrap-up hai. Short thanks + confirm submission ZIP latest hai.

  6. 6
    Check GitHub,id,
    Times asked 1
    Official solution

    SimpleGitHub repo open karo: commits, collaborators, README. Examiner check karta hai tumne khud kaam kiya.

    Example

    Settings → Collaborators
    Commits: regular messages, last-day dump nahi.

    Viva tipPrivate repo access pehle de do. Main branch submitted ZIP se match honi chahiye.

  7. 7
    Ask me to add max slots is 30,
    Times asked 1
    Official solution

    SimplePehle 1-line definition, phir apne MAD1 project mein file dikhao, phir chhota example.

    Suggested flow1) Concept kya hai?
    2) Mere code mein kahan?
    3) Example / demo
    4) Edge case

    Example

    # related file: models.py / routes / template
    # formula: request → check/auth → DB → render/redirect

    Viva tipExact line yaad nahi to honestly related part dikhao. Bluff mat karo.

  8. 8
    GEt and post method
    Times asked 1
    Official solution

    SimpleGET data read/show karta hai (idempotent). POST create/submit karta hai (form).

    Example

    @app.route('/login', methods=['GET', 'POST'])
    def login():
        if request.method == 'POST':
            # validate + session
            ...
        return render_template('login.html')
  9. 9
    Secret key, template inheritance,
    Times asked 1
    Official solution

    SimpleBase template pe navbar/footer, child pages {% extends %} + {% block %} se content bharte hain. DRY.

    Example

    {# base.html #}
    {% block content %}{% endblock %}
    
    {# home.html #}
    {% extends 'base.html' %}
    {% block content %}
      <h1>Home</h1>
    {% endblock %}
Advice: Stay calm
  1. 1
    - Show ID, github, collaborator added
    Times asked 1
    Official solution

    SimpleGitHub repo open karo: commits, collaborators, README. Examiner check karta hai tumne khud kaam kiya.

    Example

    Settings → Collaborators
    Commits: regular messages, last-day dump nahi.

    Viva tipPrivate repo access pehle de do. Main branch submitted ZIP se match honi chahiye.

  2. 2
    - Download project from portal, no checksum
    Times asked 1
    Official solution

    SimpleExaminer portal wala submitted ZIP chahta hai. Local extra changes mat dikhana.

    Suggested flow1) Portal ZIP download
    2) Extract
    3) venv + pip install -r requirements.txt
    4) flask run / python app.py

  3. 3
    - She asked to login to admin dashboard. Add a trek
    Times asked 1
    Official solution

    SimpleProject overview: problem → roles → main entities → key flows (register, book, admin approve).

    Viva tip1 minute elevator pitch ready rakho, phir demo.

  4. 4
    - She asked to register a staff
    Times asked 1
    Official solution

    SimpleDemo script pehle se practice: 5–7 min, Admin + User roles, saare mandatory features.

    Suggested flow1) Register/login user
    2) Admin login — CRUD
    3) Approval/blacklist
    4) Booking/apply + edge case
    5) Search
    6) Logout

    Viva tipBolte-bolte dikhao. Code tab kholna jab poochhein.

  5. 5
    - She asked to approve the staff and update the status to open and slot
    Times asked 1
    Official solution

    SimpleViva wrap-up hai. Short thanks + confirm submission ZIP latest hai.

  6. 6
    - She asked to login as a trekker. Book a trek. Edit profile, check booking history.
    Times asked 1
    Official solution

    SimpleProject overview: problem → roles → main entities → key flows (register, book, admin approve).

    Viva tip1 minute elevator pitch ready rakho, phir demo.

  7. 7
    - She asked to cancel a booking from admin dashboard, and also show search functionality for admin and user
    Times asked 1
    Official solution

    SimpleDemo script pehle se practice: 5–7 min, Admin + User roles, saare mandatory features.

    Suggested flow1) Register/login user
    2) Admin login — CRUD
    3) Approval/blacklist
    4) Booking/apply + edge case
    5) Search
    6) Logout

    Viva tipBolte-bolte dikhao. Code tab kholna jab poochhein.

  8. 8
    - She checked the app.py and asked about blueprints
    Times asked 1
    Official solution

    SimpleBlueprint se app ko modules mein todte ho — auth, admin, user alag files. Scale + clean structure.

    Example

    auth_bp = Blueprint('auth', __name__, url_prefix='/auth')
    
    @auth_bp.route('/login')
    def login(): ...
    
    app.register_blueprint(auth_bp)

    Viva tipViva: 'kyun blueprint?' → separation of concerns, badi app maintainable.

  9. 9
    - Checked models, and asked why i had to override a property/function
    Times asked 1
    Official solution

    Simplemodels.py = har table ki class: columns, PK/FK, relationships. Yeh Model layer hai.

    Suggested flow1) Classes list karo
    2) Har table ka kaam 1 line
    3) Relationships (1-M / M-M)
    4) Constraints (unique, nullable)

    Example

    class Lot(db.Model):
        id = db.Column(db.Integer, primary_key=True)
        name = db.Column(db.String(80), nullable=False)
        spots = db.relationship('Spot', backref='lot', lazy=True)
  10. 10
    Coding:
    Times asked 6
    Official solution

    SimpleTheory = concepts: ORM, MVC, auth vs authz, Jinja inheritance, sessions. 1-line def + project example.

  11. 11
    - A route to input email and password and display on another page
    Times asked 1
    Official solution

    SimplePehle 1-line definition, phir apne MAD1 project mein file dikhao, phir chhota example.

    Suggested flow1) Concept kya hai?
    2) Mere code mein kahan?
    3) Example / demo
    4) Edge case

    Example

    # related file: models.py / routes / template
    # formula: request → check/auth → DB → render/redirect

    Viva tipExact line yaad nahi to honestly related part dikhao. Bluff mat karo.

  12. 12
    - Jinja code to display the email
    Times asked 1
    Official solution

    SimpleJinja2 Flask ka template engine — HTML ke andar {{ }} variables, {% %} logic.

    Example

    {% for lot in lots %}
      <li>{{ lot.name }} — {{ lot.spots }}</li>
    {% else %}
      <p>No lots</p>
    {% endfor %}
  13. 13
    - SQL query for treks with open status
    Times asked 1
    Official solution

    SimpleProject overview: problem → roles → main entities → key flows (register, book, admin approve).

    Viva tip1 minute elevator pitch ready rakho, phir demo.

  14. 14
    Then she asked about statelessness of HTTP
    Times asked 1
    Official solution

    SimpleViva wrap-up hai. Short thanks + confirm submission ZIP latest hai.

Advice: She was very good. Came on time, and clarified everything properly. I realized i messed up in a few places like forgetting a .all() for the query, but she said i gave a good viva.
  1. 1
    Show ID card.
    Times asked 6
    Official solution

    SimpleCamera pe clearly IITM/college ID dikhao — naam photo match.

    Pehle se ID haath mein rakho. Glare mat aane do. Examiner screenshot/verify karta hai. Iske baad GitHub + project run.

  2. 2
    Show GitHub repository and collaborator access.
    Times asked 1
    Official 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.

  3. 3
    Complete project demo (checked all core features thoroughly).
    Times asked 1
    Official 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.

  4. 4
    Explain the code in app.py.
    Times asked 1
    Official 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 → SQLite

    Ek 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 redirect

    Example 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.

  5. 5
    Explain the models.py file.
    Times asked 5
    Official 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 status

    Example 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.

  6. 6
    Show the frontend/backend validations or constraints used.
    Times asked 1
    Official 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.

  7. 7
    What is ORM?
    Times asked 49
    Official 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.

  8. 8
    Difference between GET and POST methods.
    Times asked 2
    Official solution

    SimpleGET data mangta hai (read), POST data bhejta hai (create/submit).

    GETURL mein dikhta hai, bookmark ho sakta hai, browser back/refresh safe hai, data URL query mein jaata hai. Search, page open, login form dikhana.

    POSTbody mein data jaata hai, URL mein password nahi dikhta, refresh pe dubara submit ho sakta hai. Login, register, form save.

    Example

    # page dikhana

    @app.route('/login', methods=['GET', 'POST'])
    def login():
        if request.method == 'GET':
            return render_template('login.html')
        # POST: form submit
        email = request.form.get('email')
        ...

    GET se theoretically data bhej sakte ho (?q=flask), lekin create/update ke liye nahi use karna — data log/history mein save ho jaata hai, length limit hoti hai.
    HTML form default GET hota hai; method='POST' likhna zaroori hai login/register pe.

  9. 9
    What is a Flask secret key?
    Times asked 1
    Official solution

    SimpleSECRET_KEY Flask ka secret jisse session cookies sign/encrypt hoti hain.

    app.config['SECRET_KEY'] = os.getenv('SECRET_KEY', 'dev-key')

    Iske bina session/flash unreliable ya insecure. Key leak = attacker session forge kar sakta hai.
    Hardcode mat karo production mein — .env / environment variable. Flash messages bhi session use karti hain, isliye SECRET_KEY se related hain.
    Hataane pe session kaam nahi / warning. Change karne pe purane sessions invalid.

  10. 10
    What is template inheritance in Jinja?
    Times asked 1
    Official 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 pe

    Fayda: header/footer ek jagah, change once — saari pages update. MAD1 mein almost har project use karta hai.

  11. 11
    What is an Enum?
    Times asked 1
    Official 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.

  12. 12
    Explain the statelessness of HTTP.
    Times asked 1
    Official solution

    SimpleHTTP stateless hai — har request independent, server previous request yaad nahi rakhta.

    Isliye login ke baad bhi har request pe kaun ho yeh prove karna padta hai: cookie/session/JWT.
    State = yaad rakhna (user_id, cart). HTTP khud nahi rakhta; Flask session iske upar layer hai.
    Fayda: scale aasan, koi bhi server next request handle kar sake (sticky session ke bina, token use karke).

  13. 13
    Difference between render_template() and redirect().
    Times asked 4
    Official solution

    Simplerender_template HTML page bana ke turant dikhata hai, redirect user ko doosre URL pe bhej deta hai.

    render_template('home.html', user=user) → server template fill karke 200 response deta hai. URL same rehta hai.
    redirect(url_for('dashboard')) → 302 response, browser naya GET karta hai. URL change ho jaata hai.

    Examplelogin POST successful hone ke baad render_template mat use karo, warna refresh pe form dubara submit ho jaayega.

    Sahi tarika: redirect(url_for('dashboard')) — yeh Post-Redirect-Get pattern hai.

    render_template tab: page dikhana hai with data.
    redirect tab: kaam ho gaya, ab doosre page pe le jaana hai (login, delete, update ke baad).

  14. 14
    CSS priority: Inline vs Internal vs External CSS.
    Times asked 1
    Official 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 jeetega

    ID (#box) class (.btn) se strong, class element (button) se strong.
    !important sabko override karta hai — avoid karo.
    Large project: external CSS preferred.

  15. 15
    CSS priority: Class selector vs ID selector.
    Times asked 1
    Official 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 jeetega

    ID (#box) class (.btn) se strong, class element (button) se strong.
    !important sabko override karta hai — avoid karo.
    Large project: external CSS preferred.

  16. 16
    Which Bootstrap class/button is used to create a red button?
    Times asked 1
    Official solution

    SimpleBootstrap CSS/JS framework — ready classes se responsive UI.

    <button class='btn btn-primary'>Save</button>

    Red button: btn btn-danger. Navbar, cards, grid (row/col).
    CDN: <link href='https://cdn.jsdelivr.net/npm/bootstrap@5...'> — internet na ho to style toot sakti hai. Local copy safer viva ke liye.
    CSS vs Bootstrap: Bootstrap faster consistent UI, custom CSS fine-control. Dono saath use ho sakte hain.
    aria-current='page' accessibility — current nav item screen readers ko.
    CDN fayda: cache, quick setup. Nuksaan: offline, privacy, version lock.

  17. 17
    Create a form that accepts user input.
    Times asked 1
    Official solution

    Yeh project-specific feature add/modify hai. 4 layers touch karo: model, route, template, validation.

    1) Data chahiye to models.py mein column/relationship + DB update (ALTER / migrate / create_all).
    2) Route: GET pe form/page, POST pe request.form se save, flash + redirect.
    3) Template: input name=... Jinja se {{ obj.field }} display.
    4) Rule: duplicate, range, role check backend pe.

    Example naya field 'city':

    user.city = db.Column(db.String(50))
    user.city = request.form.get('city')
    <input name='city'>  ...  {{ user.city }}
  18. 18
    Write a Jinja for loop.
    Times asked 9
    Official 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>

  19. 19
    Write a Flask route to accept trek details and display them on another page.
    Times asked 1
    Official 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())

  20. 20
    Explain/write code showing how Jinja connects with HTML.
    Times asked 1
    Official 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 %}.

  21. 21
    Add a validation so the maximum slots allowed are 30.
    Times asked 1
    Official solution

    SimpleValidation galat data rok ti hai — frontend turant, backend must.

    Frontend: required, min='18', maxlength='8', pattern='(?=.*[A-Z]).{8,}'
    Backend example:

    pwd = request.form.get('password','')
    if len(pwd) < 8 or not re.search(r'[A-Z]', pwd) or not re.search(r'[0-9]', pwd):
        flash('Weak password')

    Haan, regex se password rules ho sakte hain.
    Age 18-99, date >= today, slots <= 30 and > 0, confirm password == password, email '@' .
    Duplicate username: User.query.filter_by(email=email).first() or unique=True catch IntegrityError.
    Past date: if date < date.today(): reject. Negative slots: if slots < 0: reject; book pe available > 0 check.

  22. 22
    Write an SQL query to fetch all open treks.
    Times asked 1
    Official solution

    Yeh list filter/sort/display task hai. Query badlo, template same rakh sakte ho.

    rows = Model.query.filter_by(status='approved').order_by(Model.name.asc()).all()

    Jinja: {% for r in rows %}<tr><td>{{ r.name|upper }}</td></tr>{% endfor %}

    {{ rows|length }} count dikhane ke liye.

    Alphabet sort: order_by(Model.name). Status filter: filter_by(status='pending').
    Assigned staff column: relationship se {{ booking.staff.name }}.

Created for educational purposes only. Questions are based on students' personal experiences and may not reflect actual exam content.