Hello everyone,
I want to share my small experience about my interview in MVI Technologies. That day was really awesome and I learn many new things.
First I got one mail from MVI about my interview schedule. I was so happy that time. They give me 5 days time for prepare before interview day. So I start my preparation immediately.
In that days I study Core Java, JDBC, Arrays, and String programs. I practice many examples and try to improve my logic. I was little nervous but I feel I prepare well.
Then the interview day came. That day was really nice. They ask some good questions from file handling and collections. Some questions are mix with small task also, that was nice.
But only problem is time not enough, only 1 hour. Some questions I see first time. I try my best.
These are questions from the interview.
1.Task: Create a Java program that works with product data and calculates category-wise total sales.
Requirements:
- Create a text file named products.txt programmatically.
- Write product details into the file. Each product has three fields: Category (e.g., Phone, Stationery, Music) Product Name,Product Price
- Category Details: There should be 3 categories: Phone, Stationery, Music. Each category should have 3 products with their respective prices. Example: Phone,Samsung,15000
- Read the products.txt file and calculate the total price for each category.
- Create another text file named summary.txt and write category-wise totals into it. Each line should have the category name and total price.
Example:
Phone : 125000
Stationery : 100
Music : 14200
2.Task:
You are given a string containing letters and digits. Write a program to reverse only the letters in the string while keeping the digits in their original positions.
Rules:
- Only alphabetic characters (a–z, A–Z) should be reversed.
- Digits (0–9) must remain at the same index as in the original string.
- No inbuilt methods like StringBuilder.reverse() should be used; solve it manually using arrays and loops.
Example:
Input: "abcde1234fgh567ijk"
Output: "kjihg1234fed567cba"
3.Task:
Write a Java program that performs the following tasks:
- Create a file programmatically and allow the user to enter data.
- Store the user input in a Map with the following structure: Key: Long number Value: String word
- The user should enter at least 3 entries. Validation Conditions: Condition 1 (Number Key Validation):
- The number must be even.
- All digits of the number must also be even. Examples of valid numbers: 246864, 888222 Examples of invalid numbers: 248678 (contains 7, 1, 3, etc.), 135792 Condition 2 (String Value Validation):
- The word must have exactly 6 letters.
- The word must be a palindrome (reads the same forwards and backwards). Example valid words: madam, deeded (length must be exactly 6) If both conditions are satisfied, store the number-word pair in the Map.
- After all entries are collected, write the valid data from the Map to another file.
Example Flow:
Enter number: 246864
Enter word: deified
--> Valid, added to map
Enter number: 248678
Enter word: madamm
--> Invalid, not added
4.Task:
Write a Java program that performs the following steps:
- Get employee details from the user: Employee ID (integer) Employee Name (string) Employee Salary (double) 2.Store all the entered employees into an ArrayList as objects. Create an Employee class with fields: id, name, and salary. Get input for at least 3 employees from the user.
- After storing data in ArrayList, Transfer all data into a LinkedList (one by one using loops — don’t use foreach or streams).
- Then, programmatically create a file (e.g., employees.txt) and write all the employee details into the file.
- Use only basic collections and file handling — No Map, no Stream, no foreach. Use Iterate interface
I put all answers in my repo. If you want you can check my repo...
Thank you for reading my small experience.
Keep learning and never give up!!!
Top comments (0)