Viva prep · Real questions · Student experiences Enroll in Bootcamp

Proctor workspace

Proctor Level2_101

Share your experience Add your viva experience here
317 Questions
30 Sets
0 Topics
0 Reviews
Tips for this examiner: You should know whatever you have written in your code, he can ask questions from any part of the code
Overall the proctor is very good

Student reviews

No student reviews for this proctor yet.

Approved viva sets

  1. 1
    Update code of search bar such that while searching using email ,if I write '@gmail.com' then it should not show any data . Search email only based on string before @ .
    Times asked 2
  2. 2
    Difference between local storage and session storage. I used local storage so he asked that your app will be in danger if the data is stored locally even after refresh . Anyone can see credentials locally.
    Times asked 2
  3. 3
    What is webhooks and websocket
    Times asked 1
  4. 4
    What is cache.cached and cache.memorize
    Times asked 2
  5. 5
    What is decorator and why we use decorator not functions.
    Times asked 2
  6. 6
    Why you have used jsonify
    Times asked 2
  7. 7
    What are derivatives He basically go through my whole code and ask questions from anywhere. Some more questions were asked. I don't remember those.
    Times asked 2
Advice: He is a chill person . Take your time while updating code question. Ask mostly questions from your code.
  1. 1
    This was my Level-2 viva. I don't remember everything because for the most part it was follow-up questions to test how deep I can go.
    Times asked 2
  2. 2
    - ID check, no GitHub collaborator check.
    Times asked 2
  3. 3
    - I started demo, during Admin demo he asked a system-design related question, this is my strong suit so I explained very well the rationale behind the design, he said very good. This went on for 10-12 mins.
    Times asked 2
  4. 4
    - After this he asked me to open tasks and asked "What is that `with.app_context`? I stumbled for a few mins then said I don't remember exactly now. He said it's ok.
    Times asked 2
  5. 5
    - Then there were questions on SMTP, but he wasn't interested in the textbook definitions, he probed deeper, I gave shallow answer here, so he understood I am not knowledgeable in this area, so he said "Ok" and moved on.
    Times asked 2
  6. 6
    - Finally we had a chat for 10-15 mins, asked how he would rate my performance (instead of directly asking a specific number), then asked where I can improve, this went on for a while.
    Times asked 2
Advice: There are many more questions that I don't remember, but one thing is he asks the same questions that's mentioned in this sheet, but the follow-up questions depend on your project, your level of response, etc., so instead of preparing for the "what" focus more on the "why" of things. He is a very humble, to-the-point, no-nonsense, knowledgeable guy. He'll keep you on ice but will test your real knowledge.
  1. 1
    -Joined on time
    Times asked 2
  2. 2
    -Show me your ID
    Times asked 4
  3. 3
    -run the project
    Times asked 2
  4. 4
    (I took some more time for the project setup and i got panicked, but he just make me moved on)
    Times asked 2
  5. 5
    -one by one checked functionality what he needed and mailhog also
    Times asked 4
  6. 6
    -Explain DB
    Times asked 1
  7. 7
    -Have you refered any AI for your code
    Times asked 2
  8. 8
    -Made me to change some functionalities in Admin Dashboard
    Times asked 2
  9. 9
    -Why are you specifically using decorator
    Times asked 2
  10. 10
    -Why don't we use a function for that
    Times asked 2
  11. 11
    -Give a proper explanation on it.
    Times asked 2
  12. 12
    -And asked me to ask any questions if I want.
    Times asked 2
  13. 13
    -I asked some questions on my skills to improve.
    Times asked 2
  14. 14
    And done.
    Times asked 2
Advice: Just answer confidently. He is a cool guy.
  1. 1
    app demo
    Times asked 3
  2. 2
    started with to make a new search function in on of the dashboard
    Times asked 2
  3. 3
    primary key and unique key in detail
    Times asked 1
  4. 4
    lazy=true in detail
    Times asked 2
  5. 5
    celery worker - redis - celery beat
    Times asked 2
  6. 6
    decorators, what and why to use.
    Times asked 1
  7. 7
    why blueprints
    Times asked 2
  8. 8
    webhooks and webscoket
    Times asked 1
Advice: Proctor was calm, but he'll ask you to code and ask from your code that why have you implemented this that.
  1. 1
    what is this cascade =all , delete orphans are they both needed
    Times asked 2
  2. 2
    then route ask for a explanation of a admin route
    Times asked 2
  3. 3
    the we move to app.py and ask for how this context celery code block do work(call_)
    Times asked 2
  4. 4
    then we move to front end ask me what is the difference in == and === in java and some more simple question (don't remember) easy one at one point i got stuck in one question and didn't know the answer(celery and redis code ) so give him a honest answer that i don't know that so he simply move to next question notes : have a good knowledge of each line of your code like every single like specially from back end an db
    Times asked 2
Advice: good proctor asked the questions in chill way you can take your time and think to keep in mind know your code well like each and everyline he will go in depth
  1. 1
    Went on for 45 minutes in depth (cause I kept answering and used terminology)
    Times asked 2
  2. 2
    Basic Things - ID card, github, download, checksum, run
    Times asked 2
  3. 3
    What is SMTP & what port are you using and what is the default
    Times asked 2
  4. 4
    Default port for flask
    Times asked 2
  5. 5
    Default port for Vue if using CLI / vite or what have you used
    Times asked 1
  6. 6
    Explain the model and why used in such way
    Times asked 2
  7. 7
    Explain Primary key (went into depth as to why use primary key instead of just nullable and unique with indexing)
    Times asked 2
  8. 8
    Explain python decorators
    Times asked 2
  9. 9
    Explain exception handling
    Times asked 1
  10. 10
    Different codes returned by flask / endpoints
    Times asked 2
  11. 11
    What are slots and if used
    Times asked 1
  12. 12
    Diff bw props & slots
    Times asked 2
  13. 13
    Why used async majorly in the project
    Times asked 2
  14. 14
    What router was used and why do we use different routers instead of browser working
    Times asked 2
  15. 15
    What is the process of the data flow in these jobs
    Times asked 2
  16. 16
    What will happen if the load was multiplied by millions
    Times asked 2
  17. 17
    Change the priority essentially
    Times asked 2
  18. 18
    how are they different
    Times asked 2
  19. 19
    How would you scale the application to be used by millions of users
    Times asked 2
  20. 20
    What fallback have you implemented to make sure the data is not leaked
    Times asked 2
  21. 21
    What happens if we interchange the decorators
    Times asked 1
Advice: The proctor was chill and majorly went into depth because I kept giving answers in detailed and we basically talked a lot about how the inner workings for a lot of databases and apis. If you know you can go into detail while answering but only if you know do this otherwise you might go blank as to what the person is asking.
  1. 1
    Have you used slots and props?
    Times asked 2
  2. 2
    Used any derivative and show, why used it?
    Times asked 2
  3. 3
    What is decorator and how it differs from a function.
    Times asked 2
  4. 4
    He mainly focused on code changes and asked theoretical questions mentioned in this gsheet.
    Times asked 2
Advice: Should have good idea about the code
  1. 1
    What us __repr__ used in the model
    Times asked 2
  2. 2
    How will interchanging the position of @jwt_required and @role_required affect the working of application
    Times asked 2
  3. 3
    Jsonify vs json package
    Times asked 2
  4. 4
    Difference between 400, 401, 403 and 404 code
    Times asked 2
  5. 5
    Slots and props in vuejs
    Times asked 1
  6. 6
    In db.String(128) what is 128, how it is stored in the memory
    Times asked 2
  7. 7
    Difference between synchronous and asynchronous Apart from these He asked to optimize a piece of my code which has a few if conditions, without using if-else conditions Asked to implement a drop down menu to enter some data in a form
    Times asked 2
Advice: You should know whatever you have written in your code, he can ask questions from any part of the code Overall the proctor is very good
  1. 1
    Demonstration of app
    Times asked 2
  2. 2
    Found a bug, Gave some time to clear it. I could partially do. Moved on.
    Times asked 2
  3. 3
    Asked to implement "search by username" functionality.
    Times asked 2
  4. 4
    Purpose of index, index on two columns in SQLAlchemy
    Times asked 2
  5. 5
    Prioritizing celery tasks
    Times asked 2
  6. 6
    Can we swap order of two decorators @role_required and @auth_required
    Times asked 1
  7. 7
    json vs jsonify, json.dumps , websocket vs webhooks
    Times asked 2
  8. 8
    Props in Vue
    Times asked 2
  9. 9
    Can we change db models when the app is in production (live). How?
    Times asked 2
  10. 10
    Gave a detailed feedback on what could be improved in the app.
    Times asked 2
  1. 1
    Proctor was a chill person, probably kept on increasing difficulty of questions because I kept answering.
    Times asked 2
  2. 2
    1) demo of project
    Times asked 1
  3. 3
    2) went through models
    Times asked 2
  4. 4
    BACKEND
    Times asked 2
  5. 5
    what is __repr__ (w.r.t. models)?
    Times asked 2
  6. 6
    __repr__ vs __str__
    Times asked 2
  7. 7
    what are decorators?
    Times asked 2
  8. 8
    400 vs 401 status code
    Times asked 2
  9. 9
    webhook vs websocket
    Times asked 2
  10. 10
    session vs cookies
    Times asked 2
  11. 11
    FRONTEND
    Times asked 2
  12. 12
    what are routes and how are you using them?
    Times asked 2
  13. 13
    what is slots? are you using them?
    Times asked 1
  14. 14
    There were probably a few more, I dont remember right now.
    Times asked 2
  15. 15
    He seemed to be going with the flow, asked questions from what all you showed him. Counter questions if he feels that you have some lack of clarity in your answers.
    Times asked 2
  16. 16
    Good Luck!
    Times asked 2
  1. 1
    Make code changes in celery tasks file to change priority of daily_reminder and monthly_reminder
    Times asked 2
  2. 2
    Explain the different endpoints of api implement in project and why we use them ?
    Times asked 2
  3. 3
    Explain the Models in your project birefly (How many tables and how are they connected)
    Times asked 2
  4. 4
    Differece bw prmary key and unique key ?
    Times asked 2
  5. 5
    Can we use auto-increment instead of primary key ? will it serve the purpose ? if not why ?
    Times asked 2
  1. 1
    Difference between memcache and rediscache
    Times asked 2
  2. 2
    difference and use of Unique key, primary key in sql
    Times asked 2
  3. 3
    How to prioritise a task in celery
    Times asked 2
  1. 1
    Different btw memcached and redis cache
    Times asked 2
  1. 1
    Purpose of index, index on two columns in SQLAlchemy
    Times asked 2
    Official solution

    SimpleSQLAlchemy MAD1 ka common ORM. Flask-SQLAlchemy wrapper se db.Model, db.session.

    Example

    user = User(email='a@b.com')
    db.session.add(user)
    db.session.commit()
    users = User.query.filter_by(role='admin').all()
  1. 1
    Update code of search bar such that while searching using email ,if I write '@gmail.com' then it should not show any data . Search email only based on string before @ .
    Times asked 2
    Official solution

    SimpleSearch: form/query param → ilike filter → results template.

    Example

    q = request.args.get('q', '').strip()
    lots = Lot.query.filter(Lot.name.ilike(f'%{q}%')).all()
  2. 2
    Difference between local storage and session storage. I used local storage so he asked that your app will be in danger if the data is stored locally even after refresh . Anyone can see credentials locally.
    Times asked 2
    Official solution

    SimpleMAD1 mein usually session-based auth: login pe session['user_id'], har request pe verify.

    Example

    session['user_id'] = user.id
    uid = session.get('user_id')
    user = User.query.get(uid)

    Viva tipSECRET_KEY set karo warna session insecure. logout pe session.clear().

  3. 3
    What is cache.cached and cache.memorize
    Times asked 2
    Official solution

    SimpleCache = pehli baar hisaab karke copy rakh lo, doosri baar copy dikha do.

    Baar-baar same expensive kaam (DB query, counting bookings) mat karo. Result Redis jaise store mein timeout ke saath rakh do.

    Cache hit: key mil gayi, DB skip. Cache miss: DB se lao, SET karo, return karo.

    Tradeoff: speed vs stale data. Admin naya venue add kare aur cache 50s ka ho to user purani list dekh sakta hai — isliye write pe invalidation zaroori hai.

    Browser cache, Flask-Caching, Redis alag layers hain. MAD2 examiner Redis + @cache.cached code dekhta hai.

    Example

    @cache.cached(timeout=50, query_string=True)
    @app.route('/api/shows')
    def shows():
        return jsonify([s.serialize() for s in Show.query.all()])

    Project example: Admin dashboard counts / venues list cache. Create/update/delete ke baad cache.delete('venues').

    Viva tipprint('DB queried') function ke andar laga ke miss/hit demo karo — hit pe print nahi chalega.

  4. 4
    What is decorator and why we use decorator not functions.
    Times asked 2
    Official solution

    Simplelogin_required jaisa decorator protected routes pe: session nahi to login redirect.

    Example

    def login_required(fn):
        @wraps(fn)
        def wrapper(*a, **k):
            if 'user_id' not in session:
                return redirect(url_for('auth.login'))
            return fn(*a, **k)
        return wrapper
  5. 5
    Why you have used jsonify
    Times asked 2
    Official solution

    Simplejsonify Python dict/list ko JSON response + proper Content-Type deta hai.

    Example

    return jsonify(message='ok', count=3), 200
  6. 6
    What are derivatives He basically go through my whole code and ask questions from anywhere. Some more questions were asked. I don't remember those.
    Times asked 2
    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.

Advice: He is a chill person . Take your time while updating code question. Ask mostly questions from your code.
  1. 1
    This was my Level-2 viva. I don't remember everything because for the most part it was follow-up questions to test how deep I can go.
    Times asked 2
    Official solution

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

  2. 2
    - ID check, no GitHub collaborator check.
    Times asked 2
    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.

  3. 3
    - I started demo, during Admin demo he asked a system-design related question, this is my strong suit so I explained very well the rationale behind the design, he said very good. This went on for 10-12 mins.
    Times asked 2
    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
    - After this he asked me to open tasks and asked "What is that `with.app_context`? I stumbled for a few mins then said I don't remember exactly now. He said it's ok.
    Times asked 2
    Official solution

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

  5. 5
    - Then there were questions on SMTP, but he wasn't interested in the textbook definitions, he probed deeper, I gave shallow answer here, so he understood I am not knowledgeable in this area, so he said "Ok" and moved on.
    Times asked 2
    Official solution

    SimpleSMTP = Simple Mail Transfer Protocol — email bhejne ka standard. Flask-Mail / smtplib se reminders/reports.

    Example

    from flask_mail import Message
    msg = Message('Subject', recipients=[user.email])
    msg.body = 'Hello'
    mail.send(msg)

    Viva tipViva mein MailHog/inbox dikhao. Port 587 TLS common; local pe MailHog 1025.

  6. 6
    - Finally we had a chat for 10-15 mins, asked how he would rate my performance (instead of directly asking a specific number), then asked where I can improve, this went on for a while.
    Times asked 2
    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
