Programming and Data Structure MCQ Quiz - Objective Question with Answer for Programming and Data Structure - Download Free PDF

Last updated on Jun 10, 2025

Latest Programming and Data Structure MCQ Objective Questions

Programming and Data Structure Question 1:

________ is a framework that you can use to write a program. It provides a set of classes and functions that helps you avoid writing all the low-level code to perform specific actions.  

  1. Electronic Data Interchange
  2. Application Programming Interface
  3. Enterprise Resource Planning (ERP) systems
  4. Client Server Architecture
  5. None of the above

Answer (Detailed Solution Below)

Option 2 : Application Programming Interface

Programming and Data Structure Question 1 Detailed Solution

Concept

Electronic Data Interchange (EDI) is the electronic interchange of business information using a standardized format; a process that allows one company to send information to another company electronically rather than with paper. Business entities conducting business electronically are called trading partners

An application programming interface (API) is a computing interface that defines interactions between multiple software intermediaries. It defines the kinds of calls or requests that can be made, how to make them, the data formats that should be used, the conventions to follow, etc.It is a framework that you can use to write a program. It provides a set of classes and functions that helps you avoid writing all the low-level code to perform specific actions.Therefore Option 2 is correct

ERP is an acronym that stands for “Enterprise Resource Management”, the consolidated process of gathering and organizing business data through an integrated software suite. ERP software contains applications that automate business functions like production, sales quoting, accounting, and more

Client-server architecture, the architecture of a computer network in which many clients (remote processors) request and receive service from a centralized server (host computer). Client computers provide an interface to allow a computer user to request services of the server and to display the results the server returns

Programming and Data Structure Question 2:

int z, x = 5, y = -10, a = 4, b = 2;

z = x++ - --y * b / a;

Then z = ?

  1. 5
  2. 6
  3. 10
  4. 11
  5. None of the above

Answer (Detailed Solution Below)

Option 3 : 10

Programming and Data Structure Question 2 Detailed Solution

The correct answer is 10

SOLUTION:

Let's break down the expression step by step:

  • x++: Post-increment x, so the current value of x (5) is used in the expression, and then x is incremented to 6.
  • --y: Pre-decrement y, so y is decremented to -11, and the new value (-11) is used in the expression.
  • --y * b: Multiply the decremented value of y (-11) by b (2), which results in -22.
  • -22 / a: Divide -22 by a (4), resulting in -5.5.
  • z = 5 - (-5.5): Subtract -5.5 from 5, which gives 10.5.

However, since z is an integer, the fractional part is truncated, and z is assigned the value 10.

Programming and Data Structure Question 3:

If on any Queue following operations are performed then sequence of number will be?

push (9), pop (), push (5), push (7), pop (), pop (), push (8), pop ()

  1. 5, 7, 8, 9
  2. 9, 5, 7, 8
  3. 8, 7, 5, 9
  4. 9, 5, 8, 7
  5. None of the above

Answer (Detailed Solution Below)

Option 2 : 9, 5, 7, 8

Programming and Data Structure Question 3 Detailed Solution

The correct answer is 9, 5, 7, 8

Key Points

  • To answer this question, we should understand how the queue data structure works.
  • A queue follows a First-In-First-Out (FIFO) order. This means the first item that's pushed to the queue is the first one to be popped out.

EXPLANATION:

  • push(9): Puts the number 9 in the queue.
  • pop(): Removes the first element from the queue, which is 9.
  • push(5): Puts the number 5 in the queue.
  • push(7): Puts the number 7 in the queue. By now, our queue has the numbers 5 and 7, in this order.
  • pop(): Removes the first element from the queue, which is 5.
  • pop(): Removes the next element, which is 7.
  • push(8): This adds the number 8 to the queue.
  • pop(): Removes the first (and only) element from the queue, which is 8.

So, the sequence of numbers, in the order they were removed from the queue, is [9, 5, 7, 8]. The correct option is therefore: 2) 9, 5, 7, 8

Programming and Data Structure Question 4:

Which of the following devices can digitize an image and send or receive images and text over a telephone line?

  1. Plotter
  2. Fax machine
  3. Sound card
  4. Monitor
  5. None of the above

Answer (Detailed Solution Below)

Option 2 : Fax machine

