What is a collision in a hash table?
Correct answer D. Two different keys hash to the same index
Subject / 421 questions
Programming MCQs are multiple-choice questions on the basic concepts and syntax of programming languages, here covering C, C++, Java, PHP and HTML. Topics include keywords, loops, pointers, classes, constructors, functions and HTML tags. They help computer science students and candidates for IT, programmer and lecturer posts. Each question shows its answer instantly for quick self-assessment.
Correct answer D. Two different keys hash to the same index
Correct answer B. Each slot holds a linked list of all keys that hash to it
Correct answer B. 3
Correct answer A. 5
Correct answer D. 0.75
Correct answer C. Primary clustering
Correct answer D. O(1)
Correct answer C. The array must be sorted
Correct answer D. 10
Correct answer D. [3, 7, 1, 5, 9]
Correct answer A. [10, 13, 14, 37, 29]
Correct answer C. O(n), when the input is already sorted
Correct answer A. An array that is already sorted
Correct answer B. [3, 1, 4, 8, 9, 7]
Correct answer A. It is stable and runs in O(n log n) time in every case, but needs O(n) extra space for arrays
Correct answer B. Heap sort
Correct answer B. O(n + k)
Correct answer A. 5, 10, 30, 25, 55, 70, 60, 40
Correct answer A. 30, 10, 50, 20, 40, 60
Correct answer D. Inorder
The C Language section tests reserved keywords, pointers, memory allocation functions such as malloc and calloc, and loop types, including the do-while loop that runs at least once. The C++ section covers object-oriented ideas: classes as templates for objects, default access of class members, constructors and default constructors, and the header files needed for file input and output. These details are often tested through short code snippets.
The Java section covers comments, data types and the boolean results returned by relational operators, while the PHP section includes the language's history and string functions that change text case. The HTML section tests the basic structure of a web page, such as the first tag in a document, the tag for the largest heading, the image tag and the idea of block-level elements.
Programming MCQs matter because technical posts in IT departments, teaching jobs in computer science and campus recruitment rounds use them to check fundamentals quickly. Questions often look simple but hinge on one precise rule, such as a default value or a keyword, so practising them sharpens accuracy and helps you write correct code in practical tests. It also prepares you for the written and coding stages that often follow.
Pakistan
India
Bangladesh
This category covers C, C++, Java, PHP and HTML. Questions focus on fundamentals such as keywords, loops, pointers, classes, constructors, functions and web page tags, which are the concepts most often tested in recruitment and university exams.
Programming questions appear in tests for IT, programmer and computer science teaching posts. In Pakistan they appear in FPSC, PPSC and lecturer tests. In India they are common in campus placements, UGC NET and GATE, and in Bangladesh in BCS and programmer recruitment.
MCQs360 has 75 Programming MCQs, split into C, C++, Java, PHP and HTML sections. Every question shows its correct answer instantly, and practice is free without sign-up. Each section can be practised on its own.
Revise core concepts language by language, then practise MCQs and test any doubtful answer by writing a small program. Pay attention to defaults, keywords and syntax details, since many questions hinge on them. Tracing code on paper also builds the speed needed for output-based questions.
A while loop checks its condition before running the body, so it may not run at all if the condition is false at the start. A do-while loop runs the body first and checks the condition afterwards, so it always executes at least once.
A constructor is a special member function that runs automatically when an object is created, usually to initialise its data. It has the same name as the class and no return type. A constructor with no parameters is called a default constructor.
Last reviewed October 2026