KEMBAR78
Interview Preparation Reference Guide | PDF | Software Engineering | Software Development
0% found this document useful (0 votes)
49 views67 pages

Interview Preparation Reference Guide

The document is an Interview Preparation Reference Guide covering AWS Solutions Architect, Linux Fundamentals, and DevOps Overview. It includes key concepts, definitions, and questions related to cloud computing, Linux commands, and DevOps principles, along with practical tips for interview preparation. The content is structured in modules with a focus on essential knowledge and skills for technical interviews.

Uploaded by

pavanidubasi123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views67 pages

Interview Preparation Reference Guide

The document is an Interview Preparation Reference Guide covering AWS Solutions Architect, Linux Fundamentals, and DevOps Overview. It includes key concepts, definitions, and questions related to cloud computing, Linux commands, and DevOps principles, along with practical tips for interview preparation. The content is structured in modules with a focus on essential knowledge and skills for technical interviews.

Uploaded by

pavanidubasi123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 67

Interview Preparation Reference Guide

Module 1: AWS Solutions Architect

Introduction to Cloud Computing (1A)

1. What is cloud computing?


A: Delivery of computing services over the internet.

2. Name three cloud service models.


A: IaaS, PaaS, SaaS

3. What are the deployment models in cloud computing?


A: Public, Private, Hybrid, Community

4. List benefits of cloud computing.


A: Cost savings, flexibility, scalability, reliability, security.

5. What is elasticity in cloud computing?


A: Ability to automatically scale resources up/down.

6. What are Regions and Availability Zones in AWS?


A: Region is a geographic area; AZs are isolated locations within regions.

7. What is the difference between IaaS and PaaS?


A: IaaS provides raw infrastructure, PaaS provides runtime and environment.

8. What is the edge location in AWS?


A: Where content is cached via services like CloudFront.

Tip: Know examples of each service model.




Amazon EC2 (1B)
9. What is EC2 in AWS?
A: Elastic Compute Cloud - virtual server hosting.

10. What is an AMI?


A: Amazon Machine Image - template for an instance.

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
11. What are EC2 instance types?
A: General, Compute optimized, Memory optimized, Storage optimized.​

12. What is the difference between public IP and elastic IP?


A: Public IP changes, Elastic IP is static.

13. What are security groups?


A: Virtual firewalls controlling inbound/outbound traffic.

14. What is a key pair in EC2?


A: Used to SSH into EC2 instances securely.

15. What are EC2 pricing models?


A: On-demand, Reserved, Spot, Savings Plans.

16. What is a placement group?


A: Logical grouping of instances for optimized performance.

Tip: Practice launching EC2 and securing it.

Elastic Block Store (EBS) (1C)

17. What is EBS?


A: Block-level storage for EC2.

18. What are EBS volume types?


A: gp3, gp2, io1, sc1, st1.

19. Can EBS be encrypted?


A: Yes, with KMS.

20. Difference between AMI and snapshot?


A: AMI includes OS + data; snapshot is just a backup of a volume.

21. What is a Lifecycle Manager?


A: Automates snapshot creation.

Tip: Know how to attach/detach volumes from EC2.

Elastic File System (EFS) (1D)

22. What is EFS?


A: Scalable file storage for use with EC2.

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
23. Difference between EBS and EFS?
A: EFS is shared storage; EBS is attached to one instance.

24. What are mount targets?


A: Network endpoints used to access EFS.

25. Which OS supports EFS?


A: Linux-based systems.

Tip: Mention NFS protocol compatibility.

Simple Storage Service (S3) (1E)

26. What is S3?


A: Object storage for any data type.

27. What is versioning in S3?


A: Maintains multiple versions of objects.

28. What is a bucket?


A: Container for storing objects.

29. What is object lock in S3?


A: Prevents deletion/modification for compliance.

30. What are S3 storage classes?


A: Standard, IA, Glacier, Glacier Deep Archive, Intelligent Tiering.

31. What is multipart upload?


A: Uploading large files in parts.

32. What is S3 lifecycle management?


A: Automatically transitions data between classes or deletes.

33. What is server access logging in S3?


A: Logs requests to the bucket.

34. What is static website hosting in S3?


A: Serve websites directly from S3.

Tip: Know bucket policies vs. ACLs.

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
Virtual Private Cloud (VPC) (1F)

35. What is a VPC?


A: Virtual private network in AWS.

36. What is CIDR?


A: Defines IP range of VPC (e.g., 10.0.0.0/16).

37. What are subnets?


A: Subdivisions of VPC.

38. What are NACLs vs. Security Groups?


A: NACLs: stateless, SGs: stateful.

39. What is an Internet Gateway?


A: Allows internet access for VPC.

40. What is NAT Gateway?


A: Allows private instances to access the internet.

41. What are route tables in VPC?


A: Rules for traffic routing in VPC.

42. What is VPC peering?


A: Connect two VPCs privately.

Tip: Understand how to design secure VPCs.

Database Services (1G)

43. What is Amazon RDS?


A: Managed relational database service.

44. What engines does RDS support?


A: MySQL, PostgreSQL, MariaDB, Oracle, SQL Server, Aurora.

45. What is Multi-AZ deployment?


A: High availability setup across AZs.

46. What is a read replica?


A: For scaling read-heavy workloads.

47. What is DynamoDB?


A: NoSQL key-value and document DB.
The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
48. What is ElastiCache?
A: In-memory caching service.

49. What is Redshift?


A: AWS data warehouse.

Tip: Understand use cases for RDS vs. DynamoDB.

Route 53 (1H)

50. What is Route 53?


A: DNS web service.

51. What is a hosted zone?


A: Container for DNS records.

52. What are routing policies in Route 53?


A: Simple, Weighted, Latency-based, Failover, Geolocation.

53. What is a domain registrar?


A: Service to register domain names.

Tip: Understand failover scenarios and health checks.

IAM (Identity & Access Management) (1I)

54. What is IAM?


A: Controls access to AWS resources.

55. What are IAM roles?


A: Temporary credentials for services or users.

56. What is MFA in AWS?


A: Adds security using multi-factor authentication.

57. What are IAM policies?


A: JSON documents defining permissions.

58. What is AWS Organizations?


A: Manage multiple AWS accounts.

Tip: Differentiate between users, groups, roles, policies.

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
AWS Security & Monitoring (1J)

59. What is CloudTrail?


A: Records API calls.

60. What is CloudWatch?


A: Monitoring tool for AWS resources.

61. What are the five pillars of AWS Well-Architected Framework?


A: Operational Excellence, Security, Reliability, Performance Efficiency, Cost
Optimization.

Tip: Give real-world examples of using logs and alerts.

Application Integration (1K)

62. What is SNS?


A: Simple Notification Service - pub/sub messaging.

63. What is SQS?


A: Simple Queue Service - decouples components.

64. Difference between SNS and SQS?


A: SNS is push-based; SQS is pull-based.

Tip: Explain use case scenarios for integration.

Load Balancing & Auto Scaling (1L)

65. What is ELB?


A: Elastic Load Balancer distributes incoming traffic.
66. What are types of ELBs?
A: Classic, Application (ALB), Network (NLB), Gateway.

67. What is Auto Scaling?


A: Automatically adjust capacity based on demand.

68. What are Auto Scaling Groups?


A: Group of EC2 instances for scaling.

Tip: Describe a high-availability architecture.

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
Module 2: Linux Fundamentals

Basic Linux Concepts & Architecture

1. What is Linux?
A: Linux is an open-source Unix-like operating system kernel.

2. What is the Linux kernel?


A: The core of the OS that manages hardware resources and system calls.

3. What is a Linux distribution?


A: A complete operating system built around the Linux kernel (e.g., Ubuntu,
CentOS, Red Hat).

4. What are runlevels in Linux?


A: System states defining what services are available (deprecated in
systemd-based systems).

5. What is the file system hierarchy in Linux?


A: Standard layout like `/bin`, `/etc`, `/home`, `/var`, `/usr`.

Tip: Draw and memorize the Linux file structure tree.

Basic Linux Commands

6. How do you list files in a directory?


A: `ls`, `ls -l`, `ls -a`

7. How do you view the current directory?


A: `pwd`
8. How do you copy a file?
A: `cp source destination`

9. How do you move or rename a file?


A: `mv old new`
10. How do you remove a file or directory?
A: `rm filename`, `rm -r directory`

11. How do you view contents of a file?


A: `cat`, `less`, `more`, `tail`, `head`

12. How do you create a directory?


A: `mkdir dirname`

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
13. How do you change file permissions?
A: `chmod`, e.g., `chmod 755 script.sh`

14. How do you check disk usage?


A: `df -h`, `du -sh `

15. How do you check running processes?


A: `ps aux`, `top`, `htop`

Tip: Know at least 25 basic Linux commands with real use cases.

User and Group Management

16. How do you add a user?


A: `useradd username`

17. How do you set a password for a user?


A: `passwd username`

18. How do you delete a user?


A: `userdel username`

19. How do you add a user to a group?


A: `usermod -aG groupname username`

20. How do you list all users?


A: Check `/etc/passwd`

21. How do you create a group?


A: `groupadd groupname`

22. How do you switch users?


A: `su - username`

23. What is the root user?


