English

CBSE Science (English Medium) Class 12 Important Questions for Computer Science (C++) - Data Structures

Topics

All topics
Advertisements
Advertisements

Chapter wise important questions with answers and solutions for Computer Science (C++) in CBSE Science (English Medium) Class 12.

Write the definition of a function SumEO(int VALUES[], int N) in C++, which should display the 4 sum of even value and sum of odd values of the array separately.

Example: If the array VALUES contains

25 20 22 21 53

Then the functions should display the output as:

Sum of even values = 42 (i.e., 20+22)

Sum of odd values= 99 (i.e., 25+21+53)

Appears in 1 question paper
Chapter: [7] Data Structures
Concept: One and Two Dimensional Arrays - Sequential Allocation and Address Calculation

Write a definition for a function UpperHalf(int Mat[4][4]) in C++ which displays the elements in the same way as per the example is shown below.

For example, if the content of the array Mat is as follows:

25 24 23 22
20 19 18 17
15 14 13 12
10 9 8 7

Thew function should display the content in the following format:

Appears in 1 question paper
Chapter: [7] Data Structures
Concept: One and Two Dimensional Arrays - Sequential Allocation and Address Calculation

Let us assume Data[20][15] is a two-dimensional array, which is stored in the memory along the row with each of its elements occupying 2 bytes. Find the address of the element Data(10][5], if the element Data[10][l5] is stored at the memory location 15000.

Appears in 1 question paper
Chapter: [7] Data Structures
Concept: One and Two Dimensional Arrays - Sequential Allocation and Address Calculation

Wnte the definition of a member function AddPac ket() for a class QUEUE in C++, to remove/delete a Packet from a dynamically allocated QUEUE of Packets' considering the following code is already written as a part of the program.

struct Packet
{
   int PID;
   char Address[20];
   Packet *LINK;
};

class QUEUE
{
    Packet *Front, *Rear;
public:
    QUEUE(){Front=NULL;Rear=NULL;}
    void AddPacket();
    void DeletePacket();
    ~QUEUE();
};
Appears in 1 question paper
Chapter: [7] Data Structures
Concept: Queue (Array and Linked Implementation)

ARR[15] ft:20] is a two-dimensional array, which is stored in the memory along the row with each of its elements occupying 4 .bytes. Find the .address of the element ARR[5)[15], if the element ARR[lO] [5] is stored at the memory location 35000.

Appears in 1 question paper
Chapter: [7] Data Structures
Concept: One and Two Dimensional Arrays - Sequential Allocation and Address Calculation

A two-dimensional array ARR[50][20] is stored in the memory along the row with each of its elements occupying 4 bytes. Find the address of the element ARR[30] [10], if the element ARR[10] [5] is stored at the memory location 15000.

Appears in 1 question paper
Chapter: [7] Data Structures
Concept: One and Two Dimensional Arrays - Sequential Allocation and Address Calculation

Write a function REVROW(int P[] [5], int N, int M) in C++ to display the content of a two-dimensional array, with each row content in reverse order.

For example, if the content of the array is as follows:

15 12 56 45 51
13 91 92 87 63
11 23 61 46 81

The function should display output as

Appears in 1 question paper
Chapter: [7] Data Structures
Concept: One and Two Dimensional Arrays - Sequential Allocation and Address Calculation
Advertisements
Share
Notifications



      Forgot password?
Use app×