All Subjects
Barani Institute of Information Technology14 سوالات

Programming and Logic MCQs

Practice Programming and Logic multiple-choice questions for Barani Institute of Information Technology competitive exams. Each question includes the correct answer and a short explanation, and past-paper questions are marked so you can revise both repeated and fresh material in one place.

func
define
def
function
وضاحتIn Python, the 'def' keyword is the standard way to declare a function.
14
11
7
9
وضاحتAccording to operator precedence, multiplication is performed before addition. So, 4 * 2 = 8, and 3 + 8 = 11.
To speed up the function execution
To terminate the recursive calls and prevent an infinite loop
To allocate memory for variables
To call the function itself
وضاحتA base case provides the condition under which recursion stops, preventing infinite recursion.
Procedural
Functional
Object-Oriented
Declarative
وضاحتObject-Oriented Programming (OOP) is centered around objects which bundle data fields and methods together.
break
continue
pass
exit
وضاحتThe 'continue' statement terminates the current iteration of the loop and proceeds to the next iteration.
True
False
None
Error
وضاحت(False) OR (True) evaluates to True.
Executes code line by line
Converts source code into machine code in one go
Manages the database connections
Debugs the code automatically
وضاحتA compiler translates the entire source code into a standalone executable machine code file.
Tuple
String
Integer
List
وضاحتLists can be changed (mutated) after they are created, whereas tuples and strings are immutable.
To test the speed of the code
To handle exceptions or runtime errors
To force a loop to run forever
To define a variable scope
وضاحتTry-except blocks allow a program to catch errors and execute fallback code rather than crashing.
A process where a function calls itself
A type of loop that runs infinitely
A method to optimize memory
A way to sort arrays
وضاحتRecursion is a programming technique where a function calls itself to solve smaller instances of the same problem.
1110
1000
0110
1111
وضاحت1010 AND 1100 compares each bit; only where both are 1 does the result yield 1, resulting in 1000.
O(n)
O(n log n)
O(n^2)
O(log n)
وضاحتQuicksort performs in O(n log n) time in its best and average cases due to the divide-and-conquer splitting.
Polymorphism
Inheritance
Abstraction
Encapsulation
وضاحتInheritance is the mechanism where a new class derives properties and behaviors from an existing base class.
The loop executes once
The loop throws an error
The loop body never executes
The program terminates
وضاحتA 'while' loop checks the condition before executing the body; if it is false, it skips the code block entirely.

Frequently Asked Questions

Are these Programming and Logic MCQs free?

Yes. Every Programming and Logic MCQ on this page is free to practice, including the correct answer and explanation.

Do these include past-paper questions?

Yes — questions sourced from past papers are clearly marked with a "Past Paper" badge, alongside fresh practice questions.

Which exams do these Programming and Logic MCQs help with?

They are aimed at Barani Institute of Information Technology and related Pakistani competitive exams that test Programming and Logic.

How should I practice subject-wise MCQs?

Attempt each question first, then reveal the answer and read the explanation. Short, focused sessions on one subject work better than long unstructured reading.

ہم کوکیز استعمال کرتے ہیں

ہم پلیٹ فارم کو چلانے کے لیے ضروری کوکیز اور استعمال سمجھنے کے لیے analytics کوکیز استعمال کرتے ہیں۔ آپ analytics اور advertising کوکیز قبول یا رد کر سکتے ہیں۔