About Programming MCQs

Programming is the cornerstone of computer science and IT. MCQs on this subject test your understanding of syntax, logic, data structures, and algorithms across various programming languages. Whether you are preparing for a university exam or a technical job interview, these questions will sharpen your problem-solving skills.

Topics Covered in This Category

  • Language Fundamentals: C, C++, Java, Python, and PHP basics.
  • Data Structures: Arrays, linked lists, stacks, queues, trees, and graphs.
  • Algorithms: Sorting, searching, recursion, and time complexity.
  • Object-Oriented Programming (OOP): Classes, objects, inheritance, polymorphism, and encapsulation.

Study Tips for Programming MCQs

Programming is best learned by doing. Do not just read the code; type it out and run it. Trace algorithms on paper to understand how variables change. When solving MCQs, pay attention to subtle syntax errors, loop conditions, and array indices, as these are common traps in exams.

Question 151: In Ruby, what is the keyword used to define a class?

  • A class
  • B cls
  • C defclass
  • D define

Explanation: The correct answer to the question is: class

Question 152: Ruby is an object oriented general purpose programming language.

  • A False
  • B True

Explanation: The correct answer to the question is: True

Question 153: What is the data type of the value "Hello, World" in Ruby?

  • A Boolean
  • B Integer
  • C Float
  • D String

Explanation: The correct answer to the question is: String

Question 154: What is the output of the the given code?

  • A My name is #{Name}
  • B Undefined Error
  • C Error in compilation
  • D Name variable not defined earlier

Explanation: The correct answer to the question is: Name variable not defined earlier