Free tutorials & notes in Hindi & English · Clean code examples 🧰 मुफ़्त PDF और फ़ोटो टूल्स →
📱 Android App (Kotlin + XML)  ·  Lesson 28

E-commerce Project Viva Questions

ये 41 सवाल examiners और interviewers आमतौर पर e-commerce project के बारे में पूछते हैं। हर जवाब आपके बनाए KartEasy code से match करता है, इसलिए file खोलकर दिखा सकते हैं।

  1. 1हर दिन एक group पढ़ें
  2. 230 seconds से कम में बोलकर जवाब दें
  3. 3Project में matching file खोलकर code दिखाएँ
  4. 4Examiner के सामने smoke test और पूरा order चलाएँ
Viva की तैयारी कैसे करें

Project & planning

1. Explain your project in one minute.

KartEasy तीन हिस्सों वाली shopping app है: MySQL database, admin panel के साथ PHP REST API, और Kotlin + XML में native Android app। Customers browse, search, cart या wishlist में add, coupons apply, Cash on Delivery orders और tracking करते हैं; मालिक admin panel में products, banners, coupons और orders संभालता है।

2. Why did you build the backend before the app?

हर app screen को असली data चाहिए। पहले API पूरी और test (curl + smoke test) होने से हर screen असली responses पर बनी, और bug साफ़ पता चलता था कि app में है या API में।

3. What is the architecture of the system?

Client–server. Android app सिर्फ HTTPS पर JSON से PHP API से बात करती है; MySQL को सिर्फ API छूती है। Admin panel उसी database पर server-rendered PHP website है।

4. Which features would you add next?

Verified webhook के साथ gateway से online payment, status बदलने पर FCM push notifications, OTP login, product variants (size/colour), और delivery-partner app।

Database (MySQL)

5. How many tables are there and why?

चौदह: users, user_tokens, admins, categories, products, product_images, banners, cart_items, wishlist, addresses, coupons, orders, order_items, reviews। हर चीज़ की एक table; relations foreign keys से।

6. What is a foreign key? Give an example from your project.

ऐसा column जो दूसरी table की primary key से match होना चाहिए। cart_items.product_id products.id को refer करता है, इसलिए cart row कभी न-मौजूद product की ओर इशारा नहीं कर सकती।

7. Why is there a UNIQUE key on cart_items (user_id, product_id)?

एक user की हर product की ज़्यादा से ज़्यादा एक row। वही product दोबारा जोड़ने पर duplicate row की जगह INSERT … ON DUPLICATE KEY UPDATE से quantity update होती है।

8. Why DECIMAL for prices and not FLOAT?

DECIMAL exact values store करता है। FLOAT binary है और 0.30000000000000004 जैसी rounding errors देता है, जो पैसों के लिए नहीं चल सकता।

9. Why does order_items store the product name and price again?

यह snapshot है। बाद में price या name बदले तो भी पुराने orders को वही दिखाना चाहिए जो customer ने सच में दिया।

10. Why are products hidden instead of deleted?

पुराने orders उन्हें refer करते हैं। is_active = 0 product को app से हटा देता है, पर order history और foreign keys सही रहती हैं।

11. What is utf8mb4 and why use it?

MySQL का पूरा Unicode character set। यह ₹, Hindi और emoji सही store करता है; पुराना utf8 emoji जैसे 4-byte characters नहीं रख सकता।

PHP REST API

12. What is a REST API?

URLs का set जो web pages की जगह data (JSON) लौटाता है। Clients HTTP methods use करते हैं: पढ़ने के लिए GET, बनाने या बदलने के लिए POST।

13. What is the response format of your API?

हमेशा {"success": bool, "message": string, "data": …} सही HTTP status (200, 401, 404, 409, 422, 500) के साथ, ताकि app हर जवाब एक ApiResponse<T> class से parse करे।

14. What is PDO and why prepared statements?

