Important Computer Programming MCQ,s

Here are 20 multiple-choice questions (MCQs) related to computer programming, along with their answers:

Important Computer Programming MCQ,s


1. **Which of the following is not a programming language?**

   - A) Python

   - B) HTML

   - C) Java

   - D) C++

   **Answer: B) HTML**


2. **What does 'HTML' stand for?**

   - A) HyperText Machine Language

   - B) HyperText Markup Language

   - C) Hyper Tool Multi Language

   - D) Hyper Transfer Markup Language

**Answer: B) HyperText Markup Language**


3. **Which of the following is a statically typed language?**

   - A) Python

   - B) JavaScript

   - C) Java

   - D) Ruby

 **Answer: C) Java**


4. **In Python, how do you insert comments in your code?**

   - A) //

   - B) #

   - C) /*

   - D) <!-- -->

   **Answer: B) #**


5. **What does SQL stand for?**

   - A) Structured Query Language

   - B) Simple Query Language

   - C) Sequential Query Language

   - D) Standard Query Language

**Answer: A) Structured Query Language**


6. **Which data structure uses LIFO (Last In, First Out) principle?**

   - A) Queue

   - B) Stack

   - C) Array

   - D) Linked List

   **Answer: B) Stack**


7. **What is the main purpose of an IDE?**

   - A) To run programs

   - B) To write and debug code

   - C) To compile programs

   - D) To manage databases

**Answer: B) To write and debug code**


8. **Which of the following is used to define a block of code in Python?**

   - A) Indentation

   - B) Curly braces {}

   - C) Parentheses ()

   - D) Square brackets []

   **Answer: A) Indentation**


9. **In Java, which keyword is used to inherit a class?**

   - A) extends

   - B) implements

   - C) inherits

   - D) super

   **Answer: A) extends**


10. **What is the time complexity of searching for an element in a balanced binary search tree (BST)?**

    - A) O(n)

    - B) O(log n)

    - C) O(n log n)

    - D) O(1)

    **Answer: B) O(log n)**


11. **Which of the following is not a type of loop in programming?**

    - A) for

    - B) while

    - C) do-while

    - D) until

    **Answer: D) until**


12. **Which function is used to read a string from the user in C?**

    - A) gets()

    - B) scanf()

    - C) printf()

    - D) cout

    **Answer: A) gets()**


13. **In object-oriented programming, what is encapsulation?**

    - A) The ability of different objects to respond to the same message

    - B) The process of combining data and functions into a single unit called a class

    - C) The ability to derive new classes from existing classes

    - D) The ability to use a single variable to represent multiple types

**Answer: B) The process of combining data and functions into a single unit called a class**


14. **Which of the following is used to create an object in Java?**

    - A) create

    - B) new

    - C) malloc

    - D) object

**Answer: B) new**


15. **What is the output of the following code snippet in Python? `print(2 ** 3)`**

    - A) 6

    - B) 8

    - C) 9

    - D) 12

 **Answer: B) 8**


16. **Which sorting algorithm has the best average case performance?**

    - A) Bubble Sort

    - B) Insertion Sort

    - C) Quick Sort

    - D) Selection Sort

 **Answer: C) Quick Sort**


17. **In SQL, which command is used to remove a table from a database?**

    - A) DELETE

    - B) DROP

    - C) REMOVE

    - D) ERASE

 **Answer: B) DROP**


18. **Which of the following is not a valid variable name in Python?**

    - A) _var

    - B) var_name

    - C) 2var

    - D) var2

**Answer: C) 2var**


19. **Which of the following is a feature of functional programming?**

    - A) Mutable state

    - B) Immutability

    - C) Class inheritance

    - D) Procedural steps

**Answer: B) Immutability**


20. **In C++, which operator is used to access the value at the address stored in a pointer?**

    - A) &

    - B) *

    - C) ->

    - D) .

 **Answer: B) ***

Post a Comment

Thanks for Your Response

Previous Post Next Post