Programming and Data Structure Question 4 Detailed Solution

  • The correct answer is Fax machine.

Key Points 

  •  Fax machine:
    • It is a device that is used to send documents electronically over a telephone network.
    • The transmission can be between two fax machines, or between a fax machine and computer.
    • It digitizes the material with an internal optical scanner and transmitting the information as electronic signals.
  • Bandwidth is the maximum amount of data transmitted over an internet connection in a given amount of time. It is expressed as a bitrate and measured in bits per second (bps).

Additional Information

  • Plotter:
    • A plotter is a printer that interprets commands from a computer to make line drawings on paper with one or more automated pens.
    • Unlike a regular printer, a plotter can draw continuous point-to-point lines directly from vector graphic files or commands. 
  • A sound card:
    • It is an internal expansion card that provides input and output of audio signals to and from a computer under the control of computer programs.
  • A computer monitor:
    • It is an output device that displays information in pictorial or textual form.
    • A discrete monitor comprises a visual display, support electronics, power supply, housing, electrical connectors, and external user controls.

Programming and Data Structure Question 5:

A threaded binary tree is a binary tree in which: 

  1. Each node has two children 
  2. Each node has at most one child
  3. Each node is connected to its parent
  4. Each node has a thread connecting it to its predecessor or successor
  5. None of the above

Answer (Detailed Solution Below)

Option 4 : Each node has a thread connecting it to its predecessor or successor

Programming and Data Structure Question 5 Detailed Solution

The correct answer is Each node has a thread connecting it to its predecessor or successor

Key Points

  • In a threaded binary tree, nodes may have threads (pointers) that connect them to either their in-order predecessor or successor.
  • These threads provide a way to efficiently traverse the tree without the need for recursive calls or explicit stacks.
  • Nodes with two children are typically called internal nodes, and nodes with one or no children are leaves. The threads in a threaded binary tree help in traversing the tree in in-order without the need for additional space or recursive function calls.

Top Programming and Data Structure MCQ Objective Questions

Which of the following is not a computer language?

I. C++

II. Java

III. Linux

  1. Only I
  2. Only III
  3. II and III
  4. I and II

Answer (Detailed Solution Below)

Option 2 : Only III

Programming and Data Structure Question 6 Detailed Solution

Download Solution PDF

C++

Computer Language

Java

Computer Language

Linux

Operating System

 

Additional Information

  • Computer Language - A programming language is a vocabulary and set of grammatical rules for instructing a computer or computing device to perform specific tasks.
  • Operating System - is system software that manages computer hardware and software resources and provides common services for other computer programs.

Which programming language is called the mother of programming languages?

  1. C++
  2. C
  3. Java
  4. COBOL

Answer (Detailed Solution Below)

Option 2 : C

Programming and Data Structure Question 7 Detailed Solution

Download Solution PDF

The Correct Answer is Option (2) i.e C.

  • The C language is also known as the mother of all programming languages.
  • C is a general-purpose programming language that is used for creating a variety of applications.
  • C language was originally developed for writing operating systems. Unix Kernel and all of its supporting tools and libraries are written in C language.
  • The C language is used for the following operations :
    • Operating systems
    • Development of new languages
    • Computation platforms
    • Embedded systems
    • Graphics and Games
  • C++ and Java are the high-level languages and COBOL is a compiled English-like computer programming language.

Valid character constants are:

  1. '\n'
  2. '\\'
  3. Both of the above
  4. None of the above

Answer (Detailed Solution Below)

Option 3 : Both of the above

Programming and Data Structure Question 8 Detailed Solution

Download Solution PDF

A character constant is one or more characters enclosed in single quotes, such as 'A' , '+' , or '\n'. 

Backslash_character Meaning
\b Backspace
\f Form feed
\n New line
\r Carriage return
\t Horizontal tab
\” Double quote
\’ Single quote
\\ Backslash
\v Vertical tab
\a Alert or bell
\? Question mark
\N Octal constant (N is an octal constant)
\XN Hexadecimal constant (N – hex.dcml cnst)
 

Consider the following C declaration

struct {

short s[5];

union {

float y;

long z;

}u;

}t;