PDO PHP की database layer है। Prepared statements values को SQL से अलग भेजते हैं, जिससे SQL injection रुकता है; हम emulated prepares भी बंद करते हैं।

15. How does login work in your API?

App email और password भेजती है; PHP bcrypt hash से password_verify करता है, 64-character random token बनाता है, उसका SHA-256 hash expiry के साथ store करता है और token लौटाता है। बाद की requests Authorization: Bearer <token> भेजती हैं।

16. How is the product list paginated?

page और limit parameters; OFFSET = (page − 1) × limit। COUNT(*) query total देती है, और has_more app को बताता है कि अगला page माँगना है या नहीं।

17. How do you sort safely when the user chooses the sort?

Whitelist से: user price_asc जैसी key भेजता है और PHP उसे fixed ORDER BY string से map करता है। User का text कभी SQL में नहीं जाता।

18. What happens inside orders/place.php?

एक transaction में: SELECT … FOR UPDATE से cart products lock, stock, active status और coupon check, totals दोबारा calculate, order और items insert, stock कम, cart खाली, फिर commit। कोई भी problem सब rollback कर देती है।

19. What is a transaction? Why is it needed at checkout?

Queries का group जो या तो सब सफल हों या सब fail। इसके बिना stock घटने के बाद पर order save होने से पहले crash से stock खो सकता है या आधे orders बन सकते हैं।

20. How do you prevent two customers from buying the last item?

SELECT … FOR UPDATE product rows lock करता है; दूसरा transaction पहले के commit तक रुकता है, फिर stock 0 देखकर साफ़ message के साथ fail होता है।

21. How do coupons work?

Coupon row में type (flat या percent), value, minimum order, maximum discount और expiry होते हैं। Server current cart के साथ सारे rules check करता है और discount को subtotal पर cap करता है; app सिर्फ code भेजती है।

Security

22. What is IDOR and how did you prevent it?

Insecure Direct Object Reference: client से आए id पर भरोसा। हर customer query user_id = logged-in user भी check करती है, इसलिए कोई दूसरे का order या address पढ़ या बदल नहीं सकता।

23. Why are prices never taken from the app?

App modify या किसी tool से bypass की जा सकती है। API prices database से पढ़ती है और हर total खुद calculate करती है; "price" जैसे extra fields ignore होते हैं।

24. What is CSRF and how is the admin panel protected?

Cross-Site Request Forgery logged-in browser से ऐसी request भिजवाता है जो उसका इरादा नहीं थी। हर admin form में secret session token है जो hash_equals से check होता है।

25. How do you prevent XSS in the admin panel?

हर printed value h() से जाती है, जो ENT_QUOTES और UTF-8 के साथ htmlspecialchars है, इसलिए users का type किया HTML text की तरह दिखता है।

26. How are image uploads made safe?

getimagesize असली JPG/PNG/WEBP confirm करता है, size 2 MB तक, file को random name मिलता है, और .htaccess uploads/ में PHP चलने से रोकता है।

27. Why store only a hash of the token?

Database leak हो तो attacker को hashes मिलते हैं, चलने वाले tokens नहीं। Tokens 30 दिन बाद expire भी होते हैं और logout पर delete होते हैं।

Android app

28. Which architecture does the app use?

MVVM: XML layouts वाले Fragments state दिखाते हैं; ViewModels StateFlow में state रखते हैं और rotation में बचे रहते हैं; एक ShopRepository Retrofit से API से बात करता है।

29. Why StateFlow and SharedFlow?

StateFlow current screen state रखता है और rotation के बाद फिर देता है। SharedFlow Snackbar message जैसे one-time events के लिए है, जो rotation के बाद दोहराने नहीं चाहिए।

30. How is the token added to every request?

एक OkHttp interceptor SessionManager में cached token पढ़कर हर request में Authorization: Bearer header जोड़ता है।

31. How does the app handle errors?

safeCall हर API call wrap करता है: IOException "No internet connection" बनता है, HttpException API के अपने JSON message में बदलता है, और success:false API message देता है। Screens Retry वाला full-page error या Snackbar दिखाती हैं।

