Documente Academic
Documente Profesional
Documente Cultură
STRUCTURES
Q1. Write a program to store information of 100 employees(eno, ename, salary) and to display information of an employee
depending upon the employee no given.
Q2. Assuming suitable data types, give necessary declarations for an array of 20 voter records, each record of which consists of
four data values viz. id_no , name , address , age.
Make use of above declarations to write a program segment that prints id_no, name for all those voters whose ages exceed
60.
Q3. A linear array if size 50 stores following informations : name of the country . Country’s capital and per capita income of the
country. Write a complete program in C++ to do the following:
(i) To read a country’s name and display capital and per-capita income.
(ii) To read name of the capital city and display country’s name and displays country’s name and per capital income.
Q4. Assume that , the roll number , marks in English , Computers and Math ( out of 100 ) are to be stored in a structure.
Write a function in C++ which accept array of student and it calculates the following:
(i) No. of students passed with distinction.
(ii) Details of top two students
(iii) Number of students failed.
Q5. Assume an array S Containing elements of structure Student is required to be arranged in descending order of Marks. Write
a C++ function to arrange the same with the help of bubble sort. The array and its size is required to be passed as parameters
to the function. Definition of structure Student is as follows :
struct Student
{
int Rollno;
char Name[25];
float Marks;
}
ARRAY
Q1. Write UDF in C++ which accepts an integer array and its size as arguments/ parameters and assign the elements
into a 2 D array of integers in the following format :f the array is 1,2,3,4,5
The resultant 2D array is given below
10000
12000
12300
12340
12345
Q2. Suppose A, B, C are the array of integers having size m, n, m+n respectively .The elements of array A appear in
ascending order, the elements of array B appear in descending order. Write a UDF in C++ to produce third
array C after merging arrays A and B in ascending order. Take the arrays A, B and C as arguments to the
function.
Q3. Write a function in C++ which accepts an integer array and its size as arguments/parameters and exchanges the
values of first half side elements with the second half side elements of the array.
example : if the array is 8,10,1,3,17,90,13,60 then rearrange the array as 17,90,13,60,8,10,1,3
Q4. Write a function in C++ which accepts an integer array and its size as arguments/parameters and exchanges the
values at alternate locations .
example : if the array is 8,10,1,3,17,90,13,60 then rearrange the array as 10,8,3,1,90,17,60,13
Q5. Given two arrays of integers X and Y of sizes m and n respectively . Write a function named MERGE() which
will produce a third array Z , such that the following sequence is followed .
(a) All odd numbers of X from left to right are copied into Z from left to right.
(ii) All even numbers of X from left to right are copied into Z from right to left.
(iii) All odd numbers of Y from left to right are copied into Z from left to right.
(ii) All even numbers of Y from left to right are copied into Z from right to left.
Q6. Write a function in c++ which accepts a 2D array of integers, number of rows and number of columns as arguments and
assign the elements which are divisible by 3 or 5 into a one dimensional array of integers.
12 3 9 14
24 25 16 31
If the 2D array is
19 32 45 27
11 5 28 18
The resultant 1D arrays is 12 , 3 , 9 , 24 , 25 , 45 , 9 , 5 , 18
Q7. Write a function in C++ which accepts a 2D array of integers and its size as arguments and displays the elements of middle
row and the elements of middle column. [Assuming the 2D Array to be a square matrix with odd dimension
i.e. 3×3, 5×5, 7×7 etc...]
Example, if the array content is
354
769
218
Output through the function should be :
Middle Row : 7 6 9
Middle Column : 5 6 1
Q8. Write a function in C++ which accepts a integer array and its size as an arguments and prints the output (using nested loops)
in following format :
Example : if the array is having
12459
Then the output should be
1
22
4444
55555
999999999
Boolean Algebra
Q1. (a) State and prove the Distributive law algebraically.
(b) Write the equivalent POS expression of following SOP form
F (x,y,z)= ∑ (0,2,4,6)
(c) Draw the Logical circuit of the following expression with the help of NAND gate only x+yz
(d) Obtain the simplified form of a Boolean expression using K-Map.
F(a,b,c,d)=∑(0,1,2,3,4,7,11,12,14)
Q2. (a) State De Morgan’s Theorems and verify the same using truth table.
(b) Write the equivalent Canonical Product of Sum Expression for the following Sum of Product Expression
F(X, Y, Z) = Σ (0, 2, 4, 5)
(c) Draw the Logical circuit of the following expression with the help of NOR gate only (A+B)(B+C)(A’+B’)
(d) Reduce the following Boolean expression using K-Map :
F(A, B, C, D) = π(5,6,7,8,9,12,13,14,15)
Q3. (a) State Distributive law and verify the same using truth table.
(b) Write the equivalent Canonical Sum of Product expression for the following Product of Sum Expression
F(X,Y,Z) = π (1,3,6,7)
(c) Write the dual of the following Boolean Expression (A+B)(B+C)(A’+B’).
(d) Reduce the following Boolean expression using K-Map
F(U,V,W,Z) = Σ (0, 1, 2, 3, 4, 10, 11)
SQL
Q.1 Give the following EMPLOYEE realtion, answer the questions:
TABLE : EMP
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SUNITA SHARMA CLERK 7902 1990-12-17 12800 NULL 20
7499 ASHOK SINGHAL SALESMAN 7698 1991-02-20 13600 1300 30
7521 SUMIT AVASTHI SALESMAN 7698 1991-02-22 15250 1500 30
7566 JYOTI LAMBA MANAGER 7839 1991-04-02 14975 NULL 20
7654 MARTIN S. SALESMAN 7698 1991-02-28 16250 2400 30
7698 BINOD GOEL MANAGER 7839 1991-0501 15850 NULL 30
7782 CHETAN GUPTA MANAGER 7839 1991-06-09 12450 NULL 10
7788 SUDHIR RAWAT ANALYST 7566 1991-04-19 15000 NULL 20
7839 KAVITA SHARMA PRESIDENT NULL 1990-01-10 20000 NULL 10
7844 TUSHAR TIWARI SALESMAN 7698 1991-09-08 14500 0 30
7876 ANANAD RATHI CLERK 7788 1997-05-23 16100 NULL 20
7900 JAGDEEP RANA CLERK 7698 1992-03-24 14950 NULL 30
7902 SUMIT VATS ANALYST 7566 1992-10-18 13500 3600 20
7934 MANOJ KAUSHIK CLERK 7782 1990-06-10 15300 NULL 10
Table- Department
DEPTNO DNAME LOC
10 ACCOUNTING DELHI
20 RESEARCH KOLKATA
30 SALES MUMBI
40 OPERATIONS BANGALORE