A: Superuser with unrestricted access.

Tip: Be careful when using root – show you know how to restrict its use securely.

File Permissions

24. What are file permission types in Linux?


A: Read (r), Write (w), Execute (x)

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
25. How are permissions represented?
A: Symbolic (rwx) or Numeric (e.g., 755)

26. What does `chmod 777 file.sh` mean?


A: Full read/write/execute for all.

27. How do you change file ownership?


A: `chown user:group filename`

28. How do you change file group?


A: `chgrp group filename`

29. What is umask?


A: Default permission mask for new files/directories.

Tip: Explain the difference between user, group, and others with examples.

VI Editor & File Manipulation

30. How do you enter insert mode in vi?


A: Press `i`

31. How do you save and exit in vi?


A: `:wq`

32. How do you quit without saving in vi?


A: `:q!`

33. How do you delete a line in vi?


A: `dd`

34. How do you search in vi?


A: `/searchterm`

35. How do you copy and paste in vi?


A: `yy` to copy, `p` to paste

Tip: Practice basic editing commands and navigation in vi editor.

Shell Scripting

36. What is a shell script?


A: A program written in shell language to automate tasks.

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
37. How do you create a shell script?
A: Create a `.sh` file, add shebang `!/bin/bash`, write commands.

38. How do you run a shell script?


A: `bash script.sh` or `./script.sh` (with execute permission)

39. How do you declare a variable in a shell script?


A: `name="John"`

40. How do you read user input in shell?


A: `read name`

41. How do you use if-else in shell?


A:
```bash
if [ $a -eq $b ]; then
echo "Equal"
else
echo "Not Equal"
fi
```

42. How do you use loops in shell scripts?


A:
```bash
for i in {1..5}; do
echo $i
done
```

43. How do you write a while loop?


A:

```bash
while [ $i -le 5 ]; do
echo $i
((i++))
done
```

Tip: Write small shell scripts for automation examples (e.g., backup script).

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
SSH (Secure Shell)

44. What is SSH used for?


A: Securely connecting to remote servers.

45. How do you SSH into a server?


A: `ssh user@hostname`

46. How do you use SSH with a private key?


A: `ssh -i key.pem user@hostname`

47. What is an SSH key pair?


A: Public and private key for authentication.

48. Where is the SSH configuration file?


A: `~/.ssh/config`

49. What port does SSH use by default?


A: Port 22

50. How do you copy files over SSH?


A: `scp file.txt user@server:/path`
Tip: Know how to connect, configure, and troubleshoot SSH connections.
—-------------------------------------------------------------------------------------------------------------
Bonus Questions

51. What is cron in Linux?


A: Job scheduler for periodic tasks.

52. What is the `grep` command?


A: Search for patterns in text.
53. What is the `find` command?
A: Search files and directories.

54. What is the difference between `>` and `>>`?


A: `>` overwrites, `>>` appends.

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
Module 3: DevOps Overview

DevOps Fundamentals

1. What is DevOps?
A: A set of practices that combines software development (Dev) and IT operations
(Ops) to shorten the system development lifecycle.

2. Why is DevOps important?


A: Enables faster development, testing, and release with better quality and
collaboration.

3. What are the key benefits of DevOps?


A: Faster delivery, higher reliability, better collaboration, early defect detection,
improved deployment frequency.

4. What are the core principles of DevOps?


A: Automation, collaboration, continuous integration, continuous delivery,
monitoring, feedback.

5. Name popular DevOps tools.


A: Git, Jenkins, Docker, Kubernetes, Ansible, Terraform, Prometheus, Grafana.

Tip: Use real-world examples, e.g., "We used Jenkins for CI and Ansible for
provisioning."

DevOps vs Traditional Models

6. What is the difference between Waterfall and Agile?


A: Waterfall is sequential, Agile is iterative and incremental.

7. How does DevOps complement Agile?


A: DevOps ensures Agile-developed features are tested, integrated, and deployed
quickly and reliably.

8. What is the difference between Agile and DevOps?


A: Agile focuses on software development, DevOps includes operations and
deployment.

9. Why do companies move from Waterfall to DevOps?


A: To reduce time-to-market, improve quality, and increase deployment frequency.

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
10. What are the challenges in traditional software delivery?
A: Long release cycles, siloed teams, manual deployments, inconsistent
environments.

Tip: Be prepared to describe how DevOps solved a specific bottleneck.

DevOps Lifecycle & Stages

11. What are the stages of the DevOps lifecycle?


A: Plan, Develop, Build, Test, Release, Deploy, Operate, Monitor.

12. What happens in the Plan stage?


A: Requirements gathering, sprint planning, backlog refinement.

13. What happens in the Develop stage?


A: Writing and managing code using version control systems.

14. What happens in the Build stage?


A: Code compilation, build automation with tools like Maven.

15. What happens in the Test stage?


A: Unit tests, integration tests, automated test scripts.

16. What happens in the Release stage?


A: Packaging and approval for production deployment.
17. What happens in the Deploy stage?
A: Deployment to production/staging environments using tools like Jenkins or
Ansible.

18. What happens in the Operate stage?


A: Application running, logging, performance tuning.

19. What happens in the Monitor stage?


A: Continuous feedback, monitoring using Prometheus, Grafana.

Tip: Use lifecycle diagrams when explaining.

Continuous Integration & Continuous Delivery (CI/CD)

20. What is Continuous Integration (CI)?


A: Merging code changes frequently and testing them automatically.

21. What is Continuous Delivery (CD)?


A: Automatically preparing tested code for release to production.
The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
22. What is Continuous Deployment?
A: Code changes automatically deployed to production after testing.

23. What tools are used in CI/CD pipelines?


A: Git, Jenkins, Docker, Kubernetes, Maven, Ansible.

24. How does CI/CD improve productivity?


A: Reduces manual work, speeds up testing and deployment, catches errors early.

25. What is a CI pipeline?


A: Automated steps for building, testing, and validating code before merging.

26. What is a CD pipeline?


A: Pipeline that delivers code to staging/production environments.

27. Difference between CI and CD?


A: CI focuses on testing code; CD focuses on delivering/deploying it.

28. What is a rollback strategy in CI/CD?


A: Reverting to previous stable version if deployment fails (e.g., blue-green
deployment).

29. What is blue-green deployment?


A: Two identical environments where one serves production and the other is
updated/tested.

30. What is canary deployment?


A: Rolling out changes to a small subset of users before full rollout.

Tip: Show awareness of rollback strategies and risk mitigation.

DevOps Automation

31. Why is automation crucial in DevOps?


A: Reduces manual errors, speeds up processes, improves reliability.

32. Which DevOps stages are typically automated?


A: Build, Test, Deploy, Monitor.

33. What are some common automation tools in DevOps?


A: Jenkins (CI), Ansible (provisioning), Terraform (infra), Selenium (testing).

34. What is infrastructure as code (IaC)?


A: Managing infrastructure using configuration files rather than manual processes.
The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
35. Name two IaC tools.
A: Terraform, CloudFormation.

36. What is configuration management?


A: Process of maintaining systems, servers, and software in a desired state.

37. Which tools are used for configuration management?


A: Ansible, Chef, Puppet.

38. What is the role of Docker in DevOps automation?


A: Enables consistent development and deployment using containers.

Tip: Demonstrate your experience with automation scripts/tools.

Culture and Collaboration in DevOps

39. What cultural changes does DevOps introduce?


A: Collaboration, shared responsibility, feedback loops, agile mindset.

40. How does DevOps improve communication?


A: Breaks silos between Dev and Ops teams.

41. What is a DevOps engineer responsible for?


A: CI/CD pipelines, infrastructure, automation, monitoring, collaboration.

42. How do you handle conflicts between development and operations teams?
A: Establish shared goals, transparency, and frequent feedback.

43. What KPIs would you use to measure DevOps success?


A: Deployment frequency, lead time, MTTR (mean time to recovery), change
failure rate.

Miscellaneous & Scenario-Based Questions

44. How would you design a CI/CD pipeline from scratch?


A: Start with Git repo, add Jenkins for CI, Docker for packaging, and Ansible for
deployment.

45. How do you ensure security in a DevOps pipeline?


A: Code scanning tools (e.g., SonarQube), secrets management, access control.

46. How do you handle rollback if a production deployment fails?


A: Use backup artifacts, revert deployments, or implement blue-green
deployments.
The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
47. What are some DevOps anti-patterns?
A: Manual deployments, lack of testing, siloed teams, skipping monitoring.

48. Describe a real-time issue you resolved with DevOps.


A: \[Your answer here—e.g., rollback with Jenkins and Git after deployment
failure.]

49. What is the role of monitoring in DevOps?


A: To ensure system health, detect failures, gather feedback, and improve
performance.

50. How do you handle secret management in CI/CD?


A: Use tools like AWS Secrets Manager, Vault, or Jenkins credentials.

51. What’s your experience with containerization in DevOps?


A: [Tailor this to your experience—mention Docker, orchestration, deployment.]

Tip: Always bring context—talk about tools and their impact on the team and
delivery.

Module 4: DevOps on Cloud (AWS)

General Concepts of DevOps on AWS

1. What is AWS DevOps?