32. Why DataStore instead of SharedPreferences?

DataStore coroutines और Flow के साथ asynchronous है, UI thread कभी block नहीं करता, और drawer header को userFlow से live update होने देता है।

33. How does the banner slider work?

Dots के लिए TabLayout वाला ViewPager2। एक Handler हर 4 seconds अगले page पर जाता है; user के swipe करने पर फिर शुरू होता है और onPause में रुकता है।

34. How did you implement search?

Search field हर बदलाव पर ViewModel call करता है; 400 ms debounce (cancellable coroutine में delay) typing रुकने के बाद सिर्फ एक request भेजता है, और reload() चल रही request cancel करता है।

35. How is a result returned from the address screen to checkout?

Address list चुना id previousBackStackEntry.savedStateHandle में लिखकर navigate up करती है; checkout उस key को getLiveData से observe करता है।

36. How does offline mode work?

NetworkMonitor connectivity track करके banner दिखाता है। OkHttp GET responses cache करता है; online requests हमेशा network use करती हैं, offline वाली 7 दिन तक पुराने cache से जवाब पाती हैं।

37. How does the notification open the order?

NavDeepLinkBuilder nav graph, orderDetailFragment destination और order id argument के साथ MainActivity के लिए PendingIntent बनाता है।

Release & hosting

38. How did you host the API?

Shared hosting पर: MySQL database बनाया, database.sql import, backend folder upload, config.php edit, SSL on, फिर live URL पर smoke test।

39. How does the app use different URLs for debug and release?

हर build type में buildConfigField BuildConfig.BASE_URL बनाता है: debug के लिए 10.0.2.2:8000, release के लिए https domain।

40. Why do you need ProGuard keep rules for the models?

R8 release builds में fields rename करता है, पर Gson reflection से JSON keys को field names से map करता है। Model package keep करने से release में खाली या zero values नहीं आतीं।

41. What is the difference between APK and AAB?

APK सीधे install होता है; AAB Google Play पर upload होता है, जो फिर हर device के लिए optimised APKs बनाता है। नई apps के लिए Play AAB माँगता है।

✅ Viva के लिए demo order

3 मिनट में दिखाएँ: login → "watch" search → cart में add → SAVE10 apply → order place → notification → order खोलें → admin panel में status shipped करें → app में order दोबारा खोलें।

अक्सर पूछे जाने वाले प्रश्न (FAQ)

What happens inside orders/place.php?
एक transaction में: SELECT … FOR UPDATE से cart products lock, stock, active status और coupon check, totals दोबारा calculate, order और items insert, stock कम, cart खाली, फिर commit। कोई भी problem सब rollback कर देती है।
What is a transaction? Why is it needed at checkout?
Queries का group जो या तो सब सफल हों या सब fail। इसके बिना stock घटने के बाद पर order save होने से पहले crash से stock खो सकता है या आधे orders बन सकते हैं।
What is IDOR and how did you prevent it?
Insecure Direct Object Reference: client से आए id पर भरोसा। हर customer query user_id = logged-in user भी check करती है, इसलिए कोई दूसरे का order या address पढ़ या बदल नहीं सकता।
← E-commerce App Tutorial
🔗

Share this topic with a friend

यह topic किसी दोस्त को भेजें

Found it useful? Send it to a classmate learning the same thing.

अच्छा लगा? जो दोस्त यही सीख रहा है, उसे भेज दीजिए।

यह lesson कैसा लगा?

आपकी राय से हम content और बेहतर बनाते हैं।

अपना review और सुझाव लिखें (वैकल्पिक)

Review approve होने के बाद आपका नाम और शहर इसके साथ public दिख सकते हैं। Email या phone न लिखें।

▶ CodingEasily on YouTube

Video से सीखें – आसान Hindi में

चुनी हुई video: RDBMS भाग 3 – Class XI Commerce IT

▶ Channel subscribe करें