Sponsor Area
TextBook Solutions for Uttarakhand Board Class 12 Computer And Communication Technology Computer Science With C++ Chapter 11 Structured Query Language
Write the definition of a function AddUp(int Arr[], int N) in C++, in which all even positions (i.e. 0,2,4,...) of the array should be added with the content of the element in the next position and odd positions (i.e. 1,3,5,...) elements should be incremented by 10.
Example: if the array Arr contains
| 23 | 30 | 45 | 10 | 15 | 25 |
Then the array should become
| 53 | 40 | 55 | 20 | 40 | 35 |
NOTE:
● The function should only alter the content in the same array.
● The function should not copy the altered content in another array.
● The function should not display the altered content of the array.
● Assuming, the Number of elements in the array are Even.
void AddUp(int Arr[], int N)
{
for(int i=0; i<N; i++)
{
if(i%2==0){
Arr[i]=Arr[i]+Arr[i+1];
}else{
Arr[i]=Arr[i]+10;
}
}
} Write a definition for a function SUMMIDCOL(int MATRIX[][10],int N,int M) in C++, which finds the sum of the middle column’s elements of the MATRIX (Assuming N represents a number of rows and M represents number of columns, which is an odd integer).
Example: if the content of array MATRIX having N as 5 and M as 3 is as follows:
| 1 | 2 | 1 |
| 2 | 1 | 4 |
| 3 | 4 | 5 |
| 4 | 5 | 3 |
| 5 | 3 | 2 |
The function should calculate the sum and display the following:
Sum of Middle Column: 15
Consider the following tables CARDEN and CUSTOMER and answer (b) and (c) parts of question:
TABLE: CARDEN
|
Ccode |
CarName |
Make |
Color |
Capacity |
Charges |
|
501 |
A-Star |
Suzuki |
RED |
3 |
14 |
|
503 |
Indigo |
Tata |
SILVER |
3 |
12 |
|
502 |
Innova |
Toyota |
WHITE |
7 |
15 |
|
509 |
SX4 |
Suzuki |
SILVER |
4 |
14 |
TABLE: CUSTOMER
|
CCode |
Cname |
Ccode |
|
1001 |
Hemant Sahu |
501 |
|
1002 |
Raj Lal |
509 |
|
1002 |
Feroza Shah |
503 |
|
1004 |
Ketan Dhal |
502 |
Write SQL commands for the following statements:
- To display the names of all the silver colored
- To display name of car, make and capacity of cars in descending order of their sitting
- To display the highest charges at which a vehicle can be hired from
- To display the customer name and the corresponding name of the cars hired by them
Consider the following tables CARDEN and CUSTOMER and answer (b) and (c) parts of question:
TABLE: CARDEN
|
Ccode |
CarName |
Make |
Color |
Capacity |
Charges |
|
501 |
A-Star |
Suzuki |
RED |
3 |
14 |
|
503 |
Indigo |
Tata |
SILVER |
3 |
12 |
|
502 |
Innova |
Toyota |
WHITE |
7 |
15 |
|
509 |
SX4 |
Suzuki |
SILVER |
4 |
14 |
TABLE: CUSTOMER
|
CCode |
Cname |
Ccode |
|
1001 |
Hemant Sahu |
501 |
|
1002 |
Raj Lal |
509 |
|
1002 |
Feroza Shah |
503 |
|
1004 |
Ketan Dhal |
502 |
Give the output of the following SQL queries:
- SELECT COUNT(DISTINCT Make) FROM CARDEN;
- SELECT MAX(Charges),MIN(Charges) FROM CARDEN;
- SELECT COUNT(*),Make FROM CARDEN;
- SELECT CarName FROM CARDEN WHERE Capacity=4;
Sponsor Area
Sponsor Area
Mock Test Series
Mock Test Series