A: AWS DevOps refers to using AWS services and tools to implement DevOps
practices like CI/CD, automation, and infrastructure as code.

2. Which AWS services support the DevOps lifecycle?


A: CodeCommit, CodeBuild, CodeDeploy, CodePipeline, CloudFormation,
CloudWatch, Elastic Beanstalk.

3. How does AWS support automation in DevOps?


A: Through infrastructure as code (CloudFormation, CDK), managed CI/CD
(CodePipeline), and configuration management (OpsWorks, Systems Manager).

4. Compare AWS DevOps and Azure DevOps.


A: AWS DevOps focuses on AWS-native tools; Azure DevOps is
platform-independent and has broader tool integrations.

Tip: Know when to use native tools vs open-source tools.

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
AWS CodeCommit

5. What is AWS CodeCommit?


A: A fully managed source control service that hosts secure Git repositories.

6. How is CodeCommit different from GitHub?


A: CodeCommit is AWS-native, integrates with IAM and other AWS services.
GitHub is third-party.

7. What protocols are used for accessing CodeCommit?


A: HTTPS and SSH.

8. How do you authenticate to CodeCommit?


A: Via IAM users with Git credentials or SSH keys.

9. How do you integrate CodeCommit with CodePipeline?


A: As the source stage in a pipeline to trigger builds and deployments.
10. Can you trigger a Lambda function on a CodeCommit event?
A: Yes, using CloudWatch Events or EventBridge.

Tip: Explain a complete repo → build → deploy workflow with CodeCommit.

AWS CodeBuild

11. What is AWS CodeBuild?


A: A fully managed continuous integration service that compiles source code, runs
tests, and produces deployable artifacts.

12. How does CodeBuild work?


A: Uses `buildspec.yml` to define build steps; fetches source, builds, and outputs
artifacts.

13. What is a buildspec file?


A: YAML file that defines build commands and phases for CodeBuild.

14. How do you pass environment variables in CodeBuild?


A: Using the buildspec file or in the CodeBuild project settings.

15. What runtimes does CodeBuild support?


A: Java, Python, Node.js, .NET, Docker, etc.

16. How do you use CodeBuild in a CI/CD pipeline?


A: As a "Build" stage in CodePipeline.

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
17. How does CodeBuild handle caching?
A: Through S3 or local caching to reduce build time.

18. Can CodeBuild use custom Docker images?


A: Yes, by specifying a custom image from ECR or Docker Hub.

Tip: Memorize basic structure of `buildspec.yml`.

AWS CodeDeploy

19. What is AWS CodeDeploy?


A: A deployment service that automates application deployments to EC2, Lambda,
and on-premises.

20. What is an AppSpec file in CodeDeploy?


A: YAML/JSON file that defines how CodeDeploy deploys the application.

21. What are deployment types in CodeDeploy?


A: In-place (on existing instances), Blue/Green (new instances or containers).

22. What is a deployment group?


A: A set of tagged instances or ASG that receive the deployment.

23. How do you monitor deployment status in CodeDeploy?


A: Through the AWS Console, CLI, or CloudWatch.

24. What is the role of hooks in AppSpec?


A: Define lifecycle events (BeforeInstall, AfterInstall, ApplicationStart, etc.)

25. Can CodeDeploy deploy to ECS?


A: Yes, it supports ECS blue/green deployments.

Tip: Know the lifecycle event hooks and AppSpec structure.

AWS CodePipeline

26. What is AWS CodePipeline?


A: A fully managed CI/CD service that orchestrates the build, test, and deploy
phases.

27. What are the stages of a CodePipeline?


A: Source → Build → Test → Deploy

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
28. How do you trigger a pipeline in CodePipeline?
A: Automatically via source repo changes (e.g., Git push) or manually.

29. Can you include manual approval steps in CodePipeline?


A: Yes, using the "Manual Approval" action type.

30. How do you integrate third-party tools with CodePipeline?


A: Using AWS Lambda, webhook integrations, or custom actions.

31. How is CodePipeline billed?


A: Per active pipeline per month.

32. How do you rollback in a pipeline?


A: Manual re-deployment of previous artifacts or using CodeDeploy rollback
settings.

33. What happens if a stage fails in CodePipeline?


A: Pipeline stops execution and logs the failure for that stage.

34. Can CodePipeline deploy to multiple regions?


A: Yes, using regional deploy stages.

Tip: Always mention artifact flow from CodeCommit → CodeBuild → CodeDeploy.

AWS CloudFormation

35. What is AWS CloudFormation?


A: A service to model and provision AWS resources using JSON/YAML templates.

36. What is a CloudFormation stack?


A: A collection of AWS resources that you can manage as a single unit.

37. What is a CloudFormation template?


A: A file that defines AWS resources and configuration in a declarative format.

38. What is the purpose of `Parameters` and `Mappings` in a template?


A: Parameters allow user input; Mappings define conditional values.

39. What are `Outputs` in a CloudFormation template?


A: Information to display or pass to other stacks.

40. What is a nested stack?


A: A stack within a stack to manage resources modularly.

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
41. How does CloudFormation handle dependencies?
A: Automatically creates resources in the correct order using references.

42. What is drift detection in CloudFormation?


A: Identifies changes made to resources outside of CloudFormation.

43. What is the difference between `CreationPolicy` and `UpdatePolicy`?


A: They control how resources are created or updated during stack operations.

Tip: Practice writing basic YAML templates with EC2, S3, IAM resources.

DevOps on AWS – Scenarios and Best Practices

44. How do you implement end-to-end CI/CD in AWS?


A: Use CodeCommit → CodeBuild → CodeDeploy → CodePipeline +
CloudFormation.

45. What are the security best practices for AWS DevOps tools?
A: Least privilege IAM roles, encrypted S3 buckets, secure Git credentials, MFA.

46. How do you handle secrets in AWS pipelines?


A: Store in AWS Secrets Manager or Parameter Store.

47. What’s the difference between CodeDeploy in-place vs blue/green?


A: In-place updates same instance, blue/green uses new environment for
zero-downtime.

48. How do you automate infrastructure creation in DevOps pipelines?


A: Using CloudFormation or Terraform as part of the pipeline.

49. What are some CI/CD challenges in cloud?


A: Tool integration, deployment rollback, secret management, environment parity.

50. How do you monitor CI/CD pipeline health?


A: Using AWS CloudWatch, pipeline logs, and notification integrations (e.g., SNS,
Slack).

51. How would you secure your CodePipeline?


A: Use secure IAM roles, encrypted artifacts, limit trigger sources.

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
Module 5: Managing Source Code - Git and GitHub

Git Fundamentals

1.​ What is Git?​


A: A distributed version control system used for tracking changes in source
code.​

2.​ What’s the difference between Git and GitHub?​


A: Git is the tool; GitHub is a web-based hosting service for Git repositories.​

3.​ What are the benefits of using Git?​


A: Collaboration, version history, branching, distributed development,
rollback.​

4.​ What is a version control system?​


A: A system that records changes to files over time.​

5.​ What’s the difference between centralized and distributed version control?​
A: Distributed (like Git) has full project history on every user's system.

Git Configuration and Initialization

6.​ How do you configure Git with your username and email?​
git config --global user.name "Your Name" ​
git config --global user.email "your@email.com"​

7.​ How do you initialize a Git repository?​


git init​

8.​ How do you clone a Git repository?​


git clone https://github.com/user/repo.git​

9.​ How do you check the Git configuration? ​


git config --list

Tip: Always ensure correct global vs local config settings.

Git Workflow and Commands

10.​How do you add changes to the staging area?​


git add filename ​

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
git add . adds all changes​

11.​How do you commit changes?​


git commit -m "Commit message"​

12.​How do you check the current status of files?​


git status​

13.​How do you see the commit history?​


git log​

14.​How do you see a summary of commits?​


git log --oneline​

15.​How do you ignore files in Git?​


A: Use .gitignore file to list files/folders to exclude.​

16.​How do you view changes made before committing?​


git diff​

17.​How do you remove a file from Git but not delete from disk?​
git rm --cached filename

Branching and Merging

18.​What is a branch in Git?​


A: A separate line of development.​

19.​How do you create a new branch?​


git branch new-feature​

20.​How do you switch branches?​


git checkout branch-name ​
git switch branch-name​

21.​How do you create and switch in one command?​


git checkout -b new-branch​

22.​How do you merge branches in Git?​


git checkout main ​
git merge feature-branch​

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
23.​What is a merge conflict?​
A: When two branches modify the same part of a file differently.​

24.​How do you resolve merge conflicts?​


A: Manually edit conflicted files, then stage and commit them.​

25.​What is a fast-forward merge?​


A: A merge that simply moves the branch pointer forward.

Rebase, Squash, Stash

26.​What is Git rebase?​


A: Reapplies commits on top of another base tip; used to keep history linear.​

27.​How do you use Git rebase?​


git checkout feature ​
git rebase main​

28.​What is Git squash?​


A: Combines multiple commits into one.​

29.​How do you squash commits?​


A: git rebase -i HEAD~N and use squash.​

30.​What is Git stash?​


A: Temporarily saves uncommitted changes.​

31.​How do you stash changes?​


git stash​

32.​How do you apply stashed changes?​


git stash apply​

