company-wise questions (TCS, Wipro, Infosys)

🟦 TCS (NQT / Technical Round)

👉 Focus: Basics + MCQs + simple coding

🔹 MCQs (Common Pattern)

  1. What is the default fetch mode in PDO?
  2. Difference between echo and print in PHP?
  3. Which is faster: mysqli or PDO? (Tricky ❗)
  4. What is the use of LIMIT in SQL?
  5. Which function prevents SQL injection?

🔹 Coding Questions

1. Insert data using PDO

$stmt = $conn->prepare("INSERT INTO users(name,email) VALUES(?,?)");
$stmt->execute([$name,$email]);

2. Fetch and display users

$stmt = $conn->query("SELECT * FROM users");
$data = $stmt->fetchAll(PDO::FETCH_ASSOC);foreach($data as $row){
echo $row['name'];
}

🔹 Theory Questions

  • What is CRUD?
  • What is Primary Key?
  • What is SQL Injection?

👉 TCS Tip: Questions are easy but tricky wording.


🟪 Wipro (Technical + Coding Round)

👉 Focus: Logic + SQL + real use cases

🔹 SQL Questions

  1. Write query to find 2nd highest salary
SELECT MAX(salary) FROM employees 
WHERE salary < (SELECT MAX(salary) FROM employees);

  1. Difference between WHERE and HAVING
    👉 WHERE → before grouping
    👉 HAVING → after grouping

🔹 Coding Questions

1. Secure Login System (very common 🔥)

$stmt = $conn->prepare("SELECT * FROM users WHERE email=?");
$stmt->execute([$email]);
$user = $stmt->fetch();if($user && password_verify($pass,$user['password'])){
echo "Login success";
}

2. Update user data

$stmt = $conn->prepare("UPDATE users SET name=? WHERE id=?");
$stmt->execute([$name,$id]);

🔹 Scenario Questions

  • How will you secure user data?
  • How to handle large database?

👉 Wipro Tip: Focus on real-world usage + security


🟧 Infosys (Technical + HR Round)

👉 Focus: Concepts + scenario-based + clean coding

🔹 Theory Questions

  1. What is PDO and why preferred?
  2. What is normalization?
  3. Explain indexing
  4. What are transactions?

🔹 Coding Questions

1. Pagination (very important 🔥)

$limit = 10;
$offset = 0;$stmt = $conn->prepare("SELECT * FROM users LIMIT ? OFFSET ?");
$stmt->bindValue(1,$limit,PDO::PARAM_INT);
$stmt->bindValue(2,$offset,PDO::PARAM_INT);
$stmt->execute();

2. JOIN query

SELECT users.name, orders.id
FROM users
INNER JOIN orders ON users.id = orders.user_id;

🔹 HR + Scenario Questions

  • Explain a project you built
  • How do you debug errors?
  • What if database crashes?

👉 Infosys Tip: Explain logic clearly, not just code.


🔥 Common Questions Asked in ALL Companies

  • What is SQL Injection? How to prevent it?
  • Difference between bindParam() and bindValue()
  • What is password_hash()?
  • What is transaction?
  • What is index?

🎯 Smart Preparation Strategy

  • TCS → Practice MCQs + basics
  • Wipro → Practice SQL + real coding
  • Infosys → Focus on concepts + explanation

🚀 Final Interview Hack

If asked “How do you secure DB?” say:

“I use PDO prepared statements, input validation, password_hash, and transactions where needed to ensure security and consistency.”