Assume that objects of type short, float and long occupy 2 bytes, 4 bytes and 8 bytes, respectively. The memory requirement for variable t, ignoring alignment considerations, is

  1. 22 bytes
  2. 18 bytes
  3. 14 bytes
  4. 10 bytes

Answer (Detailed Solution Below)

Option 2 : 18 bytes

Programming and Data Structure Question 9 Detailed Solution

Download Solution PDF

The correct answer is "option 2"

CONCEPT:

Structure in C is a user-defined data type that is used to store the collection of different data types.

The total size of the structure is the sum of the size of every data member.

Union is a user-defined data type that is used to store different data types in the same memory location.

The total size of the union is the size of the largest data member.
 

EXPLANATION:

Given the size of short, float and long is 2 bytes, 4 bytes, and 8 bytes, respectively.

Therefore,

Size of Structure → size of ( short s[5] ) + size of Union  

Here, Size of Union = 8 bytes   { largest data member is long }.

Size of short s[5]  2×5  10 bytes

Size of Structure → 10+8 →18 bytes.

Hence, the correct answer is "option 2".

Consider the following array declaration in ‘C’ language:

int array[] = {2, 3, 4, 5};

What will be the output of the following statement?

printf("%d", 2[array]);

  1. 4
  2. 3
  3. 2
  4. 5

Answer (Detailed Solution Below)

Option 1 : 4

Programming and Data Structure Question 10 Detailed Solution

Download Solution PDF
Key Points

 An array is defined as the collection of similar types of data items stored at contiguous memory locations. Arrays are the derived data type in C programming language which can store the primitive type of data such as int, char, double, float, etc. C array is beneficial if you have to store similar elements.

int array[] = {2, 3, 4, 5}; This array storage be like, 

F2 Harshita Madhuri 12.02.2022 D2

The above array at index I can be accessed by, a[i], i[a], *(a+i) or *(i+a) all the above representations all are equal and gives the i th index value.

