Practice Programming Basics MCQs with answers. Variables, loops, functions, OOP & more — fully solved for 2026 competitive exams. These MCQs are perfect for NTS, PPSC, FPSC, CSS, OTS, UPSC, GATE, UGC NET, bank exams, university exams, and job interviews. The bold green option ✅ is the correct answer.
Basic Concepts
1. A variable in programming is:
a) A fixed value b) A named storage location that holds a value ✅ c) A type of loop d) A function name
2. An algorithm is:
a) A programming language b) A step-by-step procedure to solve a problem ✅ c) A type of variable d) A software application
3. A flowchart is:
a) A programming language b) A chart in Excel c) A graphical representation of an algorithm ✅ d) A debugging tool
4. Which symbol represents a decision in a flowchart?
a) Rectangle b) Oval c) Parallelogram d) Diamond ✅
Control Structures
5. A for loop is used when:
a) You dont know iterations b) You know exactly how many times to repeat ✅ c) You never repeat d) Only once
6. A while loop continues as long as:
a) Counter reaches 10 b) The condition is true ✅ c) Program starts d) Function is called
7. An if-else statement is used for:
a) Looping b) Making decisions based on conditions ✅ c) Declaring variables d) Defining functions
8. An infinite loop occurs when:
a) Loop runs 100 times b) The loop condition never becomes false ✅ c) Loop has no body d) Program crashes
⚡ Functions & Arrays
9. A function in programming is:
a) A variable b) A reusable block of code for a specific task ✅ c) A loop d) A data type
10. An array is:
a) A single variable b) A collection of same-type elements in contiguous memory ✅ c) A function d) A loop
11. The index of the first element in most arrays is:
a) 1 b) 0 ✅ c) -1 d) 10
️ OOP Concepts
12. OOP stands for:
a) Online Operating Program b) Object-Oriented Programming ✅ c) Open Office Protocol d) Output Operation Process
13. A class in OOP is:
a) An object b) A blueprint for creating objects ✅ c) A variable d) A function
14. Inheritance in OOP means:
a) Copying code b) Child class acquiring properties from parent class ✅ c) Deleting objects d) Creating loops
Practice More MCQs
️ Operating System MCQs
Computer Hardware MCQs
Python MCQs
️ SQL MCQs
☕ Java MCQs

Leave a Comment