33.​How do you drop a stash?​


git stash drop

Resetting and Reverting

34.​What is git reset?​


A: Moves the HEAD pointer and optionally changes index/working directory.

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
35.​Difference between --soft, --mixed, --hard in git reset?​

●​ --soft: keeps changes staged​

●​ --mixed: keeps changes unstaged​

●​ --hard: discards changes​

36.​What is git revert?​


A: Creates a new commit that undoes a previous commit.

Tip: Use reset for local changes and revert for shared/public changes.

Remote Repositories & GitHub

37.​How do you add a remote GitHub repo?​


git remote add origin https://github.com/user/repo.git

38. How do you push code to a remote repo?​


​ git push origin main

39.​How do you pull changes from a remote repo?​


git pull origin main​

40.​What is the difference between fetch and pull?​


A: fetch downloads updates; pull does fetch + merge.​

41.​How do you fork a GitHub repo?​


A: Click "Fork" on GitHub to create a copy under your account.​

42.​What is a pull request?​


A: A request to merge your branch into another branch in GitHub.​

43.​What is a GitHub action?​


A: A CI/CD workflow automation tool in GitHub.​

44.​How do you handle GitHub merge conflicts?​


A: Pull latest changes, resolve conflicts, commit and push again.

Collaboration & Git Best Practices

45.​What is a branching strategy?​


A: A defined method of organizing branches (e.g., Git Flow, trunk-based

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
development).​

46.​What is the purpose of a develop branch?​


A: Used for integrating features before merging to main.​

47.​What is a feature branch?​


A: A branch dedicated to a specific feature or bug fix.​

48.​What is main or master in Git?​


A: The default primary branch in most repos.​

49.​Why is code review important in GitHub workflows?​


A: Ensures quality, standards, and team collaboration.​

50.​How do you enforce PR reviews before merge in GitHub?​


A: Set branch protection rules in GitHub settings.​

51.​How do you tag a version in Git?​


git tag v1.0 ​
git push origin v1.0

Module 6: Build Tools – Maven

Build Tools Basics

1.​ What is a build tool?​


A: A software utility that automates the creation of executable applications
from source code.​

2.​ What is Apache Maven?​


A: A project management and comprehension tool used primarily for Java
projects to manage builds, dependencies, and documentation.​

3.​ What are some other build tools besides Maven?​


A: Gradle, Ant, Make, SBT.​

4.​ Why is Maven preferred over Ant?​


A: Maven uses a standard directory structure and convention over
configuration.

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
Maven Architecture and Lifecycle

5.​ What is the Maven build lifecycle?​


A: A sequence of phases for building a project: validate, compile, test,
package, verify, install, deploy.​

6.​ What are Maven goals and phases?​


A: A goal is a task (e.g., compile), and a phase is a stage in the lifecycle.​

7.​ What are the three built-in lifecycles in Maven?​


A: default, clean, and site.​

8.​ What does the clean lifecycle do?​


A: Cleans up artifacts from previous builds (mvn clean).​

9.​ What happens during the install phase?​


A: Installs the built artifact to the local repository.​

10.​How do you run the test phase?​


mvn test​

11.​What is the default lifecycle phase for a build?​


A: package

Tip: Be able to list all 7 phases of the default lifecycle in order.

Maven Project Structure

12.​What is a POM file in Maven?​


A: pom.xml is the Project Object Model file containing build configuration,
dependencies, plugins, etc.​

13.​What are the main elements of a POM file?​


A: <groupId>, <artifactId>, <version>, <dependencies>, <build>, <plugins>​

14.​What is groupId in Maven?​


A: It uniquely identifies your project group.​

15.​What is artifactId?​
A: Name of the project (usually project folder name).​

16.​What is version in Maven?​


A: Project's version.​

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
17.​Where is the local Maven repository stored?​
A: Typically in ~/.m2/repository.​

18.​How do you change the local repository path?​


A: Modify the settings.xml file in the .m2 directory.

Dependency Management

19.​How does Maven handle dependencies?​


A: It downloads and manages libraries from remote repositories based on
pom.xml.​

20.​What is the difference between compile, provided, and runtime scopes?​

●​ compile: Available in all classpaths.​

●​ provided: Needed for compile but provided by runtime (e.g., servlet-api).​

●​ runtime: Needed at runtime but not compile time.​

21.​What is transitive dependency?​


A: A dependency required by another dependency, automatically included.​

22.​How do you exclude a transitive dependency?​


A: Use <exclusions> in the dependency block.​

23.​What is a Maven repository?​


A: A directory or server where project JARs, libraries, plugins are stored.​

24.​Difference between local, central, and remote repositories?​

●​ Local: On your system​

●​ Central: Maven’s global repository​

●​ Remote: Company-hosted repository (e.g., Nexus, Artifactory)​

25.​How do you update dependencies in Maven?

mvn dependency:resolve

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
Maven Plugins and Goals

26.​What is a Maven plugin?​


A: A collection of goals that perform tasks (e.g., compiler, surefire, jar).​

27.​What is the maven-compiler-plugin used for?​


A: Compiles the Java source code.​

28.​What is the maven-surefire-plugin used for?​


A: Runs unit tests.​

29.​What is the maven-jar-plugin used for?​


A: Packages the project as a JAR file.​

30.​How do you add a plugin in POM?​


A:

<build>
<plugins>
<plugin>
<groupId>...</groupId>
<artifactId>...</artifactId>
</plugin>
</plugins>
</build>

31.​What does mvn validate do?​


A: Validates project structure and POM before any build starts.

Maven Archetypes and Multi-Module Projects

32.​What is a Maven archetype?​


A: A template for generating a Maven project structure.​

33.​How do you generate a Maven project using archetype?​


mvn archetype:generate​

34.​What is a multi-module project in Maven?​


A: A project with multiple submodules managed under a parent POM.​

35.​Why use multi-module Maven projects?​


A: To manage related components and dependencies centrally.

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
Code Coverage and Reporting

36.​What is JaCoCo in Maven?​


A: Java Code Coverage tool integrated with Maven.​

37.​How do you integrate JaCoCo with Maven?​


A:

<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
</plugin>

38.​How do you generate a JaCoCo coverage report?​


mvn jacoco:prepare-agent test jacoco:report​

39.​What does the target/ folder contain?​


A: Compiled classes, packaged files (JAR/WAR), reports.

Common Maven Commands

40.​Build and package the project:​


mvn package​

41.​Clean build directory:​


mvn clean​

42.​Compile source code:​


mvn compile​

43.​Run tests:​
mvn test​

44.​Install the artifact locally:​


mvn install​

45.​Deploy to a remote repository:​


mvn deploy​

46.​Run a specific plugin goal:​


mvn surefire:test​

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
47.​Check dependency tree:​
mvn dependency:tree

Real-World & Scenario Questions

48.​How do you automate builds using Maven and Jenkins?​


A: Create Jenkins job → Pull code from Git → Run mvn clean install →
Archive artifacts.​

49.​How do you manage environment-specific configs in Maven?​


A: Use Maven profiles in pom.xml.​

50.​What happens if a dependency is not available in the central repo?​


A: Add a custom remote repo URL to POM or manually install the JAR using
mvn install:install-file.​

51.​How can you reduce build time in Maven?​


A: Use incremental builds, skip tests when unnecessary, leverage parallel
builds.

Module 7: Jenkins – Continuous Integration

Jenkins Fundamentals

1.​ What is Jenkins?​


A: Jenkins is an open-source automation server used to implement CI/CD
pipelines.​

2.​ What is Continuous Integration?​


A: The practice of frequently integrating code into a shared repository and
verifying each integration with automated builds and tests.​

3.​ What are the key benefits of Jenkins?​


A: Automation, faster feedback, improved code quality, integration with many
tools.​

4.​ What language is Jenkins written in?​


A: Java​

5.​ What is the default port of Jenkins?​


A: Port 8080

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.

Jenkins Architecture

6.​ What is Jenkins Master-Slave architecture?​


A: Master controls jobs and schedules; slaves run build tasks on different
environments.​

7.​ Why use agent/slave nodes in Jenkins?​


A: To distribute build load across multiple machines or platforms.​

8.​ How do you connect a slave node to Jenkins master?​


A: Using SSH, JNLP, or via cloud agents.​

9.​ What is a label in Jenkins?​


A: A tag used to assign jobs to specific nodes with matching capabilities.​

10.​How does Jenkins communicate with agents?​


A: Over secure channels using SSH or JNLP protocols.

Installing and Configuring Jenkins

11.​How do you install Jenkins on Linux?​


A: Install Java → Add Jenkins repo → sudo apt install jenkins​

12.​Where is Jenkins configuration stored?​


A: In the Jenkins home directory, typically /var/lib/jenkins.​

13.​What are Jenkins plugins?​


A: Extensions that add new features or integrations.​

14.​How do you install a plugin in Jenkins?​


A: Through “Manage Jenkins” → “Manage Plugins” → Available → Install.​

15.​What is the purpose of the Jenkins CLI?​


A: To manage Jenkins from the command line or automation scripts.


Jenkins Jobs & Pipelines

16.​What are the types of Jenkins jobs?​


