The TCS Internship Interview is designed to assess a candidate’s technical knowledge, logical thinking, communication skills, and problem-solving ability. Freshers are commonly asked questions from programming, computer science fundamentals, aptitude, and basic HR topics. The interview focuses on evaluating both technical expertise and the ability to apply concepts to real-world scenarios. Preparing the most frequently asked TCS internship interview questions helps candidates answer confidently and improve their chances of selection. Strong communication, a positive attitude, and a clear understanding of fundamentals are equally important for success. Practicing coding problems, aptitude questions, and mock interviews further enhances interview performance. With proper preparation and confidence, freshers can perform well and secure a valuable internship opportunity at TCS.
1. The Ratio Of Boys To Girls In A Class Is 3:2. If There Are 30 Boys, How Many Girls Are There?
Ans:
The Ratio Of Boys To Girls Is 3:2. If 3 Parts Represent 30 Boys, Then 1 Part Represents 10 Students. Therefore, 2 Parts Represent Girls. The Calculation Is 10 × 2. The Result Is 20 Girls. Ratio Questions Test Numerical Ability. They Frequently Appear In Aptitude Tests.Number Of Girls = 20. The Class Has 20 Girls. This Demonstrates The Concept Of Direct Proportion.
2. The Ratio Of Two Numbers Is 5:8. If Their Sum Is 91, Find The Larger Number.
Ans:
The Total Number Of Parts Is 5 + 8 = 13. Each Part Is 91 ÷ 13 = 7. Multiply 8 By 7 To Find The Larger Number. The Calculation Is 8 × 7 = 56. Ratio Questions Improve Logical Thinking. Such Questions Are Common In Interviews. They Test Mathematical Skills.Larger Number = 56. The Other Number Is 35. The Sum Of Both Numbers Is 91. This Step-By-Step Method Helps Solve Ratio Problems Quickly And Correctly.
3. A Bag Contains 5 Red Balls And 3 Blue Balls. What Is The Probability Of Selecting A Red Ball?
Ans:
- Probability Is Calculated As Favorable Outcomes ÷ Total Outcomes. The Total Number Of Balls Is 5 + 3 = 8. Favorable Outcomes Are 5 Red Balls.
- The Calculation Is 5 ÷ 8. The Probability Is 5/8. Probability Questions Test Logical Reasoning. They Frequently Appear In Aptitude Exams.
- Probability = 5/8. There Is A Higher Chance Of Selecting A Red Ball. This Is Because Red Balls Are More Than Blue Balls.
4. A Coin Is Tossed Once. What Is The Probability Of Getting A Head?
Ans:
A Coin Has Two Possible Outcomes: Head Or Tail. Only One Outcome Is Favorable. The Total Number Of Outcomes Is Two. The Calculation Is 1 ÷ 2. The Probability Is 1/2. Such Questions Test Basic Probability Concepts. They Are Common In Interviews.Probability = 1/2. The Chances Of Getting A Head And A Tail Are Equal. Each Outcome Is Equally Likely.
5. A Can Complete A Job In 10 Days. How Much Work Does A Complete In One Day?
Ans:
Work Done In One Day Is The Reciprocal Of Total Days Required. A Completes The Job In 10 Days. Therefore, Daily Work Is 1/10. This Concept Is Widely Used In Time And Work Problems. It Helps Solve Combined Work Questions. Such Questions Are Common In Aptitude Tests.One Day’s Work = 1/10. A Completes One-Tenth Of The Work Every Day. This Helps Calculate Total Work Easily.
6. A Can Finish A Job In 10 Days And B In 15 Days. How Many Days Will They Take Together?
Ans:
A’s One Day Work Is 1/10 And B’s One Day Work Is 1/15. Their Combined Work Is 1/10 + 1/15 = 5/30 = 1/6. Therefore, They Complete The Job In 6 Days. Time And Work Questions Improve Problem-Solving Skills. They Frequently Appear In Competitive Exams.Time Required = 6 Days. Working Together Increases Efficiency. The Job Is Completed Faster Than Individually.
7. A Worker Completes A Job In 8 Days. How Much Work Does He Complete In 4 Days?
Ans:
- The Worker Completes 1/8 Of The Work Each Day. In 4 Days, He Completes 4/8 Of The Work. The Fraction Simplifies To 1/2.
- This Means Half Of The Work Is Finished. Such Questions Test Basic Time And Work Concepts. They Are Frequently Asked In Interviews.
- Work Completed = 1/2. Half Of The Total Work Is Finished In Four Days. This Demonstrates The Concept Of Uniform Work Rate.
8. The Sales Of A Shop Are ₹200, ₹250, ₹300, And ₹350 Over Four Days. What Is The Average Sales?
Ans:
Add The Daily Sales Values. Total Sales = ₹200 + ₹250 + ₹300 + ₹350 = ₹1,100. Divide By The Number Of Days, Which Is 4. The Calculation Is ₹1,100 ÷ 4 = ₹275. Data Interpretation Questions Improve Analytical Skills. They Frequently Appear In Aptitude Tests.Average Sales = ₹275. The Shop Earned An Average Of ₹275 Per Day. Average Values Help Compare Overall Performance.
9. A Company Produced 500 Units In January And 600 Units In February. What Is The Increase In Production
Ans:
Subtract January Production From February Production. The Calculation Is 600 − 500 = 100 Units. This Represents The Increase In Output. Such Questions Test Data Analysis Skills. They Are Common In Competitive Exams. Understanding Data Interpretation Improves Decision Making.Increase = 100 Units. Production Increased By 100 Units. This Indicates Positive Growth In Output.
10. A Student Obtained 360 Marks Out Of 450. What Is The Percentage?
Ans:
Use The Formula (Obtained Marks ÷ Total Marks) × 100. The Calculation Is (360 ÷ 450) × 100. The Result Is 80%. Percentage Problems Are Common In Aptitude Tests. They Help Assess Numerical Ability. Such Questions Percentage = 80%. The Student Scored 80 Percent Marks. This Represents Good Academic Performance. It Shows Strong Academic Achievement.
11. The Ratio Of Income To Expenditure Is 7:5. If Income Is ₹35,000, What Is The Expenditure?
Ans:
- The Ratio Is 7:5. One Part Is ₹35,000 ÷ 7 = ₹5,000. Multiply By 5 To Find The Expenditure. The Calculation Is ₹5,000 × 5 = ₹25,000.
- Ratio Questions Improve Calculation Skills. They Frequently Appear In Exams.Expenditure = ₹25,000. The Remaining Amount Represents Savings.
- Ratio Simplification Makes Calculations Easier. This Helps Analyze Personal And Business Budgets.
12. A Die Is Rolled Once. What Is The Probability Of Getting A Number Greater Than 4?
Ans:
Numbers Greater Than 4 Are 5 And 6. There Are 2 Favorable Outcomes. The Total Number Of Outcomes Is 6. The Calculation Is 2 ÷ 6 = 1/3. Probability Questions Improve Logical Thinking. They Are Common In Aptitude Interviews.Probability = 1/3. Only Two Outcomes Satisfy The Condition. Probability Values Always Range Between 0 And 1. This Indicates A One-In-Three Chance Of Success.
13. A Can Complete A Job In 12 Days. B Can Complete The Same Job In 6 Days. Who Is Faster?
Ans:
- A Completes 1/12 Of The Work Per Day. B Completes 1/6 Of The Work Per Day. Since 1/6 Is Greater Than 1/12, B Completes More Work Daily.
- Therefore, B Is Faster. Such Questions Test Understanding Of Work Efficiency. They Frequently Appear In Exams.B Is Faster.
- B Finishes More Work In One Day Than A. Greater Daily Work Means Higher Efficiency. This Demonstrates That A Higher Work Rate Reduces Completion Time.
14. The Number Of Employees Increased From 80 To 100. What Is The Increase?
Ans:
Subtract The Original Number From The New Number. The Calculation Is 100 − 80 = 20 Employees. This Represents The Total Increase. Such Data Interpretation Questions Test Analytical Skills. They They Help Assess Numerical Ability.Increase = 20 Employees. The Workforce Expanded By Twenty Employees. This Indicates Organizational Growth.
15. The Ratio Of Two Angles Is 2:3. If Their Sum Is 100°, Find The Larger Angle.
Ans:
The Total Ratio Is 2 + 3 = 5 Parts. One Part Is 100 ÷ 5 = 20°. Multiply 20° By 3. The Result Is 60°. Ratio Questions Improve Mathematical Thinking. They Frequently Appear In Competitive Exams. Larger Angle = 60°. The Smaller Angle Is 40°. Together They Add Up To 100°. This Method Makes Solving Ratio-Based Angle Problems Simple And Accurate. Regular Practice Helps Improve Speed And Accuracy In Aptitude Tests.
16. A Box Contains 10 Pens, Out Of Which 4 Are Blue. What Is The Probability Of Selecting A Blue Pen?
Ans:
There Are 4 Favorable Outcomes. The Total Number Of Pens Is 10. The Calculation Is 4 ÷ 10 = 2/5. Probability Questions Test Basic Numerical Skills. They Frequently Appear In Aptitude Tests. They Improve Logical Thinking.Probability = 2/5. There Is A 40% Chance Of Selecting A Blue Pen. Probability Helps Measure The Likelihood Of Events.
17. A Can Complete A Job In 20 Days. How Much Work Does A Complete In One Day?
Ans:
One Day’s Work Is The Reciprocal Of Total Days. The Calculation Is 1 ÷ 20. Therefore, The Worker Completes 1/20 Of The Job Daily. This Is A Basic Time And Work Concept. Such Questions They Improve Numerical Skills.One Day’s Work = 1/20. Daily Work Rate Helps Estimate Completion Time. It Is A Fundamental Time And Work Formula. Understanding Daily Work Rate Makes Solving Time And Work Problems Faster And More Accurate.
18. A Company’s Profit Was ₹50,000 In January And ₹65,000 In February. What Was The Increase?
Ans:
- Subtract January Profit From February Profit. The Calculation Is ₹65,000 − ₹50,000 = ₹15,000. This Represents The Increase In Profit.
- Data Interpretation Questions Help Analyze Business Performance. They Frequently Appear In Aptitude Tests. They Improve Decision-Making Skills.Increase = ₹15,000.
- The Company Earned More Profit In February. This Indicates Improved Financial Performance.
19. The Ratio Of Cats To Dogs Is 4:5. If There Are 20 Cats, How Many Dogs Are There?
Ans:
The Ratio Is 4:5. One Part Represents 20 ÷ 4 = 5 Animals. Multiply By 5 To Find The Number Of Dogs. The Calculation Is 5 × 5 = 25. Ratio Questions Improve Logical Reasoning. They Are Common In Competitive Exams.Number Of Dogs = 25. The Total Number Of Animals Is 45. This Is A Simple Direct Ratio Problem.
20. A Survey Shows That 40 Out Of 50 Students Passed An Exam. What Is The Pass Percentage?
Ans:
Use The Formula (Passed Students ÷ Total Students) × 100. The Calculation Is (40 ÷ 50) × 100. The Result Is 80%. Data Interpretation Questions Test Numerical Accuracy. They Frequently Appear In Aptitude Interviews. They Help Evaluate Analytical Thinking.Pass Percentage = 80%. Forty Students Successfully Passed The Examination. Percentage Helps Compare Overall Performance Easily.
21. If CAT Is Coded As DBU, How Is DOG Coded?
Ans:
Each Letter Is Increased By One Position In The Alphabet. D Becomes E, O Becomes P, And G Becomes H. Therefore, DOG Becomes EPH. Coding And Decoding Questions Test Pattern Recognition. They Improve Logical Thinking. Such Questions Frequently Appear In Aptitude Tests.EPH. Each Letter Is Shifted Forward By One Alphabet. This Is A Simple Letter Coding Pattern.
22. If PEN Is Coded As QFO, How Is BOOK Coded?
Ans:
Each Letter Is Shifted Forward By One Alphabet. B Becomes C, O Becomes P, O Becomes P, And K Becomes L. Therefore, BOOK Becomes CPPL. Such Questions Test Alphabetical Reasoning. They Improve Observation Skills. They CPPL. Every Letter Is Advanced By One Position. This Is A Basic Coding Technique. Understanding Letter Shifting Helps Solve Similar Coding Questions Quickly.
23. If APPLE Is Coded As BQQMF, How Is MANGO Coded?
Ans:
- Increase Each Letter By One Alphabet. M Becomes N, A Becomes B, N Becomes O, G Becomes H, And O Becomes P. Therefore, MANGO Becomes NBOHP.
- Coding Questions Improve Analytical Thinking. They Are Common In Competitive Exams. NBOHP. Each Character Is Shifted By One Letter.
- This Follows A Simple Coding Rule. Regular Practice Improves Speed And Accuracy In Coding Problems.
24. If TRAIN Is Coded As USBJO, How Is PLANE Coded?
Ans:
Move Every Letter One Position Forward. P Becomes Q, L Becomes M, A Becomes B, N Becomes O, And E Becomes F. Therefore, PLANE Becomes QMBOF. Such Questions Test Pattern Identification. They Frequently Appear In Aptitude Tests.QMBOF. Every Letter Advances By One Alphabet. This Is A Common Coding Pattern. Recognizing Alphabet Patterns Makes These Questions Easier To Solve.
25. If TABLE Is Coded As UBCMF, How Is CHAIR Coded?
Ans:
Increase Each Letter By One Position. C Becomes D, H Becomes I, A Becomes B, I Becomes J, And R Becomes S. Therefore, CHAIR Becomes DIBJS. Coding Problems Improve Logical Reasoning. They Help Assess Analytical Skills. They Are Frequently Asked In Interviews. DIBJS. The Coding Rule Adds One To Every Letter. This Creates The Required Code. Similar Coding Rules Are Commonly Used In Competitive Exams.
26. Complete The Analogy: Doctor : Hospital :: Teacher : ?
Ans:
A Doctor Works In A Hospital. Similarly, A Teacher Works In A School. Analogies Compare Relationships Between Words. They Improve Logical Reasoning Skills. Such Questions Are Common In Aptitude Tests. They Test Observation Ability.School. The Relationship Is Based On Workplace. This Is A Common Analogy Pattern. Identifying Relationships Is The Key To Solving Analogy Questions.
27. Complete The Analogy: Bird : Nest :: Bee : ?
Ans:
A Bird Lives In A Nest. A Bee Lives In A Hive. Analogies Help Identify Similar Relationships. They Improve Analytical Thinking. Such Questions Frequently Appear In Competitive Exams. They Test Logical Ability Hive. Both Words Represent The Natural Homes Of Living Creatures. This Is A Place-Based Analogy. Understanding Natural Associations Improves Reasoning Skills.
28. Complete The Analogy: Pen : Write :: Knife : ?
Ans:
A Pen Is Used To Write. A Knife Is Used To Cut. This Question Tests Object And Function Relationships. Analogies Improve Logical Thinking. They Are Common In Interviews. They Strengthen Reasoning Skills.Cut. The Relationship Is Based On Usage. This Is A Function Analogy. Function-Based Analogies Frequently Appear In Aptitude Tests. This Is A Function Analogy. Function-Based Analogies Frequently Appear In Aptitude Tests.
29. Complete The Analogy: Fish : Water :: Bird : ?
Ans:
- Fish Lives In Water. A Bird Flies In The Sky. The Relationship Is Based On Habitat Or Environment. Such Questions Improve Observation Skills.
- They Frequently Appear In Aptitude Tests. They Test Logical Understanding.Sky. The Relationship Represents The Natural Environment.
- This Is A Habitat Analogy. Recognizing Habitat Relationships Helps Solve Such Questions Easily.
30. Complete The Analogy: Finger : Hand :: Toe : ?
Ans:
A Finger Is Part Of A Hand. Similarly, A Toe Is Part Of A Foot. Analogies Test Part-To-Whole Relationships. They Improve Logical Ability. Such Questions Frequently Appear In Competitive Exams. They Develop Analytical Thinking.Foot. Both Represent Parts Of The Human Body. This Is A Part-To-Whole Analogy. Part-To-Whole Relationships Are Common In Logical Reasoning Tests.
31. Five Students Obtained Marks Of 70, 75, 80, 85, And 90. Is The Average Greater Than 79?
Ans:
Add The Marks To Obtain 400. Divide By 5 To Get The Average. The Average Is 80. Since 80 Is Greater Than 79, The Statement Is True. Data Sufficiency Questions Test Decision-Making Skills. They Frequently Appear In Aptitude Tests. Yes. The Average Is 80. Therefore, It Is Greater Than 79. Average Calculations Help Analyze Overall Performance. Using The Average Formula Makes It Easy To Evaluate And Compare Data Accurately.
32. A Number Is Divisible By 2. Is It Also Divisible By 4?
Knowing That A Number Is Divisible By 2 Alone Is Not Enough. Some Numbers Divisible By 2 Are Not Divisible By 4. Additional Information Is Required. Data Sufficiency Questions Test Logical Analysis. They Improve Decision-Making Skills. Such Questions Cannot Be Determined. More Information Is Needed. The Given Data Is Insufficient. Always Check Whether The Available Information Is Sufficient Before Concluding.
33. A Student Scored Above 80%. Can We Say The Student Passed?
Ans:
- The Student’s Percentage Alone Does Not Confirm The Passing Criteria. Different Institutions Have Different Passing Marks.
- Therefore, More Information Is Required. Data Sufficiency Questions Test Logical Judgment. They Frequently Appear In Competitive Exams.
- Cannot Be Determined. The Passing Percentage Is Not Given. The Information Is Insufficient. A Valid Conclusion Requires Complete And Relevant Information.
34. The Sum Of Two Numbers Is 50. Can The Numbers Be Determined?
Ans:
Knowing Only The Sum Is Not Enough. Many Pairs Of Numbers Can Have A Sum Of 50. Additional Conditions Are Needed. Data Sufficiency Questions Improve Logical Thinking. They Frequently Appear In Aptitude Tests. Cannot Be Determined. More Information Is Required. The Data Is Insufficient. Multiple Answers Are Possible Without Additional Conditions.
35. A Person Travels At 60 Km/Hr. Can The Total Distance Be Calculated?
Ans:
Speed Alone Is Not Enough To Find Distance. The Time Taken Must Also Be Known. Distance Is Calculated As Speed × Time. Data Sufficiency Questions Test Practical Reasoning. They Cannot Be Determined. The Time Is Not Given. The Information Is Incomplete. Both Speed And Time Are Required To Calculate Distance. They Help Evaluate Whether The Given Information Is Sufficient To Solve A Problem.
36. If CAR Is Coded As DBS, How Is BUS Coded?
Ans:
Each Letter Is Shifted Forward By One Alphabet. B Becomes C, U Becomes V, And S Becomes T. Therefore, BUS Becomes CVT. Coding Questions Improve Observation Skills. They Frequently Appear In Aptitude Exams.CVT. Every Letter Moves Forward By One Position. This Is A Standard Coding Rule. Alphabet Shift Patterns Are Common In Coding Questions. Recognizing Alphabet Shift Patterns Helps Solve Coding Questions Quickly.
37. Complete The Analogy: Sun : Day :: Moon : ?
Ans:
The Sun Is Associated With Day. The Moon Is Associated With Night. This Relationship Is Based On Natural Occurrence. Analogies Improve Logical Thinking. Such Questions Frequently Appear In Competitive Exams.Night. The Relationship Represents Time Of Day. This Is A Natural Analogy. Understanding Natural Associations Helps Solve Analogies Correctly. Identifying Real-World Relationships Makes Analogy Questions Easier To Solve.
38. If HOME Is Coded As IPNF, How Is GAME Coded?
Ans:
Increase Every Letter By One Alphabet. G Becomes H, A Becomes B, M Becomes N, And E Becomes F. Therefore, GAME Becomes HBNF. Coding Questions Test Pattern Recognition. They Improve Logical Ability. They HBNF. The Coding Uses A Uniform Alphabet Shift. This Is A Simple Coding Pattern. Consistent Coding Rules Make Pattern Recognition Easier.
39. Complete The Analogy: Book : Read :: Food : ?
Ans:
A Book Is Read. Food Is Eaten. The Relationship Is Based On Purpose Or Action. Analogies Test Logical Understanding. They Frequently Appear In Aptitude Tests. They Improve Analytical Skills. Eat. The Relationship Is Based On Usage. This Is An Action Analogy. Action-Based Analogies Are Frequently Asked In Competitive Exams.Practicing Analogies Regularly Improves Logical Reasoning And Problem-Solving Speed.
40. A Box Contains 12 Balls. Is The Probability Of Selecting A Red Ball Equal To 1/2?
Ans:
- The Total Number Of Balls Is Known. However, The Number Of Red Balls Is Not Given. Therefore, The Probability Cannot Be Calculated.
- Data Sufficiency Questions Improve Analytical Thinking. They Frequently Appear In Competitive Exams.Cannot Be Determined.
- The Number Of Red Balls Is Missing. The Information Is Insufficient. Probability Requires Complete Information About Favorable Outcomes.
41. If MILK Is Coded As NJML, How Is WATER Coded?
Ans:
Increase Every Letter By One Alphabet. W Becomes X, A Becomes B, T Becomes U, E Becomes F, And R Becomes S. Therefore, WATER Becomes XBUFS. Coding Questions Improve Observation Skills. They Frequently Appear In Aptitude Tests.XBUFS. Every Letter Advances By One Position. This Is A Basic Coding Method. Understanding Alphabet Sequences Improves Coding Accuracy.
42. Complete The Analogy: Wheel : Car :: Wing : ?
Ans:
A Wheel Is Part Of A Car. A Wing Is Part Of An Airplane. The Relationship Is Based On Parts Of An Object. Analogies Improve Logical Thinking. They Airplane. Both Words Represent Essential Parts Of Vehicles. This Is A Part-To-Whole Analogy. Identifying Object Relationships Helps Solve Analogies Faster. They Frequently Appear In Competitive And Aptitude Exams.
43. A Rectangle Has A Length Of 10 Cm. Can Its Area Be Calculated?
Ans:
Knowing Only The Length Is Not Enough. The Breadth Is Also Required. Area = Length × Breadth. Data Sufficiency Questions Test Analytical Skills. They Frequently Appear In Aptitude Tests.Cannot Be Determined. The Breadth Is Missing. The Information Is Insufficient. Both Length And Breadth Are Necessary To Calculate Area. Complete Information Is Essential To Arrive At The Correct Answer
44. If STAR Is Coded As TUBS, How Is MOON Coded?
Ans:
- Increase Every Letter By One Alphabet. M Becomes N, O Becomes P, O Becomes P, And N Becomes O. Therefore, MOON Becomes NPPO.
- Coding Questions Improve Pattern Recognition. They Frequently Appear In Competitive Exams.NPPO.
- The Coding Follows A One-Letter Forward Shift. This Is A Standard Coding Pattern. Similar Alphabet Shift Questions Are Common In Logical Reasoning.
45. Complete The Analogy: Heart : Blood :: Lungs : ?
Ans:
The Heart Pumps Blood. The Lungs Help In Breathing Air. This Relationship Is Based On Organ And Function. Analogies Improve Logical Reasoning. They They Test Functional Relationships.Air. The Lungs Are Responsible For Breathing Air. This Is A Function-Based Analogy. Understanding Organ Functions Helps Solve Such Analogy Questions Correctly.
46. What Is A Transaction In SQL?
A Transaction Is A Sequence Of One Or More SQL Statements Executed As A Single Unit Of Work. It Ensures That All Operations Are Completed Successfully Or None Are Applied. Transactions Help Maintain Data Consistency And Integrity. They Are Controlled Using Commands Such As BEGIN, COMMIT, And ROLLBACK. Transactions Are Widely Used In Banking And Financial Applications. Understanding Transactions Is Important For Database Reliability. They Are Frequently Asked In SQL Interviews.
47. What Is COMMIT In SQL?
Ans:
The COMMIT Command Permanently Saves All Changes Made During The Current Transaction. Once A Transaction Is Committed, The Changes Cannot Be Reversed Using ROLLBACK. COMMIT Ensures That Data Is Stored Permanently In The Database. It Is Used After Successful Insert, Update, Or Delete Operations. This Command Helps Maintain Database Consistency. COMMIT Is An Important Part Of Transaction Control Language. It Frequently Appears In SQL Interviews..
48. What Is ROLLBACK In SQL?
Ans:
The ROLLBACK Command Undoes All Changes Made During The Current Transaction Before They Are Committed. It Restores The Database To Its Previous State. ROLLBACK Is Useful When An Error Occurs During Data Modification. It Helps Prevent Incorrect Data From Being Saved. This Command Improves Database Reliability. It Is Part Of Transaction Control Language. Understanding ROLLBACK Is Essential For SQL Professionals.
49. What Is SAVEPOINT In SQL?
Ans:
- A SAVEPOINT Creates A Temporary Checkpoint Within A Transaction. It Allows Partial Rollback Without Canceling The Entire Transaction.
- SAVEPOINT Is Useful For Complex Database Operations. Developers Use It To Recover From Specific Errors.
- It Improves Flexibility During Transaction Management. SAVEPOINT Is Part Of Transaction Control Language. It Is Frequently Used In Large Applications
50. What Is A Cursor In SQL?
Ans:
A Cursor Is A Database Object Used To Process Query Results One Row At A Time. It Is Helpful When Row-By-Row Processing Is Required. Cursors Are Commonly Used In Stored Procedures And Database Programming. They Allow Developers To Retrieve And Manipulate Individual Records. Although Powerful, Cursors Can Reduce Performance If Overused. Set-Based Queries Are Usually Faster. Cursors Are Frequently Asked In SQL Interviews.
51. What Is A Stored Procedure?
Ans:
A Stored Procedure Is A Precompiled Collection Of SQL Statements Stored In The Database. It Can Be Executed Multiple Times Without Rewriting The Code. Stored Procedures Improve Performance And Reduce Network Traffic. They Enhance Code Reusability And Security. Businesses Use Them For Complex Database Operations. They Simplify Application Development. They Are Common Interview Topics.
52. What Is A Function In SQL?
Ans:
A Function Is A Database Object That Accepts Input Parameters And Returns A Single Value Or Table. Functions Help Perform Reusable Calculations And Data Processing. They Simplify SQL Queries And Improve Readability. SQL Provides Built-In And User-Defined Functions. Functions Are Commonly Used In Reports And Applications. They Improve Database Efficiency. Understanding Functions Is Essential For SQL Development.
53. What Is A Trigger In SQL?
Ans:
A Trigger Is A Special Stored Program That Executes Automatically When An Insert, Update, Or Delete Event Occurs. Triggers Help Enforce Business Rules And Maintain Data Integrity. They Reduce Manual Database Monitoring. Triggers Are Widely Used For Auditing And Logging. They Improve Automation Within Databases. Proper Trigger Design Prevents Performance Issues. They Frequently Appear In SQL Interviews.
54. What Is A View In SQL?
Ans:
A View Is A Virtual Table Created From The Result Of A SQL Query. It Does Not Store Data Physically But Displays Data From One Or More Tables. Views Simplify Complex Queries. They Improve Data Security By Restricting Access To Certain Columns. Views Help Present Customized Data To Users. They Enhance Database Organization. They Are Commonly Used In SQL Applications.
55. What Is An Index In SQL?
Ans:
- An Index Is A Database Object That Improves The Speed Of Data Retrieval. It Works Like An Index In A Book By Helping Locate Records Quickly.
- Indexes Reduce Query Execution Time. However, They May Slightly Slow Insert And Update Operations. Proper Indexing Improves Database Performance.
- Indexes Are Essential For Large Databases. They Are Frequently Asked In SQL Interviews.An Index Speeds Up Data Searching And Query Performance.
56. What Is Normalization?
Ans:
Normalization Is The Process Of Organizing Data To Reduce Redundancy And Improve Data Integrity. It Divides Large Tables Into Smaller Related Tables. Normalization Prevents Duplicate Data Storage. It Simplifies Database Maintenance. Different Normal Forms Define Levels Of Organization. Proper Normalization Improves Database Efficiency. It Is A Fundamental Database Concept.Normalization Organizes Data Efficiently And Minimizes Redundancy.
57. What Is Denormalization?
Ans:
Denormalization Combines Tables To Improve Query Performance. It Reduces The Number Of Table Joins Required During Data Retrieval. This Technique Is Commonly Used In Data Warehouses. Denormalization Increases Data Redundancy But Improves Read Speed. It Is Useful For Reporting Applications. Developers Use It Carefully To Balance Performance And Storage. It Is An Advanced SQL Concept.Denormalization Improves Query Speed By Combining Related Tables.
58. What Is A Primary Key?
Ans:
A Primary Key Is A Column That Uniquely Identifies Each Record In A Table. It Does Not Allow Duplicate Or NULL Values. Every Table Should Have Only One Primary Key. Primary Keys Maintain Data Integrity. They Help Create Relationships Between Tables. SQL Uses Primary Keys For Fast Record Identification. They Are Fundamental In Relational Databases.A Primary Key Uniquely Identifies Every Row In A Table.
59. What Is A Foreign Key?
Ans:
A Foreign Key Is A Column That Creates A Relationship Between Two Tables. It References The Primary Key Of Another Table. Foreign Keys Maintain Referential Integrity. They Prevent Invalid Data Entries. Foreign Keys Help Build Relational Databases. They Improve Data Consistency. They Frequently Appear In SQL Interviews.A Foreign Key Links Related Tables Together.
60. What Is Referential Integrity?
Ans:
Referential Integrity Ensures That Relationships Between Tables Remain Valid. It Prevents Invalid Foreign Key Values. This Feature Protects Database Consistency. SQL Enforces Referential Integrity Through Foreign Keys. It Helps Avoid Orphan Records. Businesses Use It To Maintain Accurate Data. It Is A Core Database Principle.Referential Integrity Maintains Valid Relationships Between Database Tables.
61. What Is The Difference Between DELETE And TRUNCATE?
Ans:
- DELETE Removes Selected Rows And Can Be Rolled Back Before Commit. TRUNCATE Removes All Rows Quickly And Usually Cannot Be Rolled Back After Commit.
- DELETE Supports A WHERE Clause. TRUNCATE Does Not Support Conditions. TRUNCATE Is Faster Than DELETE. Both Commands Remove Data From Tables.
- Understanding Their Differences Is Important.DELETE Removes Selected Rows, While TRUNCATE Removes All Rows Quickly.
62. What Is The Difference Between DROP And TRUNCATE?
Ans:
DROP Completely Removes A Table Along With Its Structure And Data. TRUNCATE Removes Only The Data While Keeping The Table Structure. DROP Deletes Database Objects Permanently. TRUNCATE Keeps The Table Ready For Reuse. Both Commands Are DDL Operations. Choosing The Correct Command Prevents Data Loss. They Are Frequently Asked In Interviews.DROP Removes The Table, While TRUNCATE Removes Only Its Data.
63. What Is A Self Join?
Ans:
A Self Join Joins A Table With Itself. It Is Useful When Records Within The Same Table Are Related. Self Joins Require Table Aliases To Differentiate The Two References. They Are Commonly Used In Employee And Manager Relationships. Self Joins Improve Query Flexibility. They Help Analyze Hierarchical Data. They Frequently Appear In SQL Interviews.A Self Join Connects A Table To Itself.
64. What Is A Cross Join?
Ans:
A Cross Join Produces The Cartesian Product Of Two Tables. Every Row From The First Table Is Combined With Every Row From The Second Table. Cross Joins Can Generate Large Result Sets. They Are Useful In Specific Business Scenarios. Developers Should Use Them Carefully. They Help Create All Possible Combinations. Understanding Cross Joins Is Important.A Cross Join Returns Every Possible Combination Of Rows..
65. What Is A Full Outer Join?
Ans:
A Full Outer Join Returns All Matching And Non-Matching Rows From Both Tables. Missing Values Are Displayed As NULL. It Combines The Results Of Left And Right Joins. Full Outer Joins Help Compare Data Between Tables. They Are Useful In Reporting Applications. They Improve Data Analysis. They Are Common SQL Interview Questions.A Full Outer Join Returns All Rows From Both Tables.
66. What Is A Scalar Function?
Ans:
A Scalar Function Returns A Single Value For Each Input. SQL Includes Functions Such As UPPER(), LOWER(), And LENGTH(). Scalar Functions Simplify Data Processing. They Improve Query Readability. Developers Use Them Frequently In Reports. They Help Manipulate Text And Numbers. They Are Important SQL Concepts. A Scalar Function Returns One Value For Each Input.
67. What Is An Aggregate Function?
Ans:
Aggregate Functions Perform Calculations On Multiple Rows And Return A Single Result. Examples Include SUM(), AVG(), COUNT(), MAX(), And MIN(). They Help Summarize Data Efficiently. Aggregate Functions Are Widely Used In Reports. They Improve Business Analysis. They Frequently Appear In SQL Queries. Understanding Them Is Essential.Aggregate Functions Calculate A Single Result From Multiple Rows.
68. What Is The HAVING Clause?
Ans:
The HAVING Clause Filters Groups Created By The GROUP BY Clause. It Is Used With Aggregate Functions. HAVING Is Different From WHERE Because It Works After Grouping. It Helps Filter Summarized Data. Businesses Use HAVING In Reports And Analysis. It Improves Query Accuracy. It Is A Common SQL Interview Topic.HAVING Filters Grouped Records After Aggregation.
69. What Is SQL Injection?
Ans:
- SQL Injection Is A Cybersecurity Attack That Inserts Malicious SQL Code Into Queries. It Can Access, Modify, Or Delete Sensitive Data.
- Developers Prevent SQL Injection Using Parameterized Queries And Input Validation. It Is One Of The Most Common Database Security Threats.
- Understanding SQL Injection Improves Application Security. It Is Frequently Asked In Technical Interviews. Database Security Is Essential For Modern Applications.
70. Why Is SQL Important?
Ans:
SQL Is The Standard Language For Managing Relational Databases. It Allows Users To Store, Retrieve, Update, And Delete Data Efficiently. SQL Is Used In Banking, Healthcare, E-Commerce, And Software Development. It Supports Data Analysis And Business Intelligence. Learning SQL Improves Career Opportunities In IT. Almost Every Modern Application Uses Databases. SQL Is One Of The Most Important Technical Skills For Freshers.
71. What Is A Loop In C?
Ans:
A Loop Is A Control Structure That Repeats A Block Of Code Multiple Times. It Reduces The Need To Write The Same Statements Repeatedly. C Supports for, while, And do-while Loops. Loops Improve Program Efficiency And Readability. They Are Commonly Used For Repetitive Calculations And Data Processing. Understanding Loops Is Essential For Programming. They Are Frequently Asked In Technical Interviews.
72. What Is A For Loop?
Ans:
A for Loop Is Used When The Number Of Iterations Is Known In Advance. It Contains Initialization, Condition, And Increment Or Decrement Expressions. The Loop Continues Until The Condition Becomes False. It Is Widely Used In Array Processing And Counting Operations. The for Loop Produces Compact And Readable Code. It Is One Of The Most Common Looping Structures In C. It Frequently Appears In Coding Interviews.
73. What Is A While Loop?
Ans:
- A while Loop Executes A Block Of Code As Long As The Given Condition Is True. The Condition Is Checked Before Each Iteration.
- It Is Useful When The Number Of Iterations Is Unknown. If The Condition Is False Initially, The Loop Will Not Execute.
- It Is Commonly Used For Input Validation And Menu-Driven Programs. Understanding The while Loop Is Important For Programming. It Is A Frequently Asked Interview Topic.
74. What Is A Do-While Loop?
Ans:
A do-while Loop Executes The Code At Least Once Before Checking The Condition. The Condition Is Evaluated After The First Iteration. This Makes It Different From The while Loop. It Is Useful When The Program Must Execute At Least One Time. Menu-Driven Applications Often Use do-while Loops. It Improves Program Flexibility. It Is Common In C Programming.
75. What Is A Function In C?
Ans:
A Function Is A Named Block Of Code That Performs A Specific Task. Functions Help Divide Large Programs Into Smaller Modules. They Improve Code Reusability And Readability. Functions Can Accept Parameters And Return Values. They Simplify Program Maintenance And Testing. Every C Program Starts Execution From The main() Function. Functions Are A Fundamental Programming Concept.
76. Why Are Functions Important?
Ans:
Functions Reduce Code Duplication By Allowing Reuse Of The Same Logic. They Improve Program Organization And Readability. Developers Can Debug Functions Independently. Functions Make Programs Easier To Maintain And Update. Large Applications Depend On Functions For Modular Design. They Improve Programming Efficiency. They Are Frequently Asked In Technical Interviews.
77. What Are Function Arguments?
Ans:
Function Arguments Are Values Passed To A Function During A Function Call. They Allow Functions To Process Different Inputs. Arguments Are Received By Parameters Inside The Function. Functions Can Accept Zero Or More Arguments. Proper Use Of Arguments Makes Programs Flexible. They Improve Code Reusability. Understanding Arguments Is Essential In Programming.
78. What Is An Array In C?
Ans:
An Array Is A Collection Of Elements Of The Same Data Type Stored In Contiguous Memory Locations. Arrays Allow Multiple Values To Be Stored Using A Single Variable Name. Each Element Is Accessed Using An Index. Arrays Improve Data Management In Programs. They Are Widely Used In Searching And Sorting Algorithms. Understanding Arrays Is Essential For Programming. They Frequently Appear In Coding Interviews.
79. What Are The Advantages Of Arrays?
Ans:
Arrays Simplify The Storage And Management Of Multiple Values. They Reduce The Need For Multiple Variables. Arrays Provide Fast Access To Elements Using Index Numbers. They Improve Program Efficiency. Arrays Are Widely Used In Data Structures And Algorithms. They Support Easy Traversal Using Loops. They Are Essential In Programming.
80. What Is Array Indexing?
Ans:
Array Indexing Refers To Accessing Individual Elements Using Their Position. In C, Array Indexing Starts From Zero. The First Element Is At Index 0, The Second At Index 1, And So On. Correct Indexing Prevents Errors During Execution. It Simplifies Data Retrieval And Modification. Understanding Indexing Is Important For Array Operations. It Is A Common Interview Topic..
81. What Is A String In C?
Ans:
A String Is A Sequence Of Characters Stored In A Character Array. Every String Ends With A Null Character ( ). Strings Are Used To Store Names, Messages, And Text Data. C Provides Library Functions To Manipulate Strings. String Handling Is A Common Programming Task. Understanding Strings Is Essential For Software Development. They Frequently Appear In Technical Interviews.
82. What Are String Functions In C?
Ans:
- String Functions Perform Operations Such As Copying, Comparing, Concatenating, And Finding String Length. Common Functions Include strlen(), strcpy(), strcmp(), And strcat().
- These Functions Are Available In The <string.h> Library. They Simplify String Manipulation. Developers Use Them Frequently In Applications.
- They Improve Programming Efficiency. They Are Common Interview Questions.
83. What Is strlen() In C?
Ans:
The strlen() Function Returns The Length Of A String. It Counts The Number Of Characters Before The Null Character. This Function Is Defined In <string.h>. It Helps Validate Input And Process Text Efficiently. Developers Frequently Use It In String Operations. It Improves Program Accuracy. It Is Commonly Asked In Interviews. It Does Not Count The Null (' ') Character In The String Length.
84. What Is strcpy() In C?
Ans:
The strcpy() Function Copies One String Into Another. It Copies All Characters Including The Null Character. The Destination Array Must Have Enough Space. It Is Defined In The <string.h> Library. This Function Simplifies String Copying Operations. Developers Use It Frequently In Applications. It Is An Important String Function. Proper Memory Allocation Prevents Buffer Overflow While Using strcpy()
85. What Is A Pointer In C?
Ans:
A Pointer Is A Variable That Stores The Memory Address Of Another Variable. Pointers Enable Efficient Memory Management. They Are Used In Dynamic Memory Allocation And Function Calls. Pointers Improve Program Performance In Many Applications. Understanding Pointers Is Essential For Advanced C Programming. They Are Frequently Asked In Interviews. They Form The Foundation Of Many Data Structures.
86. Why Are Pointers Important?
Ans:
Pointers Allow Direct Access To Memory Locations. They Improve Program Efficiency And Support Dynamic Memory Allocation. Pointers Are Used In Arrays, Functions, And Data Structures. They Help Reduce Memory Usage. Advanced Programming Relies Heavily On Pointers. Understanding Them Improves Coding Skills. They Are Essential In System Programming.
87. What Is The Address Operator (&) In C?
Ans:
- The Address Operator (&) Returns The Memory Address Of A Variable. It Is Used To Assign Addresses To Pointer Variables.
- This Operator Plays An Important Role In Pointer Programming. It Helps Access Variable Locations In Memory. Developers
- Frequently Use It With Functions And Arrays. Understanding The Address Operator Is Essential. It Is A Common Interview Topic.
88. What Is The Dereference Operator (*) In C?
Ans:
The Dereference Operator (*) Accesses The Value Stored At A Memory Address. It Is Used With Pointer Variables. This Operator Retrieves Or Modifies The Data Stored At The Referenced Location. It Is Essential For Pointer Operations. Understanding Dereferencing Helps Prevent Programming Errors. It Is Frequently Used In C Programs. It Is A Key Pointer Concept.
89. What Is A NULL Pointer?
Ans:
A NULL Pointer Is A Pointer That Does Not Point To Any Valid Memory Location. It Is Assigned The Value NULL. Using NULL Pointers Helps Prevent Accidental Memory Access. Developers Use Them To Indicate Empty Or Uninitialized References. They Improve Program Safety. Understanding NULL Pointers Is Important In C Programming. They Frequently Appear In Technical Interviews.
90. Why Should Freshers Learn Loops, Functions, Arrays, Strings, And Pointers?
Ans:
These Concepts Form The Foundation Of C Programming. They Help Build Efficient And Well-Structured Programs. Most Technical Interviews Include Questions On These Topics. They Improve Problem-Solving And Coding Skills. Mastering These Concepts Makes Learning Advanced Data Structures Easier. They Are Essential For Software Development Careers. Strong Knowledge Of These Fundamentals Increases Confidence During Coding Interviews.
91. Find Factorial
Ans:
- #include
- int main(){
- int n=5,f=1,i;
- for(i=1;i<=n;i++) f=f*i;
- printf(“Factorial = %d”,f);
- return 0;
- }
92. Fibonacci Series
Ans:
- #include
- int main(){
- int a=0,b=1,c,i;
- printf(“%d %d “,a,b);
- for(i=1;i<=8;i++){
- c=a+b;
- printf(“%d “,c);
- a=b;
- b=c;
- }
- return 0;
- }
93. Prime Number Check
Ans:
- #include
- int main(){
- int n=13,i,prime=1;
- for(i=2;i
- if(n%i==0){
- prime=0;
- break;
- }
- }
- if(prime)
- printf(“Prime Number”);
- else
- printf(“Not Prime Number”);
- return 0;
- }
94. Armstrong Number
Ans:
- #include
- int main(){
- int n=153,temp=n,r,sum=0;
- while(temp>0){
- r=temp%10;
- sum=sum+r*r*r;
- temp=temp/10;
- }
- if(sum==n)
- printf(“Armstrong Number”);
- else
- printf(“Not Armstrong Number”);
- return 0;
- }
95. Sum Of Digits
Ans:
- #include
- int main(){
- int n=1234,sum=0;
- while(n>0){
- sum=sum+n%10;
- n=n/10;
- }
- printf(“Sum = %d”,sum);
- return 0;
- }
96. Array Rotation (Left Rotation By One)
Ans:
- #include
- int main(){
- int a[5]={1,2,3,4,5},i,temp;
- temp=a[0];
- for(i=0;i<4;i++)
- a[i]=a[i+1];
- a[4]=temp;
- for(i=0;i<5;i++)
- printf(“%d “,a[i]);
- return 0;
- }
97. Remove Duplicates From Array
Ans:
- #include
- int main(){
- int a[]={1,2,2,3,3},i;
- printf(“%d “,a[0]);
- for(i=1;i<5;i++){
- if(a[i]!=a[i-1])
- printf(“%d “,a[i]);
- }
- return 0;
- }
98. Find Largest And Smallest Element
Ans:
- #include
- int main(){
- int a[5]={5,2,9,1,7},i,max,min;
- max=min=a[0];
- for(i=1;i<5;i++){
- if(a[i]>max)
- max=a[i];
- if(a[i]
- min=a[i];
- }
- printf(“Largest = %dn”,max);
- printf(“Smallest = %d”,min);
- return 0;
- }
99. Pattern Printing
Ans:
- #include
- int main(){
- int i,j;
- for(i=1;i<=5;i++){
- for(j=1;j<=i;j++)
- printf(“* “);
- printf(“n”);
- }
- return 0;
- }
100. Matrix Addition
Ans:
- #include
- int main(){
- int a[2][2]={{1,2},{3,4}};
- int b[2][2]={{5,6},{7,8}};
- int c[2][2],i,j;
- for(i=0;i<2;i++){
- for(j=0;j<2;j++){
- c[i][j]=a[i][j]+b[i][j];
- printf(“%d “,c[i][j]);
- }
- printf(“n”);
- }
- return 0;
- }
LMS