printf(%d', 2[array]); So, it gives the 2nd  index value. i.e 4.

Hence the correct answer is 4.

Additional InformationProgram: 

#include
int main()
{
    int arr[] = { 2, 3, 4, 5 };
    printf("%d ",arr[2]);
    printf("%d ",2[arr]);
    printf("%d ",*(2+arr));
    printf("%d ",*(arr+2));
    return 0;
}

Output: 4 4 4 4

So above given 2nd index value is 4 for all above print statements.

Which of the following viruses codifies itself in an automatic manner, each time it infects and copies the system.

  1. Polymorphic virus
  2. File Allocation Table (FAT) Virus
  3. Overwrite viruses
  4. Multipartite virus

Answer (Detailed Solution Below)

Option 1 : Polymorphic virus

Programming and Data Structure Question 11 Detailed Solution

Download Solution PDF

The correct answer is ​Polymorphic virus.

Key Points

  • A polymorphic virus is a complicated computer virus that affects data types and functions.
  • Polymorphic viruses are complex file infectors that can create modified versions of themselves to avoid detection yet retain the same basic routines after every infection.
  • Upon infection, the polymorphic virus duplicates itself by creating usable, albeit slightly modified, copies of itself.
  • To vary their physical file makeup during each infection, polymorphic viruses encrypt their codes and use different encryption keys every time.
  • It is a self-encrypted virus designed to avoid detection by a scanner.

Which of the following is a math library function?

  1. Math.h
  2. int.h 
  3. Stdio.h 
  4. String.h 

Answer (Detailed Solution Below)

Option 1 : Math.h

Programming and Data Structure Question 12 Detailed Solution

Download Solution PDF

The correct answer is Math.h

Key Points

  • Math.h: This is a math library in C that provides mathematical functions like sqrt(), pow(), sin(), cos(), etc.

Additional Information

  • int.h: This is not a standard library in C.
  • Stdio.h: This is the standard input/output library in C, used for functions like printf() and scanf().
  • String.h: This is a string handling library in C, used for functions like strlen(), strcmp(), etc.

Who is credited with developing the “C” language?

  1. Bill Gates
  2. Steve Rogers
  3. Dennis Ritchie
  4. Yashwant Kanetkar

Answer (Detailed Solution Below)

Option 3 : Dennis Ritchie

Programming and Data Structure Question 13 Detailed Solution

Download Solution PDF

The correct answer is Dennis Ritchie.

Key Points

  • C programming is a general-purpose, procedural, imperative computer programming language created by Dennis M. Ritchie at Bell Telephone Laboratories in 1972 to help build the UNIX operating system.
  • The most extensively used computer language is C. Dennis Ritchie created C, a successor to the programming language B, at Bell Labs between 1972 and 1973 to build tools that ran on Unix.
  • It was used to re-implement the Unix operating system's kernel.
  • Dennis MacAlistair Ritchie was a computer scientist from the United States.
  • He designed the C programming language, as well as the Unix operating system and the B programming language, alongside long-time collaborator Ken Thompson. 

Additional Information

  • William Henry Gates III (Bill Gates) is a business entrepreneur, software developer, investor, author, and philanthropist from the United States. He and his late boyhood buddy Paul Allen co-founded Microsoft.
  • Yashavant Kanetkar is a computer science author from India well known for his publications on programming languages. He has written multiple books on programming in C, C++, VC++, C#,.NET, DirectX, and COM.

Consider the following C program:

#include

int main ( )

{

int a[ ] = {2, 4, 6, 8, 10};

int i, sum = 0, *b = a + 4;

for (i = 0; i < 5; i++)

sum = sum + (*b - i) - *(b - i);

printf (“ % d \ n”, sum);

return 0;

}

The output of the above C program is ________.

Answer (Detailed Solution Below) 10

Programming and Data Structure Question 14 Detailed Solution

Download Solution PDF

integer pointer b points to 5th element of an static array a

*b = 10 / dereferencing

sum = 0 / initially

Values in loop

 sum = sum + (*b - i) - *(b - i);

i = 0

 sum = 0 + (10 - 0) - *(address_of_5th integer - 0)

 = 10 - *(address_of_5th integer)

 = 10 - 10 = 0

i = 1

 sum = 0 + (10 - 1) - *(address_of_5th integer - 1)

 = 0 + (10 - 1) - *(address_of_4th integer)

 = 9 - 8 = 1

i = 2

 sum = 1 + (10 - 2) - *(address_of_5th integer - 2)

 = 1 + (10 - 2) - *(address_of_3rd integer)

 = 9 - 6 = 3

i = 3

 sum = 3 + (10 - 3) - *(address_of_5th integer - 3)

 = 3 + (10 - 3) - *(address_of_2nd integer)

 = 10 - 4 = 6

i = 4

 sum = 6 + (10 - 4) - *(address_of_5th integer - 4)

 = 6 + (10 - 4) - *(address_of_1st integer)

 = 12 - 2 = 10

Which one of the following is not an example of computer language?

  1. ALGORITHM
  2. FORTRAN
  3. PASCAL
  4. COBOL

Answer (Detailed Solution Below)

Option 1 : ALGORITHM

Programming and Data Structure Question 15 Detailed Solution

Download Solution PDF

The correct answer is ALGORITHM.

Key Points

  • An algorithm is a specific procedure for solving a well-defined computational problem.
  • The development and analysis of algorithms are fundamental to all aspects of Computer Science like AI, databases, graphics, networking, OS, etc.
  • Algorithm development is more than just programming.
    • It requires an understanding of the alternatives available for solving a computational problem.
    • It includes the hardware, networking, programming language, and performance constraints that accompany any particular solution.

Additional Information

  • An official language comprising a collection of instructions that produce different kinds of output is a programming language.
  • In computer science, programming languages are used to implement algorithms.
  • Most of the languages of programming consist of computer instructions.
Pascal
  • Pascal language is mostly a teaching language and few industries use this language to write the programs.
  • This language tends to use keywords instead of symbols and braces in the C language.
  • So this language is very easy for beginners to understand than a programming language like C, C++. 
Fortron
  • It is a computer programming language.
  • It was created in 1957 by John Backus.
  • The name produced from the two words FORmula TRANslation.
  • It is commonly used for numeric and scientific computing.
Cobol
  • COBOL stands for Common Business Oriented Language.
  • It is first developed in 1960 by the CODASYL Committee (Conference on Data Systems Languages).
  • It is primarily designed for use in business-oriented applications.
Get Free Access Now
Hot Links: teen patti master plus teen patti royal teen patti yes teen patti teen patti game - 3patti poker