Advice: There are many more questions that I don't remember, but one thing is he asks the same questions that's mentioned in this sheet, but the follow-up questions depend on your project, your level of response, etc., so instead of preparing for the "what" focus more on the "why" of things. He is a very humble, to-the-point, no-nonsense, knowledgeable guy. He'll keep you on ice but will test your real knowledge.
  1. 1
    -Joined on time
    Times asked 2
    Official solution

    SimpleJOIN related tables ek result mein. Inner = match only; left = left side sab + match.

    Example

    db.session.query(Booking, User).join(User).filter(User.id == uid).all()
  2. 2
    -Show me your ID
    Times asked 4
    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.

  3. 3
    (I took some more time for the project setup and i got panicked, but he just make me moved on)
    Times asked 2
    Official solution

    SimpleImprove ideas: caching, better validation, tests, pagination, email reminders, accessibility, mobile UI, logging.

    Viva tip1-2 concrete features bolo jo time milne pe add karte — vague 'AI' mat.

  4. 4
    -one by one checked functionality what he needed and mailhog also
    Times asked 4
    Official solution

    SimpleMailHog local fake post office — email internet pe nahi jaata, browser mein dikhta hai.

    SMTP 1025, Web UI 8025. Viva demo gold. Credentials nahi.

    Real Gmail SMTP student accounts pe block common — MailHog safer.

    Flask-Mail / SMTP se mail. Local MailHog fake server: SMTP 1025, UI 8025 — internet nahi, viva safe.

    Asli send Celery task mein, request thread mein nahi. Beat 6pm reminder, export ke baad CSV attach optional.

    MAIL_SERVER localhost demo. Gmail SMTP student account pe block common. Body mein user name personalization examiner dekhta hai.

    Example

    MAIL_SERVER=localhost
    MAIL_PORT=1025
    # http://localhost:8025

    Project example: Reminder task → MailHog list → HTML body user name ke saath.

  5. 5
    -Have you refered any AI for your code
    Times asked 2
    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.

  6. 6
    -Made me to change some functionalities in Admin Dashboard
    Times asked 2
    Official solution

    SimpleLive UI change: relevant CSS/HTML template kholo — color, margin, flex, bootstrap class. Save + hard refresh.

    Example

    /* button red */
    .btn-primary { background: red; }
    
    /* center navbar item */
    .navbar { justify-content: center; }

    Viva tipDevTools se pehle try, phir file mein permanent change.

  7. 7
    -Why are you specifically using decorator
    Times asked 2
    Official solution

    Simplelogin_required jaisa decorator protected routes pe: session nahi to login redirect.

    Example

    def login_required(fn):
        @wraps(fn)
        def wrapper(*a, **k):
            if 'user_id' not in session:
                return redirect(url_for('auth.login'))
            return fn(*a, **k)
        return wrapper
  8. 8
    -Why don't we use a function for that
    Times asked 2
    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.

  9. 9
    -Give a proper explanation on it.
    Times asked 2
    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.

  10. 10
    -And asked me to ask any questions if I want.
    Times asked 2
    Official solution

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

  11. 11
    -I asked some questions on my skills to improve.
    Times asked 2
    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
    And done.
    Times asked 2
    Official solution

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

Advice: Just answer confidently. He is a cool guy.
  1. 1
    app demo
    Times asked 3
    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.

  2. 2
    started with to make a new search function in on of the dashboard
    Times asked 2
    Official solution

    SimpleSearch: form/query param → ilike filter → results template.

    Example

    q = request.args.get('q', '').strip()
    lots = Lot.query.filter(Lot.name.ilike(f'%{q}%')).all()
  3. 3
    lazy=true in detail
    Times asked 2
    Official solution

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

  4. 4
    celery worker - redis - celery beat
    Times asked 2
    Official solution

    SimpleBeat clock hai, Worker haath hai. Clock kaam nahi karti, haath nahi sochte kab.

    Worker: @celery.task execute. Beat: crontab padhke due time pe queue mein daal.
    Sirf worker = scheduled nahi. Sirf beat = queue bhar jaaye, koi run nahi.

    Dono ke saath redis-server. Logs mein 'Sending due task' Beat, 'Task succeeded' Worker.

    Example

    celery -A app.celery worker -l info
    celery -A app.celery beat -l info

    Project example: daily_reminder Beat 18:00. Worker MailHog. Export worker-only (button).

    Viva tipSirf worker = scheduled jobs nahi chalenge. Sirf beat = queue bhar jaaye, koi run nahi karega.

  5. 5
    why blueprints
    Times asked 2
    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.

Advice: Proctor was calm, but he'll ask you to code and ask from your code that why have you implemented this that.
  1. 1
    what is primary key
    Times asked 2
    Official solution

    SimplePrimary key row ka unique identity — usually id Integer autoincrement.

    Example

    id = db.Column(db.Integer, primary_key=True)
  2. 2
    what is this cascade =all , delete orphans are they both needed
    Times asked 2
    Official solution

    SimpleCascade parent delete pe children pe kya ho: delete-orphan related rows hata deta hai.

    Example

    db.relationship('Spot', cascade='all, delete-orphan')

    Viva tipParking lot delete → uske spots/bookings policy clear bolo.

  3. 3
    then route ask for a explanation of a admin route
    Times asked 2
    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
    the we move to app.py and ask for how this context celery code block do work(call_)
    Times asked 2
    Official solution

    SimpleCelery = background naukri. HTTP request ko 10 second email bhejne ke liye mat rokna.

    Distributed task queue: aap function ko abhi nahi, worker process mein later/retry/schedule pe chalaate ho.

    MAD2 typical jobs: daily reminder mail, monthly HTML report, user-triggered CSV export.

    Web request 200ms hona chahiye. 10,000 emails request thread mein = timeout. Worker alag CPU pe kaam kare.

    Redis broker chahiye. Beat alag process schedule ke liye.

    Example

    @celery.task
    def daily_reminder():
        for u in User.query.filter_by(active=True):
            send_mail(u.email, 'Book something today!')

    Project example: User Export click → 202 Accepted. Worker CSV + email. Daily 6pm Beat reminder.

    Viva tipWorker + Redis bina Beat ke user-triggered chalega. Scheduled jobs ke liye Beat bhi chahiye.

  5. 5
    then we move to front end ask me what is the difference in == and === in java and some more simple question (don't remember) easy one at one point i got stuck in one question and didn't know the answer(celery and redis code ) so give him a honest answer that i don't know that so he simply move to next question notes : have a good knowledge of each line of your code like every single like specially from back end an db
    Times asked 2
    Official solution

    SimpleRedis box hai, Celery us box se kaam uthane wala worker hai — same cheez nahi.

    Redis: store (cache keys) + queue (broker lists).
    Celery: Python library jo tasks define karti hai, .delay() se queue mein daalti hai, worker execute karta hai.

    Dono localhost pe ho sakte hain. Alag Redis DB index use karo. Redis band = cache miss + Celery stuck.

    Example

    Celery: broker_url='redis://localhost:6379/0'
    Cache:  CACHE_REDIS_URL='redis://localhost:6379/1'

    Project example: export_csv.delay(user_id) Flask se. Worker Redis se task uthata hai, CSV+email. Cache alag keys venues.

    Viva tipAgar possible ho to cache db=1, broker db=0 — keys mix nahi hoti.

Advice: good proctor asked the questions in chill way you can take your time and think to keep in mind know your code well like each and everyline he will go in depth
  1. 1
    Went on for 45 minutes in depth (cause I kept answering and used terminology)
    Times asked 2
    Official solution

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

  2. 2
    Basic Things - ID card, github, download, checksum, run
    Times asked 2
    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.

  3. 3
    Explain all the features implemented in the application (Showcase of the application)
    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
    What is pagination and why used
    Times asked 1
    Official solution

    SimplePagination badi list ko pages mein todta hai — offset/limit ya Flask-SQLAlchemy paginate().

    Example

    page = request.args.get('page', 1, type=int)
    pagination = Lot.query.paginate(page=page, per_page=10)
  5. 5
    What are vue directives
    Times asked 3
    Official solution

    SimpleDirectives Vue ke special attributes — HTML ko superpower.

    v-if/else/show, v-for, v-bind (:), v-on (@), v-model, v-html (XSS), v-cloak, v-slot.

    :src = v-bind:src. @click = v-on:click.

    Custom directives bhi (v-focus) — course basics kaafi.

    Example

    <p v-if="ok">Yes</p>
    <li v-for="u in users" :key="u.id">{{ u.name }}</li>
    <input v-model="email">
    <img :src="url">

    Project example: List v-for :key. Form v-model. Admin v-if. Image :src.

    Viva tip: src ke liye v-bind:src ka shorthand. @click = v-on:click.

  6. 6
    What are lifecycle hooks
    Times asked 2
    Official solution

    SimpleVue.js frontend framework — reactive UI components. MAD2 mein common, MAD1 optional.

    Component: reusable UI (Navbar.vue) + data + template.
    Props: parent → child data. Child → parent: $emit('update', val).
    Slots: parent child ke andar extra HTML daal sakta hai.
    Lifecycle: created (data setup), mounted (DOM ready — API call), updated, unmounted.
    v-model two-way bind. Vue Router SPA routes (routes.js). Vuex/Pinia global state; mutations sync change, actions async.
    Standalone component: khud ke saath compile, parent register kam.

  7. 7
    What is SMTP & what port are you using and what is the default
    Times asked 2
    Official solution

    SimpleSMTP = email bhejne ka protocol, jaise HTTP web ka.

    Ports: 587 STARTTLS, 465 SMTPS, 25 server-server. Dev: MailHog 1025.

    Flask-Mail wrap. Sync send slow — Celery task se bhejo.

    Fayda: universal. Nuksaan: spam, deliverability (SPF/DKIM), no guarantee like API.

    Example

    app.config['MAIL_SERVER'] = 'localhost'
    app.config['MAIL_PORT'] = 1025
    mail.send(Message('Hi', recipients=['a@b.com'], body='Hello'))

    Project example: MAIL_SERVER=localhost MAIL_PORT=1025. Production later SendGrid/SES.

    Viva tipFayda: universal. Nuksaan: deliverability, spam, sync send slow — isliye Celery + MailHog in dev.

  8. 8
    Default port for flask
    Times asked 2
    Official solution

    SimpleFlask lightweight Python web framework — routes, request/response, templates. MAD1 ka backend yahi hai.

    Example

    from flask import Flask
    app = Flask(__name__)
    
    @app.route('/')
    def home():
        return 'Hello'

    Viva tipFlask micro hai: jo chahiye (DB, login, forms) khud jodte ho.

  9. 9
    Explain the model and why used in such way
    Times asked 2
    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
    Explain Primary key (went into depth as to why use primary key instead of just nullable and unique with indexing)
    Times asked 2
    Official solution

    SimplePrimary key row ka unique identity — usually id Integer autoincrement.

    Example

    id = db.Column(db.Integer, primary_key=True)
  11. 11
    Joins in databases
    Times asked 1
    Official solution

    SimpleJOIN related tables ek result mein. Inner = match only; left = left side sab + match.

    Example

    db.session.query(Booking, User).join(User).filter(User.id == uid).all()
  12. 12
    Explain python decorators
    Times asked 2
    Official solution

    Simplelogin_required jaisa decorator protected routes pe: session nahi to login redirect.

    Example

    def login_required(fn):
        @wraps(fn)
        def wrapper(*a, **k):
            if 'user_id' not in session:
                return redirect(url_for('auth.login'))
            return fn(*a, **k)
        return wrapper
  13. 13
    What is jsonify
    Times asked 1
    Official solution

    Simplejsonify Python dict/list ko JSON response + proper Content-Type deta hai.

    Example

    return jsonify(message='ok', count=3), 200
  14. 14
    Different codes returned by flask / endpoints
    Times asked 2
    Official solution

    SimpleFlask lightweight Python web framework — routes, request/response, templates. MAD1 ka backend yahi hai.

    Example

    from flask import Flask
    app = Flask(__name__)
    
    @app.route('/')
    def home():
        return 'Hello'

    Viva tipFlask micro hai: jo chahiye (DB, login, forms) khud jodte ho.

  15. 15
    What are props
    Times asked 2
    Official solution

    SimpleProps parent ki thali child ko dena. Child thali tod ke parent ki thali na badle — emit bolo.

    Declare props, parent :venue="v". One-way. Mutate mat. Types/required Vue 3.

    List parent, card child — classic viva.

    Component = reusable UI block (Navbar, Card). Props parent→child data, emit child→parent event. Slots parent HTML inner content.

    computed cache + reactive derive (filtered list). watch side-effect (query change pe API). methods events. ref() primitive, reactive() object. Vuex/Pinia global store; localStorage persist, store nahi.

    SFC: template + script + style ek .vue file. Parent-child exam favourite: list parent, row child :item + @delete.

    Example

    <VenueCard :venue="v" @select="onSelect" />
    props: ['venue']
    this.$emit('select', this.venue.id)

    Project example: VenueCard :venue. Child $emit('select', id).

  16. 16
    Diff bw props & slots
    Times asked 2
    Official solution

    SimpleSlots = dabbe ke andar parent apna HTML daal de. Props data, slots markup.

    Default slot, named slots. App.vue router-view layout jaisa outlet.

    Agar nahi use kiya: 'layout router-view se kiya' valid.

    Component = reusable UI block (Navbar, Card). Props parent→child data, emit child→parent event. Slots parent HTML inner content.

    computed cache + reactive derive (filtered list). watch side-effect (query change pe API). methods events. ref() primitive, reactive() object. Vuex/Pinia global store; localStorage persist, store nahi.

    SFC: template + script + style ek .vue file. Parent-child exam favourite: list parent, row child :item + @delete.

    Example

    <div class="card"><slot>Default</slot></div>
    <Card><p>Custom body</p></Card>

    Project example: Card.vue <slot>Default</slot>. Parent custom body.

  17. 17
    Why used async majorly in the project
    Times asked 2
    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.

  18. 18
    What router was used and why do we use different routers instead of browser working
    Times asked 2
    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.

  19. 19
    Show the celery jobs
    Times asked 1
    Official solution

    SimpleTask function, beat dict, delay() call, worker+beat terminals, MailHog/CSV.

    App context DB. Args serializable. How many jobs: reminder, monthly, export — gino honestly.

    Celery Python ka distributed task queue — HTTP request ko 10s email/CSV ke liye mat rokna.

    Flow: Flask .delay() → Redis broker → Worker execute. Beat alag process hai (clock): crontab padhke due time pe queue mein daalta hai. Beat khud mail nahi bhejta; Worker haath hai.

    MAD2 typical: daily reminder (Beat), monthly report (Beat), user Export CSV (button, Beat nahi). JS async/await browser event loop hai, Celery server-side process — mix mat karo.

    Demo: tin terminals — redis-server, celery worker, celery beat — plus Flask. MailHog :8025 inbox. Result backend se task SUCCESS poll optional.

    Project example: tasks.py + config schedule + POST export.

  20. 20
    What is the process of the data flow in these jobs
    Times asked 2
    Official solution

    SimpleNayi booking flow: UI form/button → route POST → login_required → validate seats → insert Booking → commit → redirect/flash.

    Suggested flowBrowser → Flask route → Auth → Business rules → SQLAlchemy → SQLite → Response template/JSON

  21. 21
    What will happen if the load was multiplied by millions
    Times asked 2
    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.

  22. 22
    Change the priority essentially
    Times asked 2
    Official solution

    SimpleLive UI change: relevant CSS/HTML template kholo — color, margin, flex, bootstrap class. Save + hard refresh.

    Example

    /* button red */
    .btn-primary { background: red; }
    
    /* center navbar item */
    .navbar { justify-content: center; }

    Viva tipDevTools se pehle try, phir file mein permanent change.

  23. 23
    What is webhooks
    Times asked 1
    Official solution

    SimpleCode explain formula: input kya aaya → auth/validation → DB change → response/UI.

    Viva tipFunction signature + 3-4 important lines + edge case.

  24. 24
    how are they different
    Times asked 2
    Official solution

    SimpleCode explain formula: input kya aaya → auth/validation → DB change → response/UI.

    Viva tipFunction signature + 3-4 important lines + edge case.

  25. 25
    How does websockets work
    Times asked 1
    Official solution

    SimpleCode explain formula: input kya aaya → auth/validation → DB change → response/UI.

    Viva tipFunction signature + 3-4 important lines + edge case.

  26. 26
    How would you scale the application to be used by millions of users
    Times asked 2
    Official solution

    SimpleCode explain formula: input kya aaya → auth/validation → DB change → response/UI.

    Viva tipFunction signature + 3-4 important lines + edge case.

  27. 27
    What fallback have you implemented to make sure the data is not leaked
    Times asked 2
    Official solution

    SimpleLive UI change: relevant CSS/HTML template kholo — color, margin, flex, bootstrap class. Save + hard refresh.

    Example

    /* button red */
    .btn-primary { background: red; }
    
    /* center navbar item */
    .navbar { justify-content: center; }

    Viva tipDevTools se pehle try, phir file mein permanent change.

  28. 28
    What is cached when you use the cache.cached decorator
    Times asked 1
    Official solution

    Simplelogin_required jaisa decorator protected routes pe: session nahi to login redirect.

    Example

    def login_required(fn):
        @wraps(fn)
        def wrapper(*a, **k):
            if 'user_id' not in session:
                return redirect(url_for('auth.login'))
            return fn(*a, **k)
        return wrapper
Advice: The proctor was chill and majorly went into depth because I kept giving answers in detailed and we basically talked a lot about how the inner workings for a lot of databases and apis. If you know you can go into detail while answering but only if you know do this otherwise you might go blank as to what the person is asking.
  1. 1
    Have you used slots and props?
    Times asked 2
    Official solution

    SimpleSlots = dabbe ke andar parent apna HTML daal de. Props data, slots markup.

    Default slot, named slots. App.vue router-view layout jaisa outlet.

    Agar nahi use kiya: 'layout router-view se kiya' valid.

    Component = reusable UI block (Navbar, Card). Props parent→child data, emit child→parent event. Slots parent HTML inner content.

    computed cache + reactive derive (filtered list). watch side-effect (query change pe API). methods events. ref() primitive, reactive() object. Vuex/Pinia global store; localStorage persist, store nahi.

    SFC: template + script + style ek .vue file. Parent-child exam favourite: list parent, row child :item + @delete.

    Example

    <div class="card"><slot>Default</slot></div>
    <Card><p>Custom body</p></Card>

    Project example: Card.vue <slot>Default</slot>. Parent custom body.

  2. 2
    Jsonify VS marshal
    Times asked 1
    Official solution

    Simplejsonify Python dict/list ko JSON response + proper Content-Type deta hai.

    Example

    return jsonify(message='ok', count=3), 200
  3. 3
    Used any derivative and show, why used it?
    Times asked 2
    Official solution

    SimpleVue directive = special attr: v-if, v-for, v-model, v-bind, v-show — DOM ko declarative control.

  4. 4
    What is decorator and how it differs from a function.
    Times asked 2
    Official solution

    Simplelogin_required jaisa decorator protected routes pe: session nahi to login redirect.

    Example

    def login_required(fn):
        @wraps(fn)
        def wrapper(*a, **k):
            if 'user_id' not in session:
                return redirect(url_for('auth.login'))
            return fn(*a, **k)
        return wrapper
  5. 5
    He mainly focused on code changes and asked theoretical questions mentioned in this gsheet.
    Times asked 2
    Official solution

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

Advice: Should have good idea about the code
  1. 1
    What us __repr__ used in the model
    Times asked 2
    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)
  2. 2
    What is blueprint in flask
    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.

  3. 3
    How will interchanging the position of @jwt_required and @role_required affect the working of application
    Times asked 2
    Official solution

    SimpleCode explain formula: input kya aaya → auth/validation → DB change → response/UI.

    Viva tipFunction signature + 3-4 important lines + edge case.

  4. 4
    Jsonify vs json package
    Times asked 2
    Official solution

    Simplejsonify Python dict/list ko JSON response + proper Content-Type deta hai.

    Example

    return jsonify(message='ok', count=3), 200
  5. 5
    Difference between 400, 401, 403 and 404 code
    Times asked 2
    Official solution

    SimpleUngli rakhe to 4-line formula — panic ki jagah structure.

    1) File ka role: model / Flask route / Vue SFC / celery task / config
    2) Input kahan: JSON, params, token, props, $route
    3) Kya kaam: query, cache, validation, .delay()
    4) Output: jsonify, this.items, email, redirect

    Unknown keyword: import, decorator, if, commit — har ka reason. Bluff mat.

    Suggested flow1) Kaunsi layer?
    2) Input?
    3) DB/cache/task?
    4) Response/UI?

    Project example: Booking POST: jwt, seats check, commit, 201, Vue list push.

    Viva tipUnknown keyword: import, decorator, if, commit — har ka reason. Panic mat.

  6. 6
    In db.String(128) what is 128, how it is stored in the memory
    Times asked 2
    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.

  7. 7
    Difference between synchronous and asynchronous Apart from these He asked to optimize a piece of my code which has a few if conditions, without using if-else conditions Asked to implement a drop down menu to enter some data in a form
    Times asked 2
    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
