Computer Programming Solved MCQs

Which of the following is a programming language?
A. Java
B. Mouse
C. Keyboard
D. Monitor

What is the output of the following code snippet?

python
Copy code
print("Hello, world!”)
A. Hello, earth!
B. Hello, world!
C. Hello, space!
D. Hello, universe!

Which data structure follows the Last-In-First-Out (LIFO) principle?
A. Queue
B. Stack
C. Heap
D. Tree

What does the acronym "HTML” stand for?
A. Hyperlink Markup Language
B. Hypertext Markup Language
C. High-Level Markup Language
D. Hypermedia Markup Language

Which of the following is not a programming paradigm?
A. Object-Oriented Programming (OOP)
B. Functional Programming (FP)
C. Declarative Programming (DP)
D. Typing Programming (TP)

Which sorting algorithm has a worst-case time complexity of O(n^2)?
A. Merge Sort
B. Quick Sort
C. Heap Sort
D. Bubble Sort

In Python, which keyword is used to define a function?
A. define
B. function
C. def
D. void

What is the result of the expression 5 + 3 * 2?
A. 11
B. 16
C. 13
D. 21

Which of the following is an example of a high-level programming language?
A. Assembly language
B. Machine language
C. C programming language
D. Binary language

Which of the following is not a Python built-in function?
A. len()
B. print()
C. input()
D. scan()

Difficulty Level: Hard

What is the time complexity of the binary search algorithm?
A. O(n)
B. O(log n)
C. O(n^2)
D. O(1)

Which of the following is an example of a logical operator?
A. +
B. *
C. &&
D. /

What is the output of the following code snippet?

java
Copy code
int x = 5;
System.out.println(x++);
A. 6
B. 5
C. 4
D. 0

Which of the following is a database management system?
A. Microsoft Word
B. Adobe Photoshop
C. MySQL
D. Google Chrome

What does the acronym "API” stand for?
A. Application Programming Interface
B. Advanced Programming Interface
C. Application Protocol Interface
D. Advanced Protocol Interface

Difficulty Level: Easy
Which of the following is not a primitive data type in Java?
A. int
B. float
C. string
D. boolean

What is the output of the following code snippet?

python
Copy code
x = 10
y = 5
print(x % y)
A. 2
B. 0
C. 1
D. 5

Which of the following is an example of a conditional statement?
A. for loop
B. while loop
C. if statement
D. switch statement

What is the purpose of the "break” statement in a loop?
A. It terminates the loop.
B. It skips the current iteration and continues to the next one.
C. It restarts the loop from the beginning.
D. It checks the condition and exits the loop if it evaluates to true.

Which of the following is not a primary key constraint in a database?
A. UNIQUE
B. FOREIGN KEY
C. NOT NULL
D. PRIMARY KEY

Correct Answers:

A
B
B
B
D
D
C
C
C
D
B
C
B
C
A
C
B
C
A
B