A: Freestyle, Pipeline, Multibranch, and Folder.​

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
17.​How do you create a freestyle job?​
A: “New Item” → Select Freestyle Project → Configure steps.​

18.​What is a pipeline job in Jenkins?​


A: A job defined using code (Jenkinsfile) that executes steps as a CI/CD
pipeline.​

19.​What is a Jenkinsfile?​
A: A text file that defines the CI/CD pipeline as code.​

20.​What are the two types of pipeline syntax?​


A: Declarative and Scripted.

Declarative Pipelines (Jenkinsfile)

21.​What is the syntax of a basic declarative pipeline?

pipeline {

agent any

stages {

stage('Build') {

steps {

echo 'Building...'

}​

22.​How do you define environment variables in a pipeline?

environment {

VAR_NAME = "value"

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
23.​What is a stage in Jenkins pipeline?​
A: A block that groups steps (e.g., build, test, deploy).​

24.​What is a post block in Jenkins?​


A: Contains steps to run after all pipeline stages (e.g., always, success,
failure).​

25.​How do you add parallel steps in Jenkins?

parallel {

stage1 {

steps { ... }

stage2 {

steps { ... }

Scripted Pipelines

26.​What is a scripted pipeline?​


A: Uses more flexible Groovy-based syntax for complex logic.​

27.​Example of scripted syntax:

node {

stage('Build') {

echo 'Building...'

28.​When should you use scripted vs declarative pipelines?​


A: Use declarative for simplicity and consistency; use scripted for complex
logic.​

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
Jenkins Integration

29.​How do you integrate Jenkins with GitHub?​


A: Install GitHub plugin → Set GitHub project → Use webhook or polling.​

30.​What is a GitHub webhook?​


A: A trigger that notifies Jenkins of repo changes (push, pull request).​

31.​How do you trigger Jenkins job on Git push?​


A: Use GitHub webhooks or Git SCM polling.​

32.​How do you deploy artifacts using Jenkins?​


A: Use post block or deployment scripts to deploy to a server or cloud
service.​

33.​How do you integrate Maven with Jenkins?​


A: Use “Invoke top-level Maven targets” build step and define goals like clean
install.​

34.​How do you integrate SonarQube with Jenkins?​


A: Install SonarQube plugin, configure server, add analysis stage in
Jenkinsfile.​

35.​How do you send email notifications from Jenkins?​


A: Configure SMTP server and use “Email Notification” in Post-build Actions.


Jenkins Build Triggers

36.​What are Jenkins build triggers?​


A: Ways to start jobs automatically (e.g., SCM polling, webhook, cron
schedule).​

37.​What is SCM polling in Jenkins?​


A: Jenkins checks the source control periodically for changes.​

38.​How do you configure a CRON job in Jenkins?​


A: Use the Build Periodically field with cron expression.​

39.​What is the difference between polling and webhook triggers?​


A: Polling checks periodically; webhook triggers immediately.

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
Jenkins Notifications & Reports

40.​How do you enable Slack notifications in Jenkins?​


A: Use Slack plugin → Generate Slack token → Configure Webhook.​

41.​How do you publish JUnit test reports in Jenkins?​


A: Use “Publish JUnit test result report” and specify results XML path.​

42.​How do you generate code coverage reports in Jenkins?​


A: Integrate tools like JaCoCo or Cobertura and publish using plugins.

Advanced Jenkins Usage

43.​What is Jenkins shared library?​


A: Reusable Groovy scripts to be used across pipelines for standardization.​

44.​What is Blue Ocean in Jenkins?​


A: A modern Jenkins UI for visualizing pipeline flow.​

45.​What are credentials in Jenkins?​


A: Securely stored passwords, SSH keys, API tokens used in builds.​

46.​How do you secure sensitive data in Jenkins?​


A: Use Jenkins Credentials plugin and reference them securely in pipelines.​

47.​How do you archive build artifacts in Jenkins?​


A: Use “Archive the artifacts” step with file patterns.​

48.​What is the use of stash and unstash in pipelines?​


A: To pass files between pipeline stages.

Scenario-Based Questions

49.​How would you set up a CI pipeline for a Java app?​


A: Use Git → Jenkins → Maven → JUnit → Code Coverage → Deploy.​

50.​How do you handle failed deployments in Jenkins?​


A: Use conditional steps, post failure notifications, rollback scripts.​

51.​How do you scale Jenkins for a large team?​


A: Add agent nodes, use Jenkinsfile, shared libraries, distributed builds.​

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
Module 8: Docker & Containerization

Docker Fundamentals

1.​ What is Docker?​


A: Docker is a platform that uses OS-level virtualization to deliver software in
packages called containers.​

2.​ What is a container?​


A: A lightweight, portable, and self-sufficient unit that includes everything
needed to run an application.​

3.​ What is containerization?​


A: Packaging applications and dependencies into containers for consistency
across environments.​

4.​ What is the difference between containers and virtual machines?​


A: Containers share the host OS; VMs include their own OS, making them
heavier.​

5.​ What is Docker Hub?​


A: A cloud-based repository for Docker images.

Docker Architecture

6.​ What are the components of Docker architecture?​


A: Docker Client, Docker Daemon, Docker Images, Containers, Docker
Registries.​

7.​ What is the Docker Engine?​


A: The core of Docker that runs containers and manages images.​

8.​ What is the Docker daemon?​


A: A background service that manages Docker objects.​

9.​ How does the Docker client communicate with the daemon?​
A: Via REST API over UNIX socket or network interface.

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
Docker Installation & Setup

10.​How do you install Docker on Linux?​


A: Use the package manager (e.g., apt, yum) and follow Docker’s official
instructions.​

11.​How do you verify Docker installation?​


docker --version​

12.​What is the command to start the Docker service?​


sudo systemctl start docker​

13.​How do you check if Docker is running?​


sudo systemctl status docker

Docker Images & Containers

14.​What is a Docker image?​


A: A read-only template used to create containers.​

15.​How do you create a container from an image?​


docker run image-name​

16.​How do you list running containers?​


docker ps​

17.​How do you list all containers (running + stopped)?​


docker ps -a​

18.​How do you stop a running container?​


docker stop container_id​

19.​How do you remove a container?​


docker rm container_id​

20.​How do you remove an image?​


docker rmi image_id​

21.​How do you create an image from a container?​


docker commit container_id new_image_name​

22.​How do you rename a container?​


docker rename old_name new_name

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
Docker Commands & Networking

23.​How do you expose a port in Docker?​


docker run -p host_port:container_port image_name​

24.​What is port binding in Docker?​


A: Mapping container ports to host ports to enable external access.​

25.​How do you exec a command in a running container?​


docker exec -it container_id bash​

26.​How do you start a container in detached mode?​


docker run -d image_name​

27.​How do you see logs of a container?​


docker logs container_id

Dockerfile & Image Creation

28.​What is a Dockerfile?​
A: A text document containing instructions to build a Docker image.​

29.​What are common Dockerfile instructions?​


A: FROM, RUN, CMD, COPY, ADD, EXPOSE, ENV, WORKDIR,
ENTRYPOINT​

30.​What is the difference between CMD and ENTRYPOINT?​

●​ CMD sets default command.​

●​ ENTRYPOINT sets fixed command to run.​

31.​How do you build a Docker image?​


docker build -t image_name .​

32.​How do you pass arguments to Dockerfile?​


Use ARG in Dockerfile and --build-arg in build command.

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
Docker Volumes

33.​What is a Docker volume?​


A: Persistent storage mechanism used by containers.​

34.​How do you create a volume?​


docker volume create volume_name​

35.​How do you mount a volume?​


docker run -v volume_name:/path/in/container image​

36.​What’s the difference between volume and bind mount?​

●​ Volume: Managed by Docker.​

●​ Bind mount: Maps to a host file system path.

Docker Compose

37.​What is Docker Compose?​


A: A tool to define and run multi-container applications using a YAML file.​

38.​What is the default file name for Docker Compose?​


A: docker-compose.yml​

39.​How do you start services with Docker Compose?​


docker-compose up​

40.​How do you stop services in Compose?​


docker-compose down​

41.​Can you scale services using Compose?​


A: Yes, use --scale flag.​

42.​What are services in Compose?​


A: Individual containers defined in the docker-compose.yml.


Docker Registry & Docker Hub

43.​How do you push an image to Docker Hub?​


docker login ​
docker tag image username/image ​
docker push username/image

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
44.​How do you pull an image from Docker Hub?​
docker pull image_name​

45.​What is a private Docker registry?​


A: A self-hosted repository for Docker images (e.g., Harbor, Nexus).

Docker Swarm (Basic)

46.​What is Docker Swarm?​


A: Docker’s native clustering and orchestration tool.​

47.​How do you initialize a swarm?​


docker swarm init​

48.​What is a service in Docker Swarm?​


A: A scalable group of containers running the same image.​

49.​What are nodes in Docker Swarm?​


A: Hosts participating in the Swarm (manager or worker).​

50.​How do you deploy a service in Swarm?​


docker service create --name service_name image

Real-World & Scenario-Based

51.​How would you Dockerize a Java application?​


A: Use a base image like openjdk, copy JAR, and define CMD ["java", "-jar",
"app.jar"] in Dockerfile.​

52.​What’s your strategy to handle large Docker images?​


A: Use multistage builds, slim base images, and clean intermediate artifacts.​

53.​What is the best way to secure Docker containers?​


A: Run as non-root, avoid privileged mode, use trusted base images, scan
images regularly.

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
Module 10 - Container Orchestration Tool - Kubernetes

Q1. What is container orchestration and why is it important?​


Answer:​
Container orchestration automates the deployment, management, scaling, and
networking of containers. It is important because managing containers manually at
scale becomes inefficient and error-prone. Tools like Kubernetes ensure high
availability, fault tolerance, and efficient resource usage.

Tip: Relate to real-world needs, like managing microservices in production.

Difference Between Docker Swarm and Kubernetes

Q2. Compare Docker Swarm and Kubernetes. What are key differences?​
Answer:

●​ Scalability: Kubernetes is more scalable and better for complex apps.​

●​ Community Support: Kubernetes has a larger community and ecosystem.​

●​ Installation: Swarm is easier to set up but offers fewer features.​

●​ Load Balancing: Kubernetes uses kube-proxy and Services; Swarm uses


DNS round-robin.

Tip: Highlight that Kubernetes is more commonly used in production environments.



Kubernetes Architecture

Q3. Describe the architecture of Kubernetes.​


Answer: Kubernetes consists of:

●​ Master Node: API Server, Scheduler, Controller Manager, etcd.​

●​ Worker Nodes: kubelet, kube-proxy, and container runtime.​

●​ It uses etcd for storing cluster data and communication happens via the API
server.

Tip: Draw a basic architecture diagram if on a whiteboard or in a technical round.

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
Installation of Kubernetes - Minikube and EKS

Q4. How do you install Kubernetes using Minikube and AWS EKS?​
Answer:

●​ Minikube: Best for local development. Install VirtualBox, kubectl, then start
Minikube using minikube start.​

●​ EKS: Use AWS CLI or eksctl to create and manage Kubernetes clusters in
AWS.

Tip: Mention use cases – Minikube for learning, EKS for production.

Kubernetes Nodes

Q5. What is a node in Kubernetes?​


Answer: A node is a physical or virtual machine where Kubernetes runs workloads.
Each node runs kubelet and kube-proxy, and hosts Pods scheduled by the control
plane.

Tip: Differentiate clearly between master and worker nodes.

Kubernetes Pods

Q6. What is a Pod in Kubernetes?​


Answer: A Pod is the smallest deployable unit in Kubernetes. It encapsulates one
or more containers that share storage, network, and a specification for how to run
them.

Tip: Emphasize that containers in a pod share the same IP and port space.

Kubernetes Deployments

Q7. What is a Deployment in Kubernetes and why is it used?​


Answer: A Deployment manages replica sets and provides declarative updates to
Pods. It ensures the desired number of Pods are running and allows for rolling
updates and rollbacks.

Tip: Talk about YAML configuration files and version control.

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
Rolling Updates and Rollbacks

Q8. How do rolling updates and rollbacks work in Kubernetes?​


Answer: Using Deployments, Kubernetes allows rolling updates (kubectl rollout) that
update Pods incrementally. You can rollback using kubectl rollout undo.

Tip: Explain how this minimizes downtime during updates.

Scaling up and Down of the Application

Q9. How do you scale applications in Kubernetes?​


Answer: Use the kubectl scale command or modify the replicas field in the
deployment YAML. You can also use Horizontal Pod Autoscaler (HPA) for automatic
scaling.

Tip: Mention metrics like CPU usage and custom metrics for autoscaling.

Services in Kubernetes

Q10. What are Kubernetes Services and their types?​


Answer: Services expose a set of Pods as a network service. Types include:

●​ ClusterIP: Internal access only​

●​ NodePort: Exposes service on a static port on each node​

●​ LoadBalancer: Provisions external IP (cloud-based)​

●​ ExternalName: Maps service to DNS name

Tip: Emphasize decoupling between Pods and client services.

Kubernetes HostPath Volume

Q11. What is a HostPath Volume in Kubernetes?​


Answer: HostPath mounts a file or directory from the host node into a Pod. It's
mainly used for development or special cases where the container needs access to
node-local resources.

Tip: Not suitable for production due to portability issues.

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
Namespaces

Q12. What are Namespaces in Kubernetes?​


Answer: Namespaces provide a mechanism for isolating groups of resources within
a cluster. Useful for multi-tenant environments or dividing resources by project/team.

Tip: Mention kubectl get pods --namespace=<name> for managing resources in


specific namespaces.

Scenario 1: Application Downtime After Deployment

Q: Your team deployed a new version of the app and users started reporting
downtime. How would you troubleshoot this in Kubernetes?

A:

●​ Check Deployment Status: kubectl rollout status deployment <app-name>​

●​ View Pod Logs: kubectl logs <pod-name> to identify application errors​

●​ Check Events: kubectl describe pod <pod-name> for failed events​

●​ Rollback if Needed: kubectl rollout undo deployment <app-name>

Tip: Explain the rollback process and importance of health checks in readiness
probes.

Scenario 2: Rolling Update Fails Midway

Q: A rolling update was initiated but Pods are stuck in the "CrashLoopBackOff" state.
What steps do you take?

A:

●​ Logs: Analyze logs using kubectl logs to find crash reasons​

●​ Resource Limits: Check if CPU/memory limits are being hit​

●​ Configuration Issues: Validate config maps, secrets, or environment variables​

●​ Rollback: If necessary, rollback using kubectl rollout undo

Tip: Emphasize the need for staging environments and Canary deployments to
minimize impact.

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
Scenario 3: Application Needs to Be Scaled During Traffic Spike

Q: Your app is under heavy load. How do you scale it quickly?

A:

●​ Manual Scaling: kubectl scale deployment <name> --replicas=10​

●​ Autoscaling: Configure HPA (kubectl autoscale deployment <name> --min=2


--max=10 --cpu-percent=70)

Tip: Talk about how you monitor usage (Prometheus + Grafana or Metrics Server) to
tune autoscaling.

Scenario 4: Application is Not Accessible via IP

Q: A Pod is running fine but can't be accessed from outside. What do you check?

A:

●​ Check Service Configuration: Use kubectl get svc​

●​ Ensure it uses NodePort or LoadBalancer​

●​ Check Firewall/Ingress Rules (if using cloud)​

●​ Confirm correct port exposure and targetPort

Tip: Clarify Service types and where each is appropriate.

Scenario 5: Need Persistent Storage

Q: You have a Pod that writes logs. How do you persist these logs beyond Pod
lifecycle?

A:

●​ Use Persistent Volumes (PV) and Persistent Volume Claims (PVC)​

●​ For simple cases, use a hostPath volume (e.g., /var/log/app on node)

volumes:

- name: logs

hostPath:

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
path: /var/log/app

type: Directory

Tip: Explain that hostPath is not ideal for production; better to use NFS, EBS, etc.

Scenario 6: Resource Quota Between Teams

Q: Your cluster is shared by multiple teams. How do you ensure team A doesn't
affect team B?

A:

●​ Create Namespaces per team​

●​ Apply ResourceQuotas and LimitRanges​

apiVersion: v1

kind: ResourceQuota

spec:

hard:

pods: "10"

cpu: "4"

memory: "8Gi"

Tip: Stress the use of namespaces for isolation and RBAC for access control.

Scenario 7: View Running Applications in Specific Namespace

Q: How do you list all running pods and services in the dev namespace?

A:​
kubectl get pods -n dev

kubectl get svc -n dev

Tip: Also show knowledge of kubectl config set-context for switching default
namespaces.

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
Scenario 8: Setup Kubernetes Locally for Testing

Q: How would you test a Kubernetes deployment locally before pushing to


production?

A:

●​ Use Minikube or Kind (Kubernetes in Docker)​

●​ Write and apply YAML configs​

●​ Test with kubectl port-forward or NodePort services​

Tip: Demonstrate your ability to test in isolated environments before going live.

Scenario 9: Run Kubernetes Cluster on AWS

Q: How would you create and manage a Kubernetes cluster on AWS?

A:

●​ Use EKS with eksctl:​

eksctl create cluster --name demo-cluster --region us-west-2 --nodes 3

●​ Set up kubectl config with AWS credentials​

●​ Deploy applications via CI/CD or kubectl apply

Tip: Mention cloud-native considerations like IAM roles, security groups, and cost
monitoring.

Module 11 - Configuration Automation using Ansible

Overview of Configuration Automation

Q1. What is configuration automation, and why is it important in DevOps?​


A: Configuration automation automates server provisioning, software installation,
and system configuration, ensuring consistency and reducing human errors. It
supports rapid and reliable infrastructure changes.

Tip: Tie your answer to CI/CD pipelines and infrastructure as code (IaC).

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
Introduction to Ansible

Q2. What is Ansible and how does it differ from other tools like Puppet or Chef?​
A: Ansible is an open-source configuration management and automation tool that
uses SSH for communication. Unlike Puppet/Chef, it’s agentless, YAML-based, and
easier to set up.

Tip: Highlight its simplicity and agentless nature as its major strengths.

Ansible Architecture

Q3. Describe the Ansible architecture.​


A:

●​ Control Node: Machine where Ansible is installed and commands are run.​

●​ Managed Nodes: Target machines to be configured.​

●​ Inventory: List of managed nodes.​

●​ Modules: Units of work Ansible performs (e.g., copy, yum, service).

Tip: You can sketch a basic diagram to show the flow if on a whiteboard.

Components of Ansible

Q4. What are the main components of Ansible?​


A: Inventory, Modules, Plugins, Playbooks, Roles, and Variables.

Tip: Give an example of each to show practical understanding.

Installation and Configuration of Ansible

Q5. How do you install Ansible on a Linux system?​


A:sudo apt update

sudo apt install ansible

Then edit /etc/ansible/hosts to add your inventory.

Tip: Mention SSH key setup for password-less login.

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
Ansible Ad-Hoc Commands

Q6. What are ad-hoc commands in Ansible? Give an example.​


A: One-liners used for quick tasks.​
Example:

ansible all -m ping

ansible web -m yum -a "name=httpd state=present"

Tip: Useful for basic tasks like testing connectivity or restarting a service.

Ansible Playbooks

Q7. What is an Ansible Playbook and how is it structured?​


A: A Playbook is a YAML file containing a series of tasks to be executed on
managed nodes.​
Structure:

- hosts: web

tasks:

- name: Install nginx

yum:

name: nginx

state: present

Tip: Mention idempotency – re-running a playbook won’t change the system if


already compliant.

Ansible Variables

Q8. How do you use variables in Ansible?​


A: Define in playbooks, inventory, or separate vars files. Example:

vars:

app_port: 8080

Tip: Explain variable precedence (command line > playbook vars > role vars >
defaults).

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
Ansible Handlers

Q9. What are handlers in Ansible? When are they triggered?​


A: Handlers are tasks triggered only when notified. Example:

tasks:

- name: Install nginx

yum: name=nginx state=present

notify: restart nginx

handlers:

- name: restart nginx

service: name=nginx state=restarted

Tip: Used for actions like restarting services only if a change occurred.

Ansible Role using Ansible Galaxy

Q10. What are roles in Ansible and how are they used with Galaxy?​
A: Roles help organize playbooks and separate code into reusable units. Galaxy is a
repository of community-created roles.

ansible-galaxy install geerlingguy.nginx

Tip: Mention best practices like site.yml and directory structure under roles/.

Scenario 1: Configure Multiple Web Servers

Q: You need to install and start nginx on 10 servers. How would you automate it
using Ansible?

A:

●​ Use an inventory file to define your servers.​

●​ Write a playbook with yum and service modules.​

●​ Run the playbook with ansible-playbook install_nginx.yml

Tip: Mention using variables for service name if OS differs (nginx/httpd).

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
Scenario 2: Playbook Error on One Host

Q: Your playbook fails on one server but works on others. How do you debug?

A:

●​ Use -v/-vvv for verbose output​

●​ Check if inventory variables differ​

●​ Use --limit <hostname> to isolate

Tip: Highlight use of ansible-pull for agent-side troubleshooting if needed.

Scenario 3: Run a Task Only on Change

Q: How do you restart a service only if the config file changed?

A:

●​ Use a notify on the task that updates config​

●​ Define a handler to restart the service

Tip: This demonstrates efficiency and idempotent behavior.

Scenario 4: Create and Use a Role

Q: You want to structure your playbook into a reusable role. What steps do you take?

A:

1.​ Use ansible-galaxy init <role-name>​

2.​ Place tasks in tasks/main.yml​

3.​ Call the role in your playbook:

roles:

- nginx

Tip: Mention using defaults, vars, and handlers in role structure.

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
Scenario 5: Use Ad-Hoc Command for Quick Fix

Q: A web server is down. You need to restart it quickly on all hosts. What do you do?

A: ansible web -m service -a "name=nginx state=restarted"

Tip: Great way to show your understanding of quick incident response.

Module 11: Terraform Overview,

Introduction to Terraform

Q1. What is Terraform and what problem does it solve?​


A: Terraform is an open-source Infrastructure as Code (IaC) tool developed by
HashiCorp. It allows you to define and provision infrastructure using a declarative
configuration language (HCL). It solves the problem of manual infrastructure
provisioning, enabling reproducibility, versioning, and automation.

Tip: Emphasize multi-cloud support and idempotency.

Terraform vs. Ansible

Q2. How is Terraform different from Ansible?​


A:

Feature Terraform Ansible

Purpose Infrastructure Provisioning Configuration Management

Language HCL (Declarative) YAML (Imperative/Declarative)

State Tracking Yes No

Idempotency Built-in Manual via logic

Tip: Highlight that they are often used together—Terraform to provision, Ansible to
configure.

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
Terraform Architecture

Q3. Explain Terraform’s architecture.​


A:

●​ Core Components:​

○​ Configuration Files (.tf): Describe resources​

○​ Terraform CLI: Executes commands like init, apply​

○​ State File (terraform.tfstate): Tracks current resource state​

○​ Providers: Interface to cloud platforms (AWS, Azure, etc.)

Tip: Mention the plugin-based architecture and state management as key features.

Terraform Configuration

Q4. What does a basic Terraform configuration look like to create an EC2 instance?​
A:

provider "aws" {

region = "us-east-1"

resource "aws_instance" "example" {

ami = "ami-123456"

instance_type = "t2.micro"

Tip: Keep it simple, and highlight the declarative nature of HCL.

Terraform Commands

Q5. What are some essential Terraform commands and their purposes?​
A:

●​ terraform init: Initialize configuration​

●​ terraform plan: Show execution plan​

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
●​ terraform apply: Apply changes​

●​ terraform destroy: Remove infrastructure​

●​ terraform validate: Validate syntax​

●​ terraform fmt: Format code

Tip: Emphasize the plan → apply flow for safe deployments.

Managing Terraform Resources

Q6. How does Terraform manage changes to resources?​


A: Terraform uses the state file to detect drift and plan updates. When you run
terraform plan, it compares the current state with your configuration and proposes a
plan of action.

Tip: Discuss challenges like state locking and remote state storage (e.g., S3 with
DynamoDB for locks).

Terraform End-to-End Project

Q7. How would you structure a production-grade Terraform project?​


A:

●​ Use modules for reusability​

●​ Backend for remote state​

●​ Workspaces for dev/staging/prod environments​

●​ Variable files for flexibility​

●​ Integrate with CI/CD pipelines

Tip: Mention use of terraform-docs, pre-commit, and tfsec for best practices and
security.

Scenario 1: First-Time Setup

Q: How would you install and run Terraform on an AWS EC2 instance?

A:

SSH into EC2​

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
Download Terraform:​

curl -O
https://releases.hashicorp.com/terraform/<version>/terraform_<version>_linux_amd6
4.zip

unzip terraform_.zip

sudo mv terraform /usr/local/bin/

Verify with terraform version

Tip: Mention the use of terraform --version and setting execution permissions.

Scenario 2: EC2 Instance Creation

Q: You need to create an EC2 instance using Terraform. What’s your approach?

A:

●​ Define provider block and AWS credentials​

●​ Use aws_instance resource​

●​ Run:

terraform init

terraform plan

terraform apply

Tip: Explain how you’d use variables.tf and terraform.tfvars for better reusability.

Scenario 3: Secure State Management

Q: Your team works on the same infrastructure. How do you prevent state file
conflicts?

A:

●​ Use remote state backend like S3 with DynamoDB for locking:​

backend "s3" {

bucket = "tf-state-bucket"

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
key = "env/dev/terraform.tfstate"

region = "us-east-1"

dynamodb_table = "tf-state-lock"

Tip: Stress on collaboration and avoiding state corruption.

Scenario 4: Undo a Mistake

Q: You accidentally deleted a resource from AWS but not from Terraform. What do
you do?

A:

●​ Re-run terraform apply to recreate the resource​

●​ Or run terraform state rm <resource> to remove it from state if deleted


intentionally

Use terraform refresh to sync with real-world state if needed.

Scenario 5: Infrastructure Update

Q: You need to upgrade instance types for all EC2 instances. What steps do you
take?

A:

●​ Update instance_type in .tf file​

●​ Run terraform plan to preview changes​

●​ Run terraform apply to update

Tip: Always use plan before apply in interviews.

Scenario 6: Reusability

Q: How would you create reusable Terraform code for EC2 and S3 resources?

A:

●​ Use modules:

module "ec2_instance" {
The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
source = "./modules/ec2"

instance_type = "t2.micro"

ami = "ami-xxxxxx"

Tip: Mention the use of terraform get and proper variable handling in modules.

Module 12: Continuous Monitoring using Prometheus and Grafana

Overview of Continuous Monitoring

Q1. What is continuous monitoring in DevOps, and why is it important?​


A: Continuous monitoring involves the constant collection, analysis, and alerting of
metrics and logs from infrastructure, applications, and services. It helps detect
anomalies, performance bottlenecks, and potential outages in real time.

Tip: Tie this into CI/CD — “Monitoring is the feedback mechanism post-deployment.”

Continuous Monitoring Tools in DevOps

Q2. Name some popular monitoring tools used in DevOps and compare Prometheus
with others.​
A:​
Popular tools: Prometheus, Grafana, ELK Stack, Datadog, Zabbix, Nagios.

Feature Prometheus Nagios Datadog

Model Time series Plugin-based SaaS

Storage Local TSDB None Cloud

Visualization With Grafana Basic Built-in

Alerting Alertmanager Native Integrated

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
Tip: Emphasize Prometheus + Grafana as a popular open-source stack.

Installation and Configuration of Prometheus and Grafana

Q3. How do you install and configure Prometheus and Grafana on a Linux server?​
A:

1.​ Prometheus:​

○​ Download binary from prometheus.io​

○​ Extract and run: ./prometheus --config.file=prometheus.yml


2.​ Grafana:​

○​ Install via APT/YUM or download binary​

○​ Start service: systemctl start grafana-server​

○​ Access via http://localhost:3000

Tip: Talk about editing prometheus.yml to define scrape targets (e.g., Node
Exporter).

Prometheus Architecture

Q4. Describe the architecture of Prometheus.​


A:

●​ Prometheus Server: Scrapes and stores metrics.​

●​ Exporters: Agents like Node Exporter, Blackbox Exporter, etc.​

●​ TSDB: Time series database for storing metrics.​

●​ Alertmanager: Handles alerts and notifications.​

●​ Grafana: For dashboards and visualizations.

Tip: Use a diagram or describe data flow: exporter → Prometheus →


Alertmanager/Grafana.

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
Monitoring Using Prometheus

Q5. How does Prometheus collect metrics, and what are exporters?​
A:​
Prometheus pulls metrics via HTTP endpoints (usually /metrics). Exporters expose
these endpoints.​
Examples:

●​ node_exporter for system metrics​

●​ blackbox_exporter for ping/HTTP checks

Tip: Mention that Prometheus uses a pull-based model and supports PromQL for
querying.

Dashboard Visualization Using Grafana

Q6. How do you use Grafana to visualize Prometheus metrics?​


A:

●​ Add Prometheus as a data source in Grafana​

●​ Use PromQL queries in dashboard panels​

●​ Create graphs, alerts, and thresholds

Tip: Explain how teams use Grafana to create service-specific dashboards and
alerting rules.

lScenario 1: Setup from Scratch

Q: You’re asked to monitor a new Kubernetes cluster. What’s your Prometheus +


Grafana setup strategy?

A:

●​ Deploy Prometheus Operator via Helm​

●​ Use Node Exporter, Kube-state-metrics, and cAdvisor​

●​ Install Grafana and import Kubernetes dashboards​

●​ Configure alerts for CPU, memory, pod restarts

Tip: Talk about Helm charts, ConfigMaps, and persistent volumes for state.

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
Scenario 2: Custom Dashboard for CPU Usage

Q: How would you create a Grafana dashboard to monitor CPU usage?

A:

●​ Add Prometheus as a data source​

●​ Create a panel with this query:

rate(node_cpu_seconds_total{mode="user"}[5m])

●​ Apply filters by instance/label​

●​ Set alert if usage > 80% for 5 minutes

Tip: Use Grafana’s panel editor to explain your visualization choices.

Scenario 3: Missing Alerts

Q: Alerts were configured but no notifications were sent. How do you debug?

A:

●​ Check alert.rules.yml or configuration in prometheus.yml​

●​ Validate using promtool check rules​

●​ Ensure Alertmanager is running and correctly configured​

●​ Check logs and alert receiver configuration (email/Slack/Webhook)

Tip: Always mention testing alerts via curl or test integrations in Grafana.

Scenario 4: Track Service Health Over Time

Q: You need to monitor HTTP request duration over time for an app. How?

A:

●​ Instrument code with Prometheus client library​

●​ Expose metrics like http_request_duration_seconds​

●​ Use histogram and this query:

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
rate(http_request_duration_seconds_bucket[5m])

●​ Visualize latency distribution in Grafana

Tip: Talk about Prometheus metric types: counter, gauge, histogram, and summary.

Scenario 5: Monitor EC2 Instances

Q: You’re asked to monitor AWS EC2 instances. How would you do it?

A:

●​ Install node_exporter on each EC2​

●​ Add targets to prometheus.yml​

●​ Use a dynamic discovery method (e.g., file_sd_config or cloud-exporter)​

●​ Visualize with a Grafana dashboard

Tip: Mention using EC2 metadata, Terraform, or Ansible to automate setup.

Python Self-Learning Module

Overview of Python

Q1. What is Python and why is it so popular?​


A: Python is a high-level, interpreted, and general-purpose programming language
known for its simplicity and readability. It's widely used for web development,
automation, data analysis, AI/ML, and scripting.

Tip: Mention its large ecosystem (PyPI), community support, and flexibility.

Features, Benefits, Uses of Python

Q2. List some key features and common use cases of Python.​
A:

●​ Features: Interpreted, dynamically typed, high-level syntax, OOP support​

●​ Uses:​

○​ Web Development (Flask, Django)​

○​ Data Science (Pandas, NumPy)​

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
○​ Automation/Scripting​

○​ AI/ML (TensorFlow, Scikit-learn)​

○​ DevOps Tools (Ansible, SaltStack)

Installation and Setup of Python

Q3. How do you install Python and set up a virtual environment?​


A:

sudo apt install python3 python3-pip

python3 -m venv myenv

source myenv/bin/activate

Tip: Always recommend using virtual environments for dependency isolation.

Various Types of Sequences in Python

Q4. What are sequence types in Python? Explain with examples.​


A:

●​ List: my_list = [1, 2, 3]​

●​ Tuple: my_tuple = (1, 2, 3)​

●​ String: my_str = "Python"​

●​ Range: range(5)

Tip: Mention that lists are mutable, tuples are not. Strings are also sequences.

File Operations

Q5. How do you read and write files in Python?​


A:

with open("data.txt", "r") as f:

data = f.read()

with open("output.txt", "w") as f:

f.write("Hello, World!")

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
Tip: Always use with to ensure proper file closing.

Python Functions

Q6. What are Python functions? Explain types with examples.​


A:

●​ User-defined: def greet():​

●​ Built-in: len(), print(), type()​

●​ Lambda: lambda x: x2

Tip: Talk about default arguments, keyword arguments, and args/kwargs.

OOPs Concepts

Q7. What are key OOPs concepts in Python?​


A:

●​ Class and Object​

●​ Inheritance​

●​ Polymorphism​

●​ Encapsulation​

●​ Abstraction

class Animal:

def speak(self):

return "Sound"

class Dog(Animal):

def speak(self):

return "Bark"

Tip: Python supports multiple inheritance and dynamic typing.

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
Modules

Q8. What are Python modules and how do you use them?​
A: Modules are files with Python definitions and statements.

import math

print(math.sqrt(16))

Tip: Explain the difference between standard modules, third-party modules, and
custom modules.

Errors and Exception Handling

Q9. How do you handle exceptions in Python?​


A: try:

x = 10 / 0

except ZeroDivisionError:

print("Cannot divide by zero.")

finally:

print("Done")

Tip: Mention custom exceptions and else blocks.

Console vs Web Application with Flask

Q10. What’s the difference between a console app and a Flask web app in Python?​
A:

●​ Console App: Runs in terminal, user interaction via input/output.​

●​ Flask App: Runs on a web server, interacts via HTTP requests

Tip: Explain @app.route() and how Flask handles routing and templates.

Deploying and Consuming Python Applications

Q11. How do you deploy a Flask app?​


A: Use Gunicorn + NGINX for production:

gunicorn app:app

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
●​ Use Docker to containerize​

●​ Host on platforms like Heroku, AWS, or PythonAnywhere

Tip: Talk about .env for config management and using requirements.txt.

Scenario 1: Build a Console Application

Q: Build a Python app that takes user input and writes it to a file.​
A: name = input("Enter your name: ")

with open("names.txt", "a") as f:

f.write(name + "\n")

Scenario 2: Create a Flask Web Application

Q: You’re tasked with building a simple Flask form that displays user input.​
A:

from flask import Flask, request, render_template_string

app = Flask(__name__)

@app.route('/', methods=['GET', 'POST'])

def home():

if request.method == 'POST':

name = request.form['name']

return f"Hello, {name}!"

return render_template_string("""

<form method="post">

Name: <input name="name">

<input type="submit">

</form>

""")

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
Scenario 3: Handle Errors in a File-Processing Script

Q: Your app crashes when a file is missing. How do you handle it?​
A:

try:

with open("data.csv", "r") as f:

content = f.read()

except FileNotFoundError:

print("File not found.")

Scenario 4: Deploy a Flask App with Docker

Q: How would you containerize a Flask app?​


A:​
Dockerfile:

FROM python:3.9

WORKDIR /app

COPY . .

RUN pip install -r requirements.txt

CMD ["python", "app.py"]

Scenario 5: Use OOP to Create a Bank App

Q: Write a class-based structure for a basic bank account.​


A:

class BankAccount:

def __init__(self, balance=0):

self.balance = balance

def deposit(self, amount):

self.balance += amount

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.
def withdraw(self, amount):

if amount > self.balance:

raise ValueError("Insufficient funds")

self.balance -= amount

The questions provided are intended solely for practice purposes. Please note that the actual
interview questions may vary and these may or may not be asked during the interviews.

You might also like