Advice: You should know whatever you have written in your code, he can ask questions from any part of the code Overall the proctor is very good
  1. 1
    Demonstration of app
    Times asked 2
    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.

  2. 2
    Found a bug, Gave some time to clear it. I could partially do. Moved on.
    Times asked 2
    Official solution

    SimpleDebug: terminal traceback padho, print/logging, Flask debug, browser Network/Console, reproduce minimum steps.

  3. 3
    Asked to implement "search by username" functionality.
    Times asked 2
    Official solution

    SimpleSearch: form/query param → ilike filter → results template.

    Example

    q = request.args.get('q', '').strip()
    lots = Lot.query.filter(Lot.name.ilike(f'%{q}%')).all()
  4. 4
    Prioritizing celery tasks
    Times asked 2
    Official solution

    SimpleCelery = background naukri. HTTP request ko 10 second email bhejne ke liye mat rokna.

    Distributed task queue: aap function ko abhi nahi, worker process mein later/retry/schedule pe chalaate ho.

    MAD2 typical jobs: daily reminder mail, monthly HTML report, user-triggered CSV export.

    Web request 200ms hona chahiye. 10,000 emails request thread mein = timeout. Worker alag CPU pe kaam kare.

    Redis broker chahiye. Beat alag process schedule ke liye.

    Example

    @celery.task
    def daily_reminder():
        for u in User.query.filter_by(active=True):
            send_mail(u.email, 'Book something today!')

    Project example: User Export click → 202 Accepted. Worker CSV + email. Daily 6pm Beat reminder.

    Viva tipWorker + Redis bina Beat ke user-triggered chalega. Scheduled jobs ke liye Beat bhi chahiye.

  5. 5
    Can we replace primary key with unique+not null+auto increment
    Times asked 1
    Official solution

    SimplePrimary key row ka unique identity — usually id Integer autoincrement.

    Example

    id = db.Column(db.Integer, primary_key=True)
  6. 6
    json vs jsonify, json.dumps , websocket vs webhooks
    Times asked 2
    Official solution

    Simplejsonify Python dict/list ko JSON response + proper Content-Type deta hai.

    Example

    return jsonify(message='ok', count=3), 200
  7. 7
    Props in Vue
    Times asked 2
    Official solution

    SimpleVue = UI ka smart assistant. Data badlo, screen khud update. MAD1 Jinja har click pe naya HTML.

    Progressive frontend framework. Components, reactivity, directives.

    MAD2 SPA: ek index.html, Vue Router pages, Flask sirf JSON.

    Fayde: easy, SFC, docs. Vs React: templates HTML-like, course sikhata hai. Vs plain JS: baar-baar DOM mat chhedo.

    Example

    <!-- HelloWorld.vue -->
    <template>
      <h1>{{ msg }}</h1>
    </template>
    <script>
    export default { data() { return { msg: 'Hello' } } }
    </script>

    Project example: Navbar.vue + views (Login, Dashboard). data() / setup() reactive. fetch APIs.

    Viva tipFayde: easy, SFC, reactivity. Vs React: chhota learning curve. Vs plain JS: UI state auto-update.

  8. 8
    what is Flask(__name__). Can we remove the __name__ parameter?
    Times asked 1
    Official solution

    SimpleFlask lightweight Python web framework — routes, request/response, templates. MAD1 ka backend yahi hai.

    Example

    from flask import Flask
    app = Flask(__name__)
    
    @app.route('/')
    def home():
        return 'Hello'

    Viva tipFlask micro hai: jo chahiye (DB, login, forms) khud jodte ho.

  9. 9
    WSGI
    Times asked 1
    Official solution

    SimpleWSGI contract: server Flask ko call kare. Werkzeug routing URL→view.

    gunicorn WSGI prod. Flask dev server nahi prod. How Flask decides function: URL map + method.

    Flask Python micro web framework. Route decorator URL → function. MAD2 mein JSON API: request.get_json(), jsonify, JWT.

    WSGI: server (Werkzeug) app ko call. if __name__ == '__main__' sirf direct run. Factory create_app() test/celery ke liye.

    Blueprint/resources folders. @app.route vs MethodView. Debug=True viva local, prod nahi. CORS alag port Vue ke liye.

    Project example: Dev flask run. Prod idea gunicorn wsgi:app.

  10. 10
    Can we change db models when the app is in production (live). How?
    Times asked 2
    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)
  11. 11
    where did you use flask_security
    Times asked 1
    Official solution

    SimpleFlask lightweight Python web framework — routes, request/response, templates. MAD1 ka backend yahi hai.

    Example

    from flask import Flask
    app = Flask(__name__)
    
    @app.route('/')
    def home():
        return 'Hello'

    Viva tipFlask micro hai: jo chahiye (DB, login, forms) khud jodte ho.

  12. 12
    Gave a detailed feedback on what could be improved in the app.
    Times asked 2
    Official solution

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

  1. 1
    Proctor was a chill person, probably kept on increasing difficulty of questions because I kept answering.
    Times asked 2
    Official solution

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

  2. 2
    2) went through models
    Times asked 2
    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)
  3. 3
    BACKEND
    Times asked 2
    Official solution

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

  4. 4
    what is __repr__ (w.r.t. models)?
    Times asked 2
    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)
  5. 5
    __repr__ vs __str__
    Times asked 2
    Official solution

    SimpleUngli rakhe to 4-line formula — panic ki jagah structure.

    1) File ka role: model / Flask route / Vue SFC / celery task / config
    2) Input kahan: JSON, params, token, props, $route
    3) Kya kaam: query, cache, validation, .delay()
    4) Output: jsonify, this.items, email, redirect

    Unknown keyword: import, decorator, if, commit — har ka reason. Bluff mat.

    Suggested flow1) Kaunsi layer?
    2) Input?
    3) DB/cache/task?
    4) Response/UI?

    Project example: Booking POST: jwt, seats check, commit, 201, Vue list push.

    Viva tipUnknown keyword: import, decorator, if, commit — har ka reason. Panic mat.

  6. 6
    what are dunder methods?
    Times asked 1
    Official solution

    SimpleDunder __name__ special. __init__ __repr__ __tablename__. _private convention not encryption.

    Why underscores in Python. Dunder methods.

    Pehle 1-line definition, phir related MAD2 layer (Vue SFC / Flask route / models.py / tasks.py / Redis).

    4-line formula: input kahan se aaya, auth/validation kaunsa, DB ya cache ya Celery, kya return.

    Related mix mat karo — cache ≠ Celery, authentication ≠ authorization, v-if ≠ v-show, Beat ≠ Worker. Follow-up ke liye ek difference ready rakho.

    Project example: if __name__ == '__main__'.

  7. 7
    what are decorators?
    Times asked 2
    Official solution

    Simplelogin_required jaisa decorator protected routes pe: session nahi to login redirect.

    Example

    def login_required(fn):
        @wraps(fn)
        def wrapper(*a, **k):
            if 'user_id' not in session:
                return redirect(url_for('auth.login'))
            return fn(*a, **k)
        return wrapper
  8. 8
    write hello world decorator
    Times asked 1
    Official solution

    Simplelogin_required jaisa decorator protected routes pe: session nahi to login redirect.

    Example

    def login_required(fn):
        @wraps(fn)
        def wrapper(*a, **k):
            if 'user_id' not in session:
                return redirect(url_for('auth.login'))
            return fn(*a, **k)
        return wrapper
  9. 9
    cache.memoize vs cache.cached
    Times asked 1
    Official solution

    Simplecached poori view ko yaad rakhta hai, memoize function ke arguments ke hisaab se.

    @cache.cached URL / key_prefix (optional query_string) se key banata hai — list endpoints ke liye.
    @cache.memoize arguments se key banata hai — get_user(5) aur get_user(9) alag cache.

    Prefix clash se galat data mil sakta hai. Dono ka timeout same idea hai. Invalidation: delete_memoized(fn, args) vs cache.delete(prefix).

    Example

    @cache.cached(timeout=30, key_prefix='home')
    def home(): ...
    
    @cache.memoize(30)
    def get_user(user_id): ...  # alag key per user_id

    Project example: Venues list = cached. User-wise report function = memoize(user_id).

    Viva tipList endpoint: cached. Function with arguments: memoize. Prefix alag rakho warna clash.

  10. 10
    POST vs PUT vs PATCH
    Times asked 1
    Official solution

    SimplePOST naya janam (har baar naya id). PUT poori photo replace. PATCH sticker chipkao.

    POST create, not idempotent. PUT full update, idempotent. PATCH partial.

    POST ki jagah PUT se REST semantics toot. GET typically no body.

    CRUD map: POST create, GET read, PUT/PATCH update, DELETE delete.

    Pehle 1-line definition, phir related MAD2 layer (Vue SFC / Flask route / models.py / tasks.py / Redis).

    4-line formula: input kahan se aaya, auth/validation kaunsa, DB ya cache ya Celery, kya return.

    Related mix mat karo — cache ≠ Celery, authentication ≠ authorization, v-if ≠ v-show, Beat ≠ Worker. Follow-up ke liye ek difference ready rakho.

    Example

    POST /api/venues
    PUT  /api/venues/1   {all fields}
    PATCH /api/venues/1 {only name}

    Project example: POST /api/venues create. PUT /venues/1 saari fields. PATCH sirf name.

  11. 11
    what is Exception handling, and have you used it? Show
    Times asked 1
    Official solution

    Simpletry/except. Catch Exception not BaseException (SystemExit). IntegrityError 404 abort.

    Exception handling. Types ValueError TypeError KeyError IntegrityError HTTPException.

    Pehle 1-line definition, phir related MAD2 layer (Vue SFC / Flask route / models.py / tasks.py / Redis).

    4-line formula: input kahan se aaya, auth/validation kaunsa, DB ya cache ya Celery, kya return.

    Related mix mat karo — cache ≠ Celery, authentication ≠ authorization, v-if ≠ v-show, Beat ≠ Worker. Follow-up ke liye ek difference ready rakho.

    Example

    try:
        db.session.commit()
    except IntegrityError:
        db.session.rollback()
        return jsonify(msg='duplicate'), 400

    Project example: commit except rollback 400.

  12. 12
    what are different types of exceptions in python?
    Times asked 1
    Official solution

    SimpleValueError TypeError KeyError IntegrityError HTTPException. Specific catch.

    Different types of exceptions.

    Pehle 1-line definition, phir related MAD2 layer (Vue SFC / Flask route / models.py / tasks.py / Redis).

    4-line formula: input kahan se aaya, auth/validation kaunsa, DB ya cache ya Celery, kya return.

    Related mix mat karo — cache ≠ Celery, authentication ≠ authorization, v-if ≠ v-show, Beat ≠ Worker. Follow-up ke liye ek difference ready rakho.

    Project example: Name 3 you used.

    Project example: Name 3 you used.

  13. 13
    what is the base class of Exceptions
    Times asked 1
    Official solution

    Simple:class object/array/string dynamic CSS.

    Purpose dynamic class. Error red.

    Directives Vue ke special attributes hain — HTML ko superpower: v-if/v-show, v-for, v-bind (:), v-on (@), v-model.

    v-if DOM se hataata/jodta. v-show sirf CSS display. Rare/permission: v-if. Bar-bar toggle: v-show. v-model two-way form. v-bind one-way JS→attribute.

    :key v-for pe zaroori warna Vue galat reuse. v-html XSS. Secret UI ke liye sirf v-if kaafi nahi — API 403 bhi.

    MAD1 Jinja server HTML. MAD2 yeh directives browser mein reactive.

    Example

    <div :class="{ 'text-danger': error, 'fw-bold': important }">Msg</div>

    Project example: :class="{ 'text-danger': error }"

  14. 14
    400 vs 401 status code
    Times asked 2
    Official solution

    SimpleStatus code server ka result: 200 OK, 302 redirect, 400 bad input, 401/403 auth, 404 not found, 500 server error.

  15. 15
    webhook vs websocket
    Times asked 2
    Official solution

    SimpleUngli rakhe to 4-line formula — panic ki jagah structure.

    1) File ka role: model / Flask route / Vue SFC / celery task / config
    2) Input kahan: JSON, params, token, props, $route
    3) Kya kaam: query, cache, validation, .delay()
    4) Output: jsonify, this.items, email, redirect

    Unknown keyword: import, decorator, if, commit — har ka reason. Bluff mat.

    Suggested flow1) Kaunsi layer?
    2) Input?
    3) DB/cache/task?
    4) Response/UI?

    Project example: Booking POST: jwt, seats check, commit, 201, Vue list push.

    Viva tipUnknown keyword: import, decorator, if, commit — har ka reason. Panic mat.

  16. 16
    session vs cookies
    Times asked 2
    Official solution

    SimpleMAD1 mein usually session-based auth: login pe session['user_id'], har request pe verify.

    Example

    session['user_id'] = user.id
    uid = session.get('user_id')
    user = User.query.get(uid)

    Viva tipSECRET_KEY set karo warna session insecure. logout pe session.clear().

  17. 17
    FRONTEND
    Times asked 2
    Official solution

    SimpleMAD1 frontend usually Jinja templates + HTML/CSS/Bootstrap (+ thoda JS). MAD2 pe Vue ho to clearly bolo.

  18. 18
    what are routes and how are you using them?
    Times asked 2
    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.

  19. 19
    There were probably a few more, I dont remember right now.
    Times asked 2
    Official solution

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

  20. 20
    He seemed to be going with the flow, asked questions from what all you showed him. Counter questions if he feels that you have some lack of clarity in your answers.
    Times asked 2
    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.

  21. 21
    Good Luck!
    Times asked 2
    Official solution

    SimpleEnd of viva note — kuch extra nahi. Agar time bache to ek unique feature highlight karo.

  1. 1
    Started with project demo, check the revoke access functionality thoroughly. Then checked the codes and asked below questions. Overall most questions were already asked before before in this document and that helped me a lot. 1.What is caching and why to use it ?
    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.

  2. 2
    Difference between json and jsonify ?
    Times asked 1
    Official solution

    Simplejson.dumps Python object ko JSON string banata hai, jsonify Flask Response banata hai (header ke saath).

    json.dumps({'ok': True}) → '{"ok": true}' (sirf string)

    jsonify(ok=True) → HTTP response, Content-Type: application/json
    
    API route mein jsonify use karo:
    @app.route('/api/users')
    def users():
        return jsonify([{'id': u.id, 'name': u.name} for u in User.query.all()])

    json.dumps se return karoge to browser ise text samajh sakta hai, JSON nahi.

  3. 3
    Make code changes in celery tasks file to change priority of daily_reminder and monthly_reminder
    Times asked 2
    Official solution

    SimpleCelery = background naukri. HTTP request ko 10 second email bhejne ke liye mat rokna.

    Distributed task queue: aap function ko abhi nahi, worker process mein later/retry/schedule pe chalaate ho.

    MAD2 typical jobs: daily reminder mail, monthly HTML report, user-triggered CSV export.

    Web request 200ms hona chahiye. 10,000 emails request thread mein = timeout. Worker alag CPU pe kaam kare.

    Redis broker chahiye. Beat alag process schedule ke liye.

    Example

    @celery.task
    def daily_reminder():
        for u in User.query.filter_by(active=True):
            send_mail(u.email, 'Book something today!')

    Project example: User Export click → 202 Accepted. Worker CSV + email. Daily 6pm Beat reminder.

    Viva tipWorker + Redis bina Beat ke user-triggered chalega. Scheduled jobs ke liye Beat bhi chahiye.

  4. 4
    What does lazy=dynamic in models and cascade='all,delete-orphan' do ? can we do it in opposite way ?
    Times asked 1
    Official solution

    SimpleCascade parent delete pe children pe kya ho: delete-orphan related rows hata deta hai.

    Example

    db.relationship('Spot', cascade='all, delete-orphan')

    Viva tipParking lot delete → uske spots/bookings policy clear bolo.

  5. 5
    Explain the different endpoints of api implement in project and why we use them ?
    Times asked 2
    Official solution

    SimpleCode explain formula: input kya aaya → auth/validation → DB change → response/UI.

    Viva tipFunction signature + 3-4 important lines + edge case.

  6. 6
    Explain the Models in your project birefly (How many tables and how are they connected)
    Times asked 2
    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)
  7. 7
    Differece bw prmary key and unique key ?
    Times asked 2
    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
    Can we use auto-increment instead of primary key ? will it serve the purpose ? if not why ?
    Times asked 2
    Official solution

    SimplePrimary key row ka unique identity — usually id Integer autoincrement.

    Example

    id = db.Column(db.Integer, primary_key=True)
  1. 1
    Difference between memcache and rediscache
    Times asked 2
    Official solution

    SimpleUngli rakhe to 4-line formula — panic ki jagah structure.

    1) File ka role: model / Flask route / Vue SFC / celery task / config
    2) Input kahan: JSON, params, token, props, $route
    3) Kya kaam: query, cache, validation, .delay()
    4) Output: jsonify, this.items, email, redirect

    Unknown keyword: import, decorator, if, commit — har ka reason. Bluff mat.

    Suggested flow1) Kaunsi layer?
    2) Input?
    3) DB/cache/task?
    4) Response/UI?

    Project example: Booking POST: jwt, seats check, commit, 201, Vue list push.

    Viva tipUnknown keyword: import, decorator, if, commit — har ka reason. Panic mat.

  2. 2
    difference and use of Unique key, primary key in sql
    Times asked 2
    Official solution

    SimplePrimary key row ka unique identity — usually id Integer autoincrement.

    Example

    id = db.Column(db.Integer, primary_key=True)
  3. 3
    What if we swap order of : @jwt required and @role required
    Times asked 1
    Official solution

    SimpleJWT teen tukde ki signed chitthi: header.payload.signature. Padhi ja sakti hai, badli nahi ja sakti.

    Encoded (Base64) + signed, encrypted nahi (JWE alag). Payload mein password mat daalo — koi jwt.io pe dekh lega.

    Login pe server secret se HMAC (HS256). Har API Authorization: Bearer <token>.
    Expiry exp. Change payload → signature fail → 401.

    Session MAD1 server yaad rakhta. JWT MAD2 client rakhta, server stateless-ish.

    Example

    eyJhbGciOiJIUzI1NiJ9.{"sub":1,"role":"admin"}.signature
    # Authorization: Bearer <token>

    Project example: POST /login → token LS. fetch interceptor header. @jwt_required APIs.

    Viva tipAlgo HS256. Secret env var. jwt.io pe payload dikhao, secret public site pe mat paste.

  4. 4
    How to prioritise a task in celery
    Times asked 2
    Official solution

    SimpleCode explain formula: input kya aaya → auth/validation → DB change → response/UI.

    Viva tipFunction signature + 3-4 important lines + edge case.

  1. 1
    Components of celery
    Times asked 1
    Official solution

    SimpleClient (Flask .delay), Broker (Redis), Worker. Optional Beat + result backend.

    Viva line'Flask produce, Redis transport, worker consume.'

    include task modules, app context ke andar DB session. Windows pe eventlet/gevent issues — docs se command.

    Celery Python ka distributed task queue — HTTP request ko 10s email/CSV ke liye mat rokna.

    Flow: Flask .delay() → Redis broker → Worker execute. Beat alag process hai (clock): crontab padhke due time pe queue mein daalta hai. Beat khud mail nahi bhejta; Worker haath hai.

    MAD2 typical: daily reminder (Beat), monthly report (Beat), user Export CSV (button, Beat nahi). JS async/await browser event loop hai, Celery server-side process — mix mat karo.

    Demo: tin terminals — redis-server, celery worker, celery beat — plus Flask. MailHog :8025 inbox. Result backend se task SUCCESS poll optional.

    Project example: create_app ke baad celery.conf.update. tasks import taaki register hon.

    Viva tip

    Viva line'Flask task produce karta hai, Redis transport, worker consume.'

  2. 2
    What is dataclass
    Times asked 1
    Official solution

    Simple:class object/array/string dynamic CSS.

    Purpose dynamic class. Error red.

    Directives Vue ke special attributes hain — HTML ko superpower: v-if/v-show, v-for, v-bind (:), v-on (@), v-model.

    v-if DOM se hataata/jodta. v-show sirf CSS display. Rare/permission: v-if. Bar-bar toggle: v-show. v-model two-way form. v-bind one-way JS→attribute.

    :key v-for pe zaroori warna Vue galat reuse. v-html XSS. Secret UI ke liye sirf v-if kaafi nahi — API 403 bhi.

    MAD1 Jinja server HTML. MAD2 yeh directives browser mein reactive.

    Example

    <div :class="{ 'text-danger': error, 'fw-bold': important }">Msg</div>

    Project example: :class="{ 'text-danger': error }"

  1. 1
    Different btw memcached and redis cache
    Times asked 2
    Official solution

    SimpleDono RAM cache. Redis zyada smart: lists, hashes, pub/sub, persistence, Celery broker.

    Memcached: simple key-value, yahi. Redis: data structures + expire + optional disk dump.

    MAD2 Redis choose — cache aur broker ek hi process. Memcached Celery nahi chalaata.

    Redis in-memory key-value store hai — fridge pe sticky note, poori kitchen (SQL database) har baar mat kholo.

    MAD2 mein Redis do kaam: (1) cache — same venues/shows/dashboard JSON baar-baar DB se nahi (2) Celery broker — Flask task queue mein daalta hai, worker uthata hai.

    Flow: cache.get(key) → hit pe return, miss pe SQLAlchemy + SET with timeout. Admin write ke baad cache.delete, warna stale list.

    Source of truth database hi hai. Redis crash/band = cache miss (app chalni chahiye) + queue ruk sakti hai. Important bookings sirf Redis mein mat rakho.

    Alag: Redis ≠ Memcached (Celery broker nahi). Redis ≠ localStorage (woh browser). redis-cli ping → PONG viva proof.

    Project example: Tumhare config mein CACHE_TYPE RedisCache, CELERY broker redis://. Memcached nahi.

    Viva tipMAD2 mein Redis isliye — cache + broker ek hi tool. Memcached Celery nahi chalaata.

  2. 2
    What are slots
    Times asked 1
    Official solution

    SimpleSlots = dabbe ke andar parent apna HTML daal de. Props data, slots markup.

    Default slot, named slots. App.vue router-view layout jaisa outlet.

    Agar nahi use kiya: 'layout router-view se kiya' valid.

    Component = reusable UI block (Navbar, Card). Props parent→child data, emit child→parent event. Slots parent HTML inner content.

    computed cache + reactive derive (filtered list). watch side-effect (query change pe API). methods events. ref() primitive, reactive() object. Vuex/Pinia global store; localStorage persist, store nahi.

    SFC: template + script + style ek .vue file. Parent-child exam favourite: list parent, row child :item + @delete.

    Example

    <div class="card"><slot>Default</slot></div>
    <Card><p>Custom body</p></Card>

    Project example: Card.vue <slot>Default</slot>. Parent custom body.

  3. 3
    How to index in sqlalchemy
    Times asked 1
    Official solution

    SimpleSQLAlchemy MAD1 ka common ORM. Flask-SQLAlchemy wrapper se db.Model, db.session.

    Example

    user = User(email='a@b.com')
    db.session.add(user)
    db.session.commit()
    users = User.query.filter_by(role='admin').all()
  1. 1
    Demonstrate your project.
    Times asked 1
    Official solution

    SimpleDemo 5–7 min ki kahani: saari roles, koi milestone skip nahi, bolte-bolte dikhao.

    Examiner list tick karta hai. Crash ho to panic nahi — terminal error padho.

    Code tab kholna jab poochhein. Extra uncommitted features mat dikhana agar portal ZIP mein nahi.

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

    Project example: Jo statement/parking/jobs/tickets hai uske user+admin journeys.

    Viva tipBol: 'Yahan overbooking rokta hoon'. Mandatory features pehle, polish baad.

  2. 2
    Explain all the features implemented in your application.
    Times asked 1
    Official solution

    SimpleMilestone list tick. Extra last. Honest missing.

    Core: auth rbac crud search cache celery charts.

    Pehle 1-line definition, phir related MAD2 layer (Vue SFC / Flask route / models.py / tasks.py / Redis).

    4-line formula: input kahan se aaya, auth/validation kaunsa, DB ya cache ya Celery, kya return.

    Related mix mat karo — cache ≠ Celery, authentication ≠ authorization, v-if ≠ v-show, Beat ≠ Worker. Follow-up ke liye ek difference ready rakho.

    Project example: README features.

    Project example: README features.

  3. 3
    Explain your database schema and how the tables are connected.
    Times asked 1
    Official solution

    SimpleTables + lines (FK) + 1-M / M-M. Draw mentally, phir models.py.

    Har class: PK, important columns, relationships. Why normalized (no duplicate venue name in every show as only string without FK).

    Indexes search columns. Unique email. Cascade policy bookings pe.

    Pehle 1-line definition, phir related MAD2 layer (Vue SFC / Flask route / models.py / tasks.py / Redis).

    4-line formula: input kahan se aaya, auth/validation kaunsa, DB ya cache ya Celery, kya return.

    Related mix mat karo — cache ≠ Celery, authentication ≠ authorization, v-if ≠ v-show, Beat ≠ Worker. Follow-up ke liye ek difference ready rakho.

    Project example: User-Role M-M. User-Booking 1-M. Venue-Show 1-M. Show-Booking 1-M.

  4. 4
    Explain the search functionality in your project.
    Times asked 1
    Official solution

    SimpleSearch demo cases.

    See earlier essay.

    Examiner 2 cheezein: simple desi line + tumhare project ki exact file.

    Pehle ID, GitHub, portal ZIP. Phir run: Redis + Flask + worker + beat + Vue. Feature demo: login, RBAC, cache hit/miss, Celery mail, search.

    Line pe ungli: input kahan, kaunsa check, query/cache/task, JSON/UI. Copilot band. Jo nahi kiya honestly bolo + kaise add karte.

    Example

    q = request.args.get('q', '').strip()
    items = Venue.query.filter(Venue.name.ilike(f'%{q}%')).all()
    return jsonify([v.serialize() for v in items])

    Project example: UI + API.

    Viva tipEmpty search, no-match, case-insensitive (ilike) teen cases dikhao.

  5. 5
    Explain the API endpoints implemented in your project and why they are used.
    Times asked 1
    Official solution

    Simple3–4 routes deep: auth, validation, status, cache? Method body response error.

    Login, list, create. Why each.

    Pehle 1-line definition, phir related MAD2 layer (Vue SFC / Flask route / models.py / tasks.py / Redis).

    4-line formula: input kahan se aaya, auth/validation kaunsa, DB ya cache ya Celery, kya return.

    Related mix mat karo — cache ≠ Celery, authentication ≠ authorization, v-if ≠ v-show, Beat ≠ Worker. Follow-up ke liye ek difference ready rakho.

    Project example: Open resources, pick examiner's choice.

  6. 6
    Show the Celery jobs and explain the data flow.
    Times asked 1
    Official solution

    SimpleTask function, beat dict, delay() call, worker+beat terminals, MailHog/CSV.

    App context DB. Args serializable. How many jobs: reminder, monthly, export — gino honestly.

    Celery Python ka distributed task queue — HTTP request ko 10s email/CSV ke liye mat rokna.

    Flow: Flask .delay() → Redis broker → Worker execute. Beat alag process hai (clock): crontab padhke due time pe queue mein daalta hai. Beat khud mail nahi bhejta; Worker haath hai.

    MAD2 typical: daily reminder (Beat), monthly report (Beat), user Export CSV (button, Beat nahi). JS async/await browser event loop hai, Celery server-side process — mix mat karo.

    Demo: tin terminals — redis-server, celery worker, celery beat — plus Flask. MailHog :8025 inbox. Result backend se task SUCCESS poll optional.

    Project example: tasks.py + config schedule + POST export.

  7. 7
    Where did you use Flask-Security in your project?
    Times asked 2
    Official solution

    SimpleFlask-Security-Too: login, roles, hash, token, UserDatastore. Mixins models pe.

    create_user, add_role, hash_password. JWT-extended alternative. Jo use kiya import dikhao.

    Flask Python micro web framework. Route decorator URL → function. MAD2 mein JSON API: request.get_json(), jsonify, JWT.

    WSGI: server (Werkzeug) app ko call. if __name__ == '__main__' sirf direct run. Factory create_app() test/celery ke liye.

    Blueprint/resources folders. @app.route vs MethodView. Debug=True viva local, prod nahi. CORS alag port Vue ke liye.

    Example

    user_datastore = SQLAlchemyUserDatastore(db, User, Role)
    security = Security(app, user_datastore)

    Project example: __init__ Security(app, user_datastore). User(UserMixin).

  8. 8
    Have you referred to AI while writing your code?
    Times asked 1
    Official solution

    SimpleHaan/kitna, kahan, verification story. Report match.

    Same as AI percentage questions. Concrete bug you caught in AI code.

    Pehle 1-line definition, phir related MAD2 layer (Vue SFC / Flask route / models.py / tasks.py / Redis).

    4-line formula: input kahan se aaya, auth/validation kaunsa, DB ya cache ya Celery, kya return.

    Related mix mat karo — cache ≠ Celery, authentication ≠ authorization, v-if ≠ v-show, Beat ≠ Worker. Follow-up ke liye ek difference ready rakho.

    Project example: Celery Windows / cache stale AI galat tha, docs se fix.

  9. 9
    What is a Blueprint in Flask?
    Times asked 1
    Official solution

    SimpleBlueprint modules routes auth_bp api_bp. register_blueprint. Large structure.

    What is Blueprint.

    Flask Python micro web framework. Route decorator URL → function. MAD2 mein JSON API: request.get_json(), jsonify, JWT.

    WSGI: server (Werkzeug) app ko call. if __name__ == '__main__' sirf direct run. Factory create_app() test/celery ke liye.

    Blueprint/resources folders. @app.route vs MethodView. Debug=True viva local, prod nahi. CORS alag port Vue ke liye.

    Example

    api = Blueprint('api', __name__, url_prefix='/api')
    app.register_blueprint(api)

    Project example: If used api = Blueprint url_prefix /api. If not, all app.route OK course.

  10. 10
    What is Flask(__name__)? Can we remove the __name__ parameter?
    Times asked 1
    Official solution

    Simple__name__ tells Flask package location. Remove → config/templates confuse.

    Flask(__name__) can we remove? Don't casually.

    Flask Python micro web framework. Route decorator URL → function. MAD2 mein JSON API: request.get_json(), jsonify, JWT.

    WSGI: server (Werkzeug) app ko call. if __name__ == '__main__' sirf direct run. Factory create_app() test/celery ke liye.

    Blueprint/resources folders. @app.route vs MethodView. Debug=True viva local, prod nahi. CORS alag port Vue ke liye.

    Project example: create_app Flask(__name__).

  11. 11
    What is WSGI?
    Times asked 2
    Official solution

    SimpleWSGI contract: server Flask ko call kare. Werkzeug routing URL→view.

    gunicorn WSGI prod. Flask dev server nahi prod. How Flask decides function: URL map + method.

    Flask Python micro web framework. Route decorator URL → function. MAD2 mein JSON API: request.get_json(), jsonify, JWT.

    WSGI: server (Werkzeug) app ko call. if __name__ == '__main__' sirf direct run. Factory create_app() test/celery ke liye.

    Blueprint/resources folders. @app.route vs MethodView. Debug=True viva local, prod nahi. CORS alag port Vue ke liye.

    Project example: Dev flask run. Prod idea gunicorn wsgi:app.

  12. 12
    What is a Python decorator?
    Times asked 1
    Official solution

    SimpleDecorator wrap function @app.route @cache @celery.task @auth. Reusable cross-cut.

    Different from normal function: HOF wrap, miss easy if manual if. DRY order readable.

    Why use decorator: one place policy. @roles_required instantly.

    Flask Python micro web framework. Route decorator URL → function. MAD2 mein JSON API: request.get_json(), jsonify, JWT.

    WSGI: server (Werkzeug) app ko call. if __name__ == '__main__' sirf direct run. Factory create_app() test/celery ke liye.

    Blueprint/resources folders. @app.route vs MethodView. Debug=True viva local, prod nahi. CORS alag port Vue ke liye.

    Example

    def hello_world(fn):
        def wrapper(*a, **k):
            print('Hello World')
            return fn(*a, **k)
        return wrapper
    
    @hello_world
    def ping():
        return 'pong'

    Project example: Stack jwt then role. Explain trio route cached task.

  13. 13
    How is a decorator different from a normal function?
    Times asked 1
    Official solution

    SimpleDecorator HOF wrap vs helper inside each fn — forget easy. Order matters.

    How decorator different normal function.

    Flask Python micro web framework. Route decorator URL → function. MAD2 mein JSON API: request.get_json(), jsonify, JWT.

    WSGI: server (Werkzeug) app ko call. if __name__ == '__main__' sirf direct run. Factory create_app() test/celery ke liye.

    Blueprint/resources folders. @app.route vs MethodView. Debug=True viva local, prod nahi. CORS alag port Vue ke liye.

    Project example: @auth_required vs if not token in every view.

  14. 14
    Write a simple "Hello World" decorator.
    Times asked 1
    Official solution

    SimpleWrapper print Hello World phir fn. wraps keep name.

    Write simple Hello World decorator live.

    Pehle 1-line definition, phir related MAD2 layer (Vue SFC / Flask route / models.py / tasks.py / Redis).

    4-line formula: input kahan se aaya, auth/validation kaunsa, DB ya cache ya Celery, kya return.

    Related mix mat karo — cache ≠ Celery, authentication ≠ authorization, v-if ≠ v-show, Beat ≠ Worker. Follow-up ke liye ek difference ready rakho.

    Example

    from functools import wraps
    def hello(fn):
        @wraps(fn)
        def w(*a,**k):
            print('Hello World')
            return fn(*a,**k)
        return w

    Project example: Notepad.

  15. 15
    What are dunder methods in Python?
    Times asked 1
    Official solution

    SimpleDunder __name__ special. __init__ __repr__ __tablename__. _private convention not encryption.

    Why underscores in Python. Dunder methods.

    Pehle 1-line definition, phir related MAD2 layer (Vue SFC / Flask route / models.py / tasks.py / Redis).

    4-line formula: input kahan se aaya, auth/validation kaunsa, DB ya cache ya Celery, kya return.

    Related mix mat karo — cache ≠ Celery, authentication ≠ authorization, v-if ≠ v-show, Beat ≠ Worker. Follow-up ke liye ek difference ready rakho.

    Project example: if __name__ == '__main__'.

  16. 16
    What is __repr__()? How is it different from __str__()?
    Times asked 1
    Official solution

    Simple__repr__ debug unambiguous. __str__ readable. Fallback repr if no str. Dunder.

    How different repr str.

    Pehle 1-line definition, phir related MAD2 layer (Vue SFC / Flask route / models.py / tasks.py / Redis).

    4-line formula: input kahan se aaya, auth/validation kaunsa, DB ya cache ya Celery, kya return.

    Related mix mat karo — cache ≠ Celery, authentication ≠ authorization, v-if ≠ v-show, Beat ≠ Worker. Follow-up ke liye ek difference ready rakho.

    Example

    def __repr__(self):
        return f'<User {self.email}>'

    Project example: User __repr__ email.

  17. 17
    What is serialize() in models?
    Times asked 1
    Official solution

    Simplemodel → dict JSON. Hide password roles maybe. marshal alternative.

    What is serialize in models.

    Pehle 1-line definition, phir related MAD2 layer (Vue SFC / Flask route / models.py / tasks.py / Redis).

    4-line formula: input kahan se aaya, auth/validation kaunsa, DB ya cache ya Celery, kya return.

    Related mix mat karo — cache ≠ Celery, authentication ≠ authorization, v-if ≠ v-show, Beat ≠ Worker. Follow-up ke liye ek difference ready rakho.

    Example

    def serialize(self):
        return {'id': self.id, 'email': self.email, 'role': self.roles[0].name}

    Project example: def serialize return id email.

  18. 18
    What is exception handling?
    Times asked 1
    Official solution

    Simpletry/except. Catch Exception not BaseException (SystemExit). IntegrityError 404 abort.

    Exception handling. Types ValueError TypeError KeyError IntegrityError HTTPException.

    Pehle 1-line definition, phir related MAD2 layer (Vue SFC / Flask route / models.py / tasks.py / Redis).

    4-line formula: input kahan se aaya, auth/validation kaunsa, DB ya cache ya Celery, kya return.

    Related mix mat karo — cache ≠ Celery, authentication ≠ authorization, v-if ≠ v-show, Beat ≠ Worker. Follow-up ke liye ek difference ready rakho.

    Example

    try:
        db.session.commit()
    except IntegrityError:
        db.session.rollback()
        return jsonify(msg='duplicate'), 400

    Project example: commit except rollback 400.

  19. 19
    What are the different types of exceptions in Python?
    Times asked 1
    Official solution

    SimpleValueError TypeError KeyError IntegrityError HTTPException. Specific catch.

    Different types of exceptions.

    Pehle 1-line definition, phir related MAD2 layer (Vue SFC / Flask route / models.py / tasks.py / Redis).

    4-line formula: input kahan se aaya, auth/validation kaunsa, DB ya cache ya Celery, kya return.

    Related mix mat karo — cache ≠ Celery, authentication ≠ authorization, v-if ≠ v-show, Beat ≠ Worker. Follow-up ke liye ek difference ready rakho.

    Project example: Name 3 you used.

    Project example: Name 3 you used.

  20. 20
    What is the base class of all exceptions?
    Times asked 1
    Official solution

    SimpleBaseException sabka base. Usual catch Exception. Base includes SystemExit KeyboardInterrupt.

    Base class of all exceptions. Base Exception class Python.

    Pehle 1-line definition, phir related MAD2 layer (Vue SFC / Flask route / models.py / tasks.py / Redis).

    4-line formula: input kahan se aaya, auth/validation kaunsa, DB ya cache ya Celery, kya return.

    Related mix mat karo — cache ≠ Celery, authentication ≠ authorization, v-if ≠ v-show, Beat ≠ Worker. Follow-up ke liye ek difference ready rakho.

    Project example: Don't except: bare.

  21. 21
    What is a dataclass in Python?
    Times asked 1
    Official solution

    Simple@dataclass boilerplate-less. Models ke liye db.Model not dataclass alone.

    What is dataclass. Not replacement ORM.

    Pehle 1-line definition, phir related MAD2 layer (Vue SFC / Flask route / models.py / tasks.py / Redis).

    4-line formula: input kahan se aaya, auth/validation kaunsa, DB ya cache ya Celery, kya return.

    Related mix mat karo — cache ≠ Celery, authentication ≠ authorization, v-if ≠ v-show, Beat ≠ Worker. Follow-up ke liye ek difference ready rakho.

    Project example: If unused theory. Maybe DTOs.

  22. 22
    What are the default ports for Flask and Vue (CLI/Vite)?
    Times asked 1
    Official solution

    SimpleFlask 5000. Vue CLI 8080 Vite 5173 Redis 6379. Change flask run -p 8000 CORS update.

    Default ports Flask and Vue. Change port 5000 to 8000.

    Pehle 1-line definition, phir related MAD2 layer (Vue SFC / Flask route / models.py / tasks.py / Redis).

    4-line formula: input kahan se aaya, auth/validation kaunsa, DB ya cache ya Celery, kya return.

    Related mix mat karo — cache ≠ Celery, authentication ≠ authorization, v-if ≠ v-show, Beat ≠ Worker. Follow-up ke liye ek difference ready rakho.

    Project example: baseURL and CORS origin together.

  23. 23
    What is SMTP, and what port does it use?
    Times asked 1
    Official solution

    SimpleSMTP = email bhejne ka protocol, jaise HTTP web ka.

    Ports: 587 STARTTLS, 465 SMTPS, 25 server-server. Dev: MailHog 1025.

    Flask-Mail wrap. Sync send slow — Celery task se bhejo.

    Fayda: universal. Nuksaan: spam, deliverability (SPF/DKIM), no guarantee like API.

    Example

    app.config['MAIL_SERVER'] = 'localhost'
    app.config['MAIL_PORT'] = 1025
    mail.send(Message('Hi', recipients=['a@b.com'], body='Hello'))

    Project example: MAIL_SERVER=localhost MAIL_PORT=1025. Production later SendGrid/SES.

    Viva tipFayda: universal. Nuksaan: deliverability, spam, sync send slow — isliye Celery + MailHog in dev.

  24. 24
    What is the difference between a Primary Key and a Unique Key?
    Times asked 3
    Official solution

    SimplePK row ka aadhaar number. FK doosre ke aadhaar ka reference. Unique alag constraint.

    PK chosen candidate key, identity, ORM expect. UNIQUE+NOT NULL+AUTO_INCREMENT almost lekin PK use karo.

    Relationship FK+PK. Unique email alag.

    Example

    user_id = db.Column(db.Integer, db.ForeignKey('user.id', ondelete='CASCADE'))

    Project example: id PKs. FKs user_id. email unique.

    Viva tipPK = chosen candidate key. UNIQUE+NOT NULL+AUTO_INCREMENT almost PK jaisa but PK table ka identity + default cluster/index + ORM expect karta hai.

  25. 25
    Can a Primary Key be replaced with UNIQUE + NOT NULL + AUTO_INCREMENT? Why or why not?
    Times asked 2
    Official solution

    SimpleUNIQUE+NOT NULL+AUTO_INCREMENT almost PK lekin PK identity ORM/FK expect. Use real PK.

    Can PK be replaced with that combo. Why not conceptually.

    Pehle 1-line definition, phir related MAD2 layer (Vue SFC / Flask route / models.py / tasks.py / Redis).

    4-line formula: input kahan se aaya, auth/validation kaunsa, DB ya cache ya Celery, kya return.

    Related mix mat karo — cache ≠ Celery, authentication ≠ authorization, v-if ≠ v-show, Beat ≠ Worker. Follow-up ke liye ek difference ready rakho.

    Project example: We have primary_key=True.

  26. 26
    What is indexing, and why is it used?
    Times asked 1
    Official solution

    SimpleIndex kitab ki suchi — search tez, write thoda mehnga.

    B-tree typically. filter wale columns, FKs. Over-index mat.

    joinedload N+1 alag.

    Pehle 1-line definition, phir related MAD2 layer (Vue SFC / Flask route / models.py / tasks.py / Redis).

    4-line formula: input kahan se aaya, auth/validation kaunsa, DB ya cache ya Celery, kya return.

    Related mix mat karo — cache ≠ Celery, authentication ≠ authorization, v-if ≠ v-show, Beat ≠ Worker. Follow-up ke liye ek difference ready rakho.

    Example

    db.Column(db.String(80), index=True)
    db.Index('ix_name_city', User.name, User.city)

    Project example: email index, venue.name search index.

  27. 27
    How do you create an index on multiple columns in SQLAlchemy?
    Times asked 1
    Official solution

    SimpleIndex kitab ki suchi — search tez, write thoda mehnga.

    B-tree typically. filter wale columns, FKs. Over-index mat.

    joinedload N+1 alag.

    Pehle 1-line definition, phir related MAD2 layer (Vue SFC / Flask route / models.py / tasks.py / Redis).

    4-line formula: input kahan se aaya, auth/validation kaunsa, DB ya cache ya Celery, kya return.

    Related mix mat karo — cache ≠ Celery, authentication ≠ authorization, v-if ≠ v-show, Beat ≠ Worker. Follow-up ke liye ek difference ready rakho.

    Example

    db.Column(db.String(80), index=True)
    db.Index('ix_name_city', User.name, User.city)

    Project example: email index, venue.name search index.

  28. 28
    What does db.String(128) mean? How is 128 stored internally?
    Times asked 1
    Official solution

    SimpleString(128) VARCHAR max 128. TEXT unbounded. 128 metadata length.

    How 128 stored internally — varchar.

    Pehle 1-line definition, phir related MAD2 layer (Vue SFC / Flask route / models.py / tasks.py / Redis).

    4-line formula: input kahan se aaya, auth/validation kaunsa, DB ya cache ya Celery, kya return.

    Related mix mat karo — cache ≠ Celery, authentication ≠ authorization, v-if ≠ v-show, Beat ≠ Worker. Follow-up ke liye ek difference ready rakho.

    Project example: password hash column 128/256 enough.

    Project example: password hash column 128/256 enough.

  29. 29
    What does lazy="dynamic" do in SQLAlchemy relationships?
    Times asked 1
    Official solution

    SimpleReturns query not list — further filter. Big collections.

    lazy=dynamic.

    ORM objects ko tables se map karta hai — raw SQL kam. SQLAlchemy MAD2 default.

    class User(db.Model) + Column + relationship. query.filter_by / db.session.get. Fayda: portable SQLite→Postgres, injection se safer. Nuksaan: N+1, complex SQL.

    SQLite file, zero server — course friendly. Postgres scale. Relationships: FK, backref, lazy/joinedload, cascade on delete. Constraints unique/not null integrity.

    Bookings source of truth DB, Redis cache copy.

    Project example: If used, show filter on relationship.

  30. 30
    What does cascade="all, delete-orphan" do? Can it work the opposite way?
    Times asked 1
    Official solution

    Simplecascade all = save-update merge refresh-expire expunge delete. delete-orphan extra.

    cascade='all' options.

    ORM objects ko tables se map karta hai — raw SQL kam. SQLAlchemy MAD2 default.

    class User(db.Model) + Column + relationship. query.filter_by / db.session.get. Fayda: portable SQLite→Postgres, injection se safer. Nuksaan: N+1, complex SQL.

    SQLite file, zero server — course friendly. Postgres scale. Relationships: FK, backref, lazy/joinedload, cascade on delete. Constraints unique/not null integrity.

    Bookings source of truth DB, Redis cache copy.

    Project example: Show string in models.

  31. 31
    What are joins in databases?
    Times asked 1
    Official solution

    SimpleJOIN ON fk=pk. inner match dono. left left saari. SQLAlchemy .join(User.roles).

    What are joins. Explain SQL joins.

    ORM objects ko tables se map karta hai — raw SQL kam. SQLAlchemy MAD2 default.

    class User(db.Model) + Column + relationship. query.filter_by / db.session.get. Fayda: portable SQLite→Postgres, injection se safer. Nuksaan: N+1, complex SQL.

    SQLite file, zero server — course friendly. Postgres scale. Relationships: FK, backref, lazy/joinedload, cascade on delete. Constraints unique/not null integrity.

    Bookings source of truth DB, Redis cache copy.

    Project example: bookings join user email list.

  32. 32
    Can database models be changed after the application is deployed to production? If yes, how?
    Times asked 1
    Official solution

    SimpleHaan migrations Alembic expand-contract. Direct drop dangerous. Backward compatible deploys.

    Can models change after production? Yes how.

    ORM objects ko tables se map karta hai — raw SQL kam. SQLAlchemy MAD2 default.

    class User(db.Model) + Column + relationship. query.filter_by / db.session.get. Fayda: portable SQLite→Postgres, injection se safer. Nuksaan: N+1, complex SQL.

    SQLite file, zero server — course friendly. Postgres scale. Relationships: FK, backref, lazy/joinedload, cascade on delete. Constraints unique/not null integrity.

    Bookings source of truth DB, Redis cache copy.

    Project example: Flask-Migrate / create_all only dev.

  33. 33
    What is caching, and why is it used?
    Times asked 1
    Official solution

    SimpleCache = pehli baar hisaab karke copy rakh lo, doosri baar copy dikha do.

    Baar-baar same expensive kaam (DB query, counting bookings) mat karo. Result Redis jaise store mein timeout ke saath rakh do.

    Cache hit: key mil gayi, DB skip. Cache miss: DB se lao, SET karo, return karo.

    Tradeoff: speed vs stale data. Admin naya venue add kare aur cache 50s ka ho to user purani list dekh sakta hai — isliye write pe invalidation zaroori hai.

    Browser cache, Flask-Caching, Redis alag layers hain. MAD2 examiner Redis + @cache.cached code dekhta hai.

    Example

    @cache.cached(timeout=50, query_string=True)
    @app.route('/api/shows')
    def shows():
        return jsonify([s.serialize() for s in Show.query.all()])

    Project example: Admin dashboard counts / venues list cache. Create/update/delete ke baad cache.delete('venues').

    Viva tipprint('DB queried') function ke andar laga ke miss/hit demo karo — hit pe print nahi chalega.

  34. 34
    What is the difference between cache.cached and cache.memoize?
    Times asked 1
    Official solution

    Simplecached poori view ko yaad rakhta hai, memoize function ke arguments ke hisaab se.

    @cache.cached URL / key_prefix (optional query_string) se key banata hai — list endpoints ke liye.
    @cache.memoize arguments se key banata hai — get_user(5) aur get_user(9) alag cache.

    Prefix clash se galat data mil sakta hai. Dono ka timeout same idea hai. Invalidation: delete_memoized(fn, args) vs cache.delete(prefix).

    Example

    @cache.cached(timeout=30, key_prefix='home')
    def home(): ...
    
    @cache.memoize(30)
    def get_user(user_id): ...  # alag key per user_id

    Project example: Venues list = cached. User-wise report function = memoize(user_id).

    Viva tipList endpoint: cached. Function with arguments: memoize. Prefix alag rakho warna clash.

  35. 35
    What is the difference between Memcached and Redis?
    Times asked 2
    Official solution

    SimpleDono RAM cache. Redis zyada smart: lists, hashes, pub/sub, persistence, Celery broker.

    Memcached: simple key-value, yahi. Redis: data structures + expire + optional disk dump.

    MAD2 Redis choose — cache aur broker ek hi process. Memcached Celery nahi chalaata.

    Redis in-memory key-value store hai — fridge pe sticky note, poori kitchen (SQL database) har baar mat kholo.

    MAD2 mein Redis do kaam: (1) cache — same venues/shows/dashboard JSON baar-baar DB se nahi (2) Celery broker — Flask task queue mein daalta hai, worker uthata hai.

    Flow: cache.get(key) → hit pe return, miss pe SQLAlchemy + SET with timeout. Admin write ke baad cache.delete, warna stale list.

    Source of truth database hi hai. Redis crash/band = cache miss (app chalni chahiye) + queue ruk sakti hai. Important bookings sirf Redis mein mat rakho.

    Alag: Redis ≠ Memcached (Celery broker nahi). Redis ≠ localStorage (woh browser). redis-cli ping → PONG viva proof.

    Project example: Tumhare config mein CACHE_TYPE RedisCache, CELERY broker redis://. Memcached nahi.

    Viva tipMAD2 mein Redis isliye — cache + broker ek hi tool. Memcached Celery nahi chalaata.

  36. 36
    What exactly is cached when using the @cache.cached decorator?
    Times asked 1
    Official solution

    Simple@cache.cached view ka return value (JSON) Redis mein rakhta hai.

    Key typically prefix + URL path (+ query_string agar True). Function body hit pe skip.

    POST pe decorator mat lagaana — writes cache nahi karte. Auth-specific data cache karoge to user A ko user B ka data mil sakta hai — key mein user id ya cache hi mat karo.

    Redis in-memory key-value store hai — fridge pe sticky note, poori kitchen (SQL database) har baar mat kholo.

    MAD2 mein Redis do kaam: (1) cache — same venues/shows/dashboard JSON baar-baar DB se nahi (2) Celery broker — Flask task queue mein daalta hai, worker uthata hai.

    Flow: cache.get(key) → hit pe return, miss pe SQLAlchemy + SET with timeout. Admin write ke baad cache.delete, warna stale list.

    Source of truth database hi hai. Redis crash/band = cache miss (app chalni chahiye) + queue ruk sakti hai. Important bookings sirf Redis mein mat rakho.

    Alag: Redis ≠ Memcached (Celery broker nahi). Redis ≠ localStorage (woh browser). redis-cli ping → PONG viva proof.

    Project example: Public/admin list GET pe decorator. User bookings list usually cache mat, ya user-specific key.

  37. 37
    What are the main components of Celery?
    Times asked 2
    Official solution

    SimpleClient (Flask .delay), Broker (Redis), Worker. Optional Beat + result backend.

    Viva line'Flask produce, Redis transport, worker consume.'

    include task modules, app context ke andar DB session. Windows pe eventlet/gevent issues — docs se command.

    Celery Python ka distributed task queue — HTTP request ko 10s email/CSV ke liye mat rokna.

    Flow: Flask .delay() → Redis broker → Worker execute. Beat alag process hai (clock): crontab padhke due time pe queue mein daalta hai. Beat khud mail nahi bhejta; Worker haath hai.

    MAD2 typical: daily reminder (Beat), monthly report (Beat), user Export CSV (button, Beat nahi). JS async/await browser event loop hai, Celery server-side process — mix mat karo.

    Demo: tin terminals — redis-server, celery worker, celery beat — plus Flask. MailHog :8025 inbox. Result backend se task SUCCESS poll optional.

    Project example: create_app ke baad celery.conf.update. tasks import taaki register hon.

    Viva tip

    Viva line'Flask task produce karta hai, Redis transport, worker consume.'

  38. 38
    How do you prioritize Celery tasks?
    Times asked 2
    Official solution

    SimpleAlag queues high/low. Worker -Q high,default. Redis limited priority.

    Student apps rarely. Concept bolo.

    Celery Python ka distributed task queue — HTTP request ko 10s email/CSV ke liye mat rokna.

    Flow: Flask .delay() → Redis broker → Worker execute. Beat alag process hai (clock): crontab padhke due time pe queue mein daalta hai. Beat khud mail nahi bhejta; Worker haath hai.

    MAD2 typical: daily reminder (Beat), monthly report (Beat), user Export CSV (button, Beat nahi). JS async/await browser event loop hai, Celery server-side process — mix mat karo.

    Demo: tin terminals — redis-server, celery worker, celery beat — plus Flask. MailHog :8025 inbox. Result backend se task SUCCESS poll optional.

    Project example: If not implemented: would add queue='high' for emails.

  39. 39
    What happens if you swap the order of @jwt_required and @role_required decorators?
    Times asked 1
    Official solution

    Simplejwt_required pehle identity, phir role. Ultima fail/crash. Test 401/403.

    Swap jwt and role_required.

    Flask Python micro web framework. Route decorator URL → function. MAD2 mein JSON API: request.get_json(), jsonify, JWT.

    WSGI: server (Werkzeug) app ko call. if __name__ == '__main__' sirf direct run. Factory create_app() test/celery ke liye.

    Blueprint/resources folders. @app.route vs MethodView. Debug=True viva local, prod nahi. CORS alag port Vue ke liye.

    Project example: Don't swap in demo unless asked then restore.

  40. 40
    What fallback mechanisms have you implemented to prevent data leakage?
    Times asked 1
    Official solution

    SimpleDefault deny. Catch generic message. No stack to client. Don't leak users exist. Fallback prevent data leakage.

    403 vs 404 users. Generic 500 message.

    Pehle 1-line definition, phir related MAD2 layer (Vue SFC / Flask route / models.py / tasks.py / Redis).

    4-line formula: input kahan se aaya, auth/validation kaunsa, DB ya cache ya Celery, kya return.

    Related mix mat karo — cache ≠ Celery, authentication ≠ authorization, v-if ≠ v-show, Beat ≠ Worker. Follow-up ke liye ek difference ready rakho.

    Project example: error handlers.

  41. 41
    What is the difference between json, jsonify, json.dumps, and marshal?
    Times asked 1
    Official solution

    Simpledumps str. json parse. jsonify Response. marshal schema. pickle nahi.

    json jsonify dumps marshal difference.

    Pehle 1-line definition, phir related MAD2 layer (Vue SFC / Flask route / models.py / tasks.py / Redis).

    4-line formula: input kahan se aaya, auth/validation kaunsa, DB ya cache ya Celery, kya return.

    Related mix mat karo — cache ≠ Celery, authentication ≠ authorization, v-if ≠ v-show, Beat ≠ Worker. Follow-up ke liye ek difference ready rakho.

    Project example: We jsonify(serialize()).

    Project example: We jsonify(serialize()).

  42. 42
    What is the difference between POST, PUT, and PATCH?
    Times asked 1
    Official solution

    SimplePOST naya janam (har baar naya id). PUT poori photo replace. PATCH sticker chipkao.

    POST create, not idempotent. PUT full update, idempotent. PATCH partial.

    POST ki jagah PUT se REST semantics toot. GET typically no body.

    CRUD map: POST create, GET read, PUT/PATCH update, DELETE delete.

    Pehle 1-line definition, phir related MAD2 layer (Vue SFC / Flask route / models.py / tasks.py / Redis).

    4-line formula: input kahan se aaya, auth/validation kaunsa, DB ya cache ya Celery, kya return.

    Related mix mat karo — cache ≠ Celery, authentication ≠ authorization, v-if ≠ v-show, Beat ≠ Worker. Follow-up ke liye ek difference ready rakho.

    Example

    POST /api/venues
    PUT  /api/venues/1   {all fields}
    PATCH /api/venues/1 {only name}

    Project example: POST /api/venues create. PUT /venues/1 saari fields. PATCH sirf name.

  43. 43
    Explain HTTP status codes: 400, 401, 403, and 404.
    Times asked 1
    Official solution

    Simple2xx jeet, 4xx teri galti, 5xx meri (server) galti.

    200 OK, 201 Created, 400 validation, 401 no/invalid token (authentication fail), 403 role (authorization fail), 404 missing, 409 conflict, 500 crash.

    403 vs IntegrityError: 403 permission. Duplicate unique → 400/409, 500 mat chhodo.

    Example

    return jsonify(msg='ok'), 200
    return jsonify(msg='login required'), 401

    Project example: Login fail 401. User admin API 403. Duplicate booking 400.

    Viva tip403 vs IntegrityError: 403 permission, IntegrityError DB constraint (duplicate unique) — 400/409 banao, 500 mat chhodo.

  44. 44
    What is the difference between WebSockets and Webhooks?
    Times asked 1
    Official solution

    SimpleWebSocket ek phone call hai (dono bolte rehte). HTTP postcard hai (ek request-response).

    Persistent two-way. Chat, live scores. MAD2 generally REST + kabhi poll.

    Webhook ≠ WebSocket. ws:// / wss://.

    HTTP postcard (request-response). WebSocket phone call (dono taraf live). SSE radio (server→client stream). Webhook unka server tumhe POST karta hai (payment).

    MAD2 mostly REST. Live dashboard = poll + Redis cache kaafi. Agar implement nahi kiya to design bolo, jhoot mat.

    Project example: Humne REST use kiya. Live dashboard ke liye poll/cache. WebSocket extra hota.

    Viva tipMAD2 mein mostly REST + polling. Webhook ≠ WebSocket.

  45. 45
    How do WebSockets work?
    Times asked 1
    Official solution

    SimpleWebSocket ek phone call hai (dono bolte rehte). HTTP postcard hai (ek request-response).

    Persistent two-way. Chat, live scores. MAD2 generally REST + kabhi poll.

    Webhook ≠ WebSocket. ws:// / wss://.

    HTTP postcard (request-response). WebSocket phone call (dono taraf live). SSE radio (server→client stream). Webhook unka server tumhe POST karta hai (payment).

    MAD2 mostly REST. Live dashboard = poll + Redis cache kaafi. Agar implement nahi kiya to design bolo, jhoot mat.

    Project example: Humne REST use kiya. Live dashboard ke liye poll/cache. WebSocket extra hota.

    Viva tipMAD2 mein mostly REST + polling. Webhook ≠ WebSocket.

  46. 46
    What is the difference between Sessions and Cookies?
    Times asked 1
    Official solution

    SimpleCookie transport. Session server data us cookie id se. Theme cookie bina server session.

    Auth session cookie httpOnly. JWT often not a cookie in MAD2.

    Authentication poochta hai "tu kaun hai?", Authorization poochta hai "tujhe yeh kaam karne ki permission hai?"

    Authentication: login. Username + password hash check. Success pe JWT/session. Galat credentials = 401.
    Authorization: uske baad role. Admin hi venue/lot delete kare, student nahi = 403 (logged in ho, allowed nahi).

    MAD2: POST /api/login = authentication. @jwt_required identity. @roles_required('admin') ya Vue v-if="isAdmin" = authorization. Frontend hide sirf UX — asli deny backend pe.

    Validation alag: form sahi bhara (email format, age 18+). Woh identity prove nahi karta. Password store hash (Werkzeug), JWT payload padha ja sakta hai isliye secret mat daalo.

    Project example: Agar JWT LS: cookies empty explain. Agar Flask-Login: session cookie dikhao.

  47. 47
    What is the difference between synchronous and asynchronous programming?
    Times asked 1
    Official solution

    SimpleSync line pe ruk jao (2+2). Async I/O pe wait karte hue baaki kaam chalte (fetch, Celery).

    JS async ≠ Celery async jobs. Context se bolo.

    Why async jobs: slow/scheduled/bulk off request thread.

    Pehle 1-line definition, phir related MAD2 layer (Vue SFC / Flask route / models.py / tasks.py / Redis).

    4-line formula: input kahan se aaya, auth/validation kaunsa, DB ya cache ya Celery, kya return.

    Related mix mat karo — cache ≠ Celery, authentication ≠ authorization, v-if ≠ v-show, Beat ≠ Worker. Follow-up ke liye ek difference ready rakho.

    Project example: Login sync hash check fast. Email Celery async. Vue fetch async.

  48. 48
    What are Vue routes, and why do we use them?
    Times asked 1
    Official solution

    SimpleRouter URL ko component se map karta hai. Google Maps for pages.

    routes array path+component. router-view jagah. router-link reload nahi.

    meta.auth + beforeEach guard. Dynamic /venues/:id.

    Nayi page: SFC + routes entry + link.

    Example

    const routes = [
      { path: '/', component: Home },
      { path: '/login', component: Login },
      { path: '/venues/:id', component: VenueDetail, meta: { auth: true } },
    ]

    Project example: routes.js Login, Register, UserHome, AdminHome, 404.

    Viva tipNayi page: component banao, routes array mein path, router-link se jao.

  49. 49
    What are Vue slots?
    Times asked 1
    Official solution

    SimpleSlots = dabbe ke andar parent apna HTML daal de. Props data, slots markup.

    Default slot, named slots. App.vue router-view layout jaisa outlet.

    Agar nahi use kiya: 'layout router-view se kiya' valid.

    Component = reusable UI block (Navbar, Card). Props parent→child data, emit child→parent event. Slots parent HTML inner content.

    computed cache + reactive derive (filtered list). watch side-effect (query change pe API). methods events. ref() primitive, reactive() object. Vuex/Pinia global store; localStorage persist, store nahi.

    SFC: template + script + style ek .vue file. Parent-child exam favourite: list parent, row child :item + @delete.

    Example

    <div class="card"><slot>Default</slot></div>
    <Card><p>Custom body</p></Card>

    Project example: Card.vue <slot>Default</slot>. Parent custom body.

  50. 50
    What are Vue props?
    Times asked 1
    Official solution

    SimpleProps parent ki thali child ko dena. Child thali tod ke parent ki thali na badle — emit bolo.

    Declare props, parent :venue="v". One-way. Mutate mat. Types/required Vue 3.

    List parent, card child — classic viva.

    Component = reusable UI block (Navbar, Card). Props parent→child data, emit child→parent event. Slots parent HTML inner content.

    computed cache + reactive derive (filtered list). watch side-effect (query change pe API). methods events. ref() primitive, reactive() object. Vuex/Pinia global store; localStorage persist, store nahi.

    SFC: template + script + style ek .vue file. Parent-child exam favourite: list parent, row child :item + @delete.

    Example

    <VenueCard :venue="v" @select="onSelect" />
    props: ['venue']
    this.$emit('select', this.venue.id)

    Project example: VenueCard :venue. Child $emit('select', id).

  51. 51
    What is the difference between props and slots?
    Times asked 1
    Official solution

    SimpleSlots = dabbe ke andar parent apna HTML daal de. Props data, slots markup.

    Default slot, named slots. App.vue router-view layout jaisa outlet.

    Agar nahi use kiya: 'layout router-view se kiya' valid.

    Component = reusable UI block (Navbar, Card). Props parent→child data, emit child→parent event. Slots parent HTML inner content.

    computed cache + reactive derive (filtered list). watch side-effect (query change pe API). methods events. ref() primitive, reactive() object. Vuex/Pinia global store; localStorage persist, store nahi.

    SFC: template + script + style ek .vue file. Parent-child exam favourite: list parent, row child :item + @delete.

    Example

    <div class="card"><slot>Default</slot></div>
    <Card><p>Custom body</p></Card>

    Project example: Card.vue <slot>Default</slot>. Parent custom body.

  52. 52
    What are Vue lifecycle hooks?
    Times asked 11
    Official solution

    SimpleLifecycle = component ki zindagi ke stages. API call tab jab DOM ready ho — mounted.

    created: instance bani, this data, DOM nahi. mounted/onMounted: page pe aa gaya — fetch, Chart.js, setInterval.
    updated: data change ke baad. unmounted: cleanup (clearInterval) warna memory leak.

    Dashboards onMounted isliye: canvas/API tab valid. created mein $el nahi.

    Composition: onMounted(() => {}) setup ke andar.

    Example

    export default {
      async mounted() {
        const r = await fetch('/api/venues')
        this.venues = await r.json()
      }
    }

    Project example: Venues.vue mounted fetch list. Clock component unmounted pe interval clear.

    Viva tipcreated: data setup, DOM nahi. mounted/onMounted: $el mil gaya — fetch yahi. Dashboards isliye onMounted use karti hain.

  53. 53
    What are Vue directives?
    Times asked 6
    Official solution

    SimpleDirectives Vue ke special attributes — HTML ko superpower.

    v-if/else/show, v-for, v-bind (:), v-on (@), v-model, v-html (XSS), v-cloak, v-slot.

    :src = v-bind:src. @click = v-on:click.

    Custom directives bhi (v-focus) — course basics kaafi.

    Example

    <p v-if="ok">Yes</p>
    <li v-for="u in users" :key="u.id">{{ u.name }}</li>
    <input v-model="email">
    <img :src="url">

    Project example: List v-for :key. Form v-model. Admin v-if. Image :src.

    Viva tip: src ke liye v-bind:src ka shorthand. @click = v-on:click.

  54. 54
    What is pagination, and why is it used?
    Times asked 1
    Official solution

    SimpleBadi list pages. Fast kam payload. page per_page. Offset or keyset.

    Why used. Scale.

    Pehle 1-line definition, phir related MAD2 layer (Vue SFC / Flask route / models.py / tasks.py / Redis).

    4-line formula: input kahan se aaya, auth/validation kaunsa, DB ya cache ya Celery, kya return.

    Related mix mat karo — cache ≠ Celery, authentication ≠ authorization, v-if ≠ v-show, Beat ≠ Worker. Follow-up ke liye ek difference ready rakho.

    Project example: If not: would add .paginate. If yes show.

    Project example: If not: would add .paginate. If yes show.

  55. 55
    How would you scale your application to support millions of users?
    Times asked 1
    Official solution

    SimpleAll 10k + shards replicas queue partition multi region hard.

    Scale millions users. Load millions requests without scale: down.

    MAD2 architecture: Vue SPA (client) → HTTP JSON → Flask API (server) → SQLAlchemy DB. Side path: Flask → Redis broker → Celery worker → MailHog/CSV.

    Client-server alag ports. State: Vue memory + LS token. Persistent: SQLite. Cache: Redis. MVC-ish: models.py, API views, Vue templates.

    Scale: more workers, Postgres, cache, not 'bigger SQLite file'.

    Project example: Design answer not implemented.

  56. 56
    What happens if the application load increases to millions of requests?
    Times asked 1
    Official solution

    SimpleWithout scale down. With LB gunicorn Redis cluster PG replica CDN celery scale-out.

    What happens load millions.

    MAD2 architecture: Vue SPA (client) → HTTP JSON → Flask API (server) → SQLAlchemy DB. Side path: Flask → Redis broker → Celery worker → MailHog/CSV.

    Client-server alag ports. State: Vue memory + LS token. Persistent: SQLite. Cache: Redis. MVC-ish: models.py, API views, Vue templates.

    Scale: more workers, Postgres, cache, not 'bigger SQLite file'.

    Project example: Bottleneck SQLite+dev server first.

  57. 57
    Optimize a piece of code containing multiple if conditions without using if-else.
    Times asked 1
    Official solution

    Simpledict dispatch early return mapping status→handler. Optimize multiple if without if-else.

    Table-driven.

    Pehle 1-line definition, phir related MAD2 layer (Vue SFC / Flask route / models.py / tasks.py / Redis).

    4-line formula: input kahan se aaya, auth/validation kaunsa, DB ya cache ya Celery, kya return.

    Related mix mat karo — cache ≠ Celery, authentication ≠ authorization, v-if ≠ v-show, Beat ≠ Worker. Follow-up ke liye ek difference ready rakho.

    Example

    ops = {'add': a+b, 'mul': a*b}
    return ops.get(op)

    Project example: ops = {'add': a+b}.

  58. 58
    Implement a search by username feature.
    Times asked 1
    Official solution

    Simplefilter User.username.ilike. Admin only. Implement search by username.

    q param.

    MAD2 architecture: Vue SPA (client) → HTTP JSON → Flask API (server) → SQLAlchemy DB. Side path: Flask → Redis broker → Celery worker → MailHog/CSV.

    Client-server alag ports. State: Vue memory + LS token. Persistent: SQLite. Cache: Redis. MVC-ish: models.py, API views, Vue templates.

    Scale: more workers, Postgres, cache, not 'bigger SQLite file'.

    Project example: admin users.

    Project example: admin users.

  59. 59
    Implement a dropdown menu in a form.
    Times asked 1
    Official solution

    Simpleselect v-model option v-for. Implement dropdown menu form. Age dropdown >30 <30.

    Both.

    Pehle 1-line definition, phir related MAD2 layer (Vue SFC / Flask route / models.py / tasks.py / Redis).

    4-line formula: input kahan se aaya, auth/validation kaunsa, DB ya cache ya Celery, kya return.

    Related mix mat karo — cache ≠ Celery, authentication ≠ authorization, v-if ≠ v-show, Beat ≠ Worker. Follow-up ke liye ek difference ready rakho.

    Example

    <select v-model="ageBand"><option>>30</option><option><30</option></select>

    Project example: dept select.

  60. 60
    Add a timestamp column to a table and display it in the dashboard.
    Times asked 1
    Official solution

    SimpleDateTime default now Vue format. Add timestamp column display dashboard.

    created_at.

    Pehle 1-line definition, phir related MAD2 layer (Vue SFC / Flask route / models.py / tasks.py / Redis).

    4-line formula: input kahan se aaya, auth/validation kaunsa, DB ya cache ya Celery, kya return.

    Related mix mat karo — cache ≠ Celery, authentication ≠ authorization, v-if ≠ v-show, Beat ≠ Worker. Follow-up ke liye ek difference ready rakho.

    Project example: model + serialize + td.

    Project example: model + serialize + td.

  61. 61
    Change Celery scheduling so that the daily reminder always executes before the monthly report.
    Times asked 2
    Official solution

    SimpleDaily ko pehle time do, monthly ko baad mein — Beat sequential guarantee nahi karta.

    Same minute pe dono fire ho sakte hain parallel workers se. Order chahiye to times alag rakho (17:00 vs 17:30) ya ek task doosre ko chain kare.

    Examiner logic: reminder pehle, badi report baad.

    Celery Python ka distributed task queue — HTTP request ko 10s email/CSV ke liye mat rokna.

    Flow: Flask .delay() → Redis broker → Worker execute. Beat alag process hai (clock): crontab padhke due time pe queue mein daalta hai. Beat khud mail nahi bhejta; Worker haath hai.

    MAD2 typical: daily reminder (Beat), monthly report (Beat), user Export CSV (button, Beat nahi). JS async/await browser event loop hai, Celery server-side process — mix mat karo.

    Demo: tin terminals — redis-server, celery worker, celery beat — plus Flask. MailHog :8025 inbox. Result backend se task SUCCESS poll optional.

    Project example: daily crontab(hour=17, minute=0), monthly hour=17 minute=30.

  62. 62
    Change Celery scheduling so that the daily reminder always executes before the monthly report.
    Times asked 2
    Official solution

    SimpleDaily ko pehle time do, monthly ko baad mein — Beat sequential guarantee nahi karta.

    Same minute pe dono fire ho sakte hain parallel workers se. Order chahiye to times alag rakho (17:00 vs 17:30) ya ek task doosre ko chain kare.

    Examiner logic: reminder pehle, badi report baad.

    Celery Python ka distributed task queue — HTTP request ko 10s email/CSV ke liye mat rokna.

    Flow: Flask .delay() → Redis broker → Worker execute. Beat alag process hai (clock): crontab padhke due time pe queue mein daalta hai. Beat khud mail nahi bhejta; Worker haath hai.

    MAD2 typical: daily reminder (Beat), monthly report (Beat), user Export CSV (button, Beat nahi). JS async/await browser event loop hai, Celery server-side process — mix mat karo.

    Demo: tin terminals — redis-server, celery worker, celery beat — plus Flask. MailHog :8025 inbox. Result backend se task SUCCESS poll optional.

    Project example: daily crontab(hour=17, minute=0), monthly hour=17 minute=30.

  63. 63
    Make changes to the Admin Dashboard functionality.
    Times asked 1
    Official solution

    SimpleFind admin stats query change filter JSON Vue same keys. Modify backend admin dashboard.

    Modify admin dashboard functionality.

    Pehle 1-line definition, phir related MAD2 layer (Vue SFC / Flask route / models.py / tasks.py / Redis).

    4-line formula: input kahan se aaya, auth/validation kaunsa, DB ya cache ya Celery, kya return.

    Related mix mat karo — cache ≠ Celery, authentication ≠ authorization, v-if ≠ v-show, Beat ≠ Worker. Follow-up ke liye ek difference ready rakho.

    Project example: summary API.

    Project example: summary API.

  1. 1
    Demonstrate the complete application.
    Times asked 33
    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.

  2. 2
    Find and fix a bug in the application (if discovered during demo).
    Times asked 1
    Official 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.

  3. 3
    What is the purpose of an Index in a database?
    Times asked 1
    Official solution

    SimpleIndex kitab ki index jaisi — search tez, poori table scan nahi.

    email unique=True already index. Composite: db.Index('ix_user_city_age', User.city, User.age)
    Zyada indexes writes slow. Search/filter columns pe lagao.

  4. 4
    How do you create an index on two columns in SQLAlchemy?
    Times asked 1
    Official 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.

  5. 5
    Can a Primary Key be replaced with UNIQUE + NOT NULL + AUTO_INCREMENT? Why or why not?
    Times asked 2
    Official solution

    SimplePrimary Key table ki main identity hai (ek hi), Unique Key extra unique column ho sakta hai (kai).

    PK: NOT NULL + UNIQUE, sirf ek clustered identity. Example: id
    Unique: duplicate nahi, lekin NULL allow ho sakta hai. Example: email, username

    UNIQUE + NOT NULL + AUTO_INCREMENT PK jaisa behave karta hai, lekin table ki official PK nahi. Relationships/FK generally PK ko refer karti hain.
    Isliye alag Primary Key rakhna better hai.


    SimplePrimary Key har row ko uniquely identify karti hai. Unique Key bhi unique hoti hai lekin table ki main ID nahi.

    id = db.Column(db.Integer, primary_key=True)  # auto increment
    email = db.Column(db.String(120), unique=True)

    PK: NOT NULL, ek (ya composite). Index automatically.
    Record fetch: User.query.get(id) PK se tez.
    FK hamesha unique nahi — Many side pe repeat hoti hai. Unique FK = One-to-One.

  6. 6
    Can database models be changed when the application is live (production)? If yes, how?
    Times asked 1
    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.

  7. 7
    What is Flask(__name__)?
    Times asked 1
    Official solution

    SimpleFlask Python ka micro web framework hai — routes, templates, request/response handle karta hai.

    from flask import Flask
    app = Flask(__name__)
    @app.route('/')
    def home():
        return 'Hello'
    app.run(debug=True)  # default port 5000

    __name__ se Flask ko pata chalta hai templates/static kahan se load karni hai. Hataoge to resource paths toot sakte hain.

    Faydesimple, flexible, MAD1 syllabus. Nuksaan: bade features (admin, auth) khud jodne padte hain.

    app.run() development server start karta hai. Production mein gunicorn/waitress.
  8. 8
    Can we remove the __name__ parameter? What happens if we do?
    Times asked 1
    Official solution

    Simpleapp = Flask(__name__) app banata hai; if __name__ == '__main__' tabhi server start jab file directly run ho.

    app = Flask(__name__)
    if __name__ == '__main__':
        app.run(debug=True, port=5000)

    __name__ module ka naam. Direct run pe '__main__', import pe filename. Import karoge to server auto-start nahi — tests/blueprints ke liye zaroori.
    debug=True: auto-reload + debugger. Production mein band rakho (security).
    Port: app.run(port=8000) ya flask run --port 8000. Default 5000. Haan, change ho sakta hai.

  9. 9
    What is WSGI?
    Times asked 2
    Official solution

    SimpleWSGI = Python web server aur Flask app ke beech standard interface.

    gunicorn app:app # WSGI server production
    Flask ka app.run() development WSGI. Asgi async (FastAPI) alag.

  10. 10
    Where did you use Flask-Security in your project?
    Times asked 2
    Official solution

    SimpleUserMixin Flask-Login ko batata hai user object kaise treat karna hai (is_authenticated, get_id).

    class User(db.Model, UserMixin):
        id = db.Column(db.Integer, primary_key=True)

    current_user proxy logged-in user. Initialize: login_user(user) / user_loader callback.
    Flask-WTF: Python classes se forms, CSRF, validators. RegisterForm forms.py mein.
    fs_uniquifier Flask-Security mein token/session identity — email change pe sessions invalidate.
    enctype='multipart/form-data' file upload pe zaroori. request.files.get('resume').

  11. 11
    Can the order of @role_required and @auth_required decorators be swapped?
    Times asked 1
    Official solution

    Simple@login_required / custom decorator check karta hai session mein user hai ya nahi, nahi to login pe bhejta hai.

    def login_required(f):
        @wraps(f)
        def wrapper(*a, **k):
            if 'user_id' not in session:
                return redirect(url_for('login'))
            return f(*a, **k)
        return wrapper
    
    @app.before_request se bhi global check ho sakta hai.

    Decorator order: pehle @app.route, uske neeche @login_required generally. Swap karoge to kabhi route register galat ho sakta hai — Flask-Login docs follow karo.
    Role decorator @role_required('admin') authorization ke liye. Order matter karta hai: pehle auth, phir role.

  12. 12
    What effect does the decorator order have?
    Times asked 1
    Official 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.

  13. 13
    How do you prioritize Celery tasks?
    Times asked 2
    Official solution

    SimpleCelery background tasks (email, CSV, reports) async chalaata hai. Redis broker/queue + cache.

    User 'Export' click → Celery task queue → Redis message → worker CSV banaata hai → user baad mein download.
    Saath isliye: Celery ko broker chahiye, Redis tez in-memory. MAD2 topic zyada, MAD1 mein optional.
    Priority: task queues/routing. Caching: Redis mein key-value, DB hits kam.
    Pub/Sub: publisher channel pe message, subscribers sunte hain — Redis yeh bhi karta hai.

  14. 14
    Difference between json and jsonify.
    Times asked 1
    Official solution

    Simplejson.dumps Python object ko JSON string banata hai, jsonify Flask Response banata hai (header ke saath).

    json.dumps({'ok': True}) → '{"ok": true}' (sirf string)

    jsonify(ok=True) → HTTP response, Content-Type: application/json
    
    API route mein jsonify use karo:
    @app.route('/api/users')
    def users():
        return jsonify([{'id': u.id, 'name': u.name} for u in User.query.all()])

    json.dumps se return karoge to browser ise text samajh sakta hai, JSON nahi.

  15. 15
    What is json.dumps()?
    Times asked 1
    Official solution

    SimpleJSON = JavaScript Object Notation — data exchange ka text format.

    {"name": "Ram", "age": 20}
    APIs, localStorage, Chart.js data. Python dict ↔ JSON.
    Structured data: tables, fixed schema (SQL). Unstructured: images, logs, free text. JSON semi-structured.
    SQL structured relational. Mongo unstructured/document.

  16. 16
    Difference between jsonify() and json.dumps().
    Times asked 1
    Official solution

    Simplejson.dumps Python object ko JSON string banata hai, jsonify Flask Response banata hai (header ke saath).

    json.dumps({'ok': True}) → '{"ok": true}' (sirf string)

    jsonify(ok=True) → HTTP response, Content-Type: application/json
    
    API route mein jsonify use karo:
    @app.route('/api/users')
    def users():
        return jsonify([{'id': u.id, 'name': u.name} for u in User.query.all()])

    json.dumps se return karoge to browser ise text samajh sakta hai, JSON nahi.

  17. 17
    Difference between WebSockets and Webhooks.
    Times asked 1
    Official solution

    SimpleWebSocket do-tarfa live connection, Webhook 'kisi event pe URL hit karo'.

    WebSocket: chat, live scores. Connection open rehti hai.
    Webhook: payment success pe Stripe tumhari /webhook URL POST karta hai. Connection nahi, ek HTTP call.
    MAD1 mein usually nahi hote; REST request-response hota hai.

  18. 18
    What are Props in Vue?
    Times asked 5
    Official solution

    SimpleVue.js frontend framework — reactive UI components. MAD2 mein common, MAD1 optional.

    Component: reusable UI (Navbar.vue) + data + template.
    Props: parent → child data. Child → parent: $emit('update', val).
    Slots: parent child ke andar extra HTML daal sakta hai.
    Lifecycle: created (data setup), mounted (DOM ready — API call), updated, unmounted.
    v-model two-way bind. Vue Router SPA routes (routes.js). Vuex/Pinia global state; mutations sync change, actions async.
    Standalone component: khud ke saath compile, parent register kam.

  19. 19
    What are Vue Routes (Vue Router)?
    Times asked 1
    Official solution

    SimpleVue.js frontend framework — reactive UI components. MAD2 mein common, MAD1 optional.

    Component: reusable UI (Navbar.vue) + data + template.
    Props: parent → child data. Child → parent: $emit('update', val).
    Slots: parent child ke andar extra HTML daal sakta hai.
    Lifecycle: created (data setup), mounted (DOM ready — API call), updated, unmounted.
    v-model two-way bind. Vue Router SPA routes (routes.js). Vuex/Pinia global state; mutations sync change, actions async.
    Standalone component: khud ke saath compile, parent register kam.

  20. 20
    Implement Search by Username functionality.
    Times asked 1
    Official solution

    SimpleSearch box GET form, backend query filter, results template mein.

    q = request.args.get('q', '').strip()
    results = Doctor.query.filter(Doctor.name.ilike(f'%{q}%')).all() if q else []
    return render_template('search.html', results=results, q=q)

    Jinja: {{ results|length }} matches. Empty: 'No results'.
    JS-only filter: saara data pehle load, client filter — chhote lists. Bada data: server search.
    Search generally GET (shareable URL). Count: len(results) ya db.func.count.

  21. 21
    Demonstrate the complete application.
    Times asked 33
    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.

  22. 22
    Debug and fix an issue found during the demo.
    Times asked 1
    Official 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.

  23. 23
    Explain improvements that could be made to the application.
    Times asked 1
    Official solution

    Simple2-3 honest improvements + 1 security + 1 UX.

    Example

    password hashing/CSRF tighter, Redis cache, tests, pagination, email verify, rate limit login, better mobile CSS.

    Challenges: relationships/cascade, concurrent booking, Jinja inheritance.
    Rate: 7-8/10 with reason — 10/10 arrogant, 3/10 confidence khatam.
    Security extra: HTTPS, hashed passwords, CSRF, SQL injection (ORM), login attempts, file type check.

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