Important Questions & Viva
Multiple choice questions
Which unit of the CPU controls the flow of data?
(a) ALU (b) Control Unit (c) Register (d) Cache
Show answer
(b) Control Unit
Which of these is system software?
(a) MS Excel (b) Tally (c) Linux (d) Chrome
Show answer
(c) Linux
Gmail is an example of
(a) IaaS (b) PaaS (c) SaaS (d) Grid computing
Show answer
(c) SaaS
Which is NOT one of the Vs of big data?
(a) Volume (b) Velocity (c) Variety (d) Visibility
Show answer
(d) Visibility
Output of print(type(3 + 2.0))
(a) <class 'int'> (b) <class 'float'> (c) <class 'str'> (d) Error
Show answer
(b) <class 'float'>
Output of print('ab' * 3)
(a) ababab (b) ab3 (c) Error (d) aabbab
Show answer
(a) ababab
Which method adds an element at the end of a list?
(a) insert() (b) add() (c) append() (d) push()
Show answer
(c) append()
d.get("x", 0) returns 0 when
(a) x is 0 (b) x is missing (c) d is empty only (d) never
Show answer
(b) x is missing
np.arange(2, 11, 3) gives
(a) [2 5 8] (b) [2 5 8 11] (c) [3 6 9] (d) [2 4 6 8 10]
Show answer
(a) [2 5 8]
Shape of np.zeros((3, 4))
(a) (4, 3) (b) (3, 4) (c) 12 (d) (3,)
Show answer
(b) (3, 4)
The median of 4, 9, 2, 7, 5 is
(a) 5 (b) 7 (c) 5.4 (d) 4
Show answer
(a) 5
Number of rows in a relation is called its
(a) degree (b) domain (c) cardinality (d) schema
Show answer
(c) cardinality
Which constraint does not allow duplicate values but allows NULL?
(a) PRIMARY KEY (b) UNIQUE (c) NOT NULL (d) DEFAULT
Show answer
(b) UNIQUE
Which command changes the structure of a table?
(a) UPDATE (b) ALTER (c) INSERT (d) SELECT
Show answer
(b) ALTER
Which pattern matches names that end with 'a'?
(a) 'a%' (b) '%a' (c) '_a' (d) '%a%'
Show answer
(b) '%a'
DELETE is a ___ command.
(a) DDL (b) DML (c) DCL (d) TCL
Show answer
(b) DML
Find the output
Q1
x = 7 y = x // 2 + x % 3 * 2 print(x, y)
Show answer
7 5
Q2
L = [10, 20, 30, 40] L.insert(1, 15) L.extend([50]) print(L[::2], L.pop(), len(L))
Show answer
[10, 20, 40] 50 5
Q3
d = {'a': 3, 'b': 5}
d['c'] = d['a'] * d['b']
for k in d:
print(k, d[k], end='; ')
print()Show answer
a 3; b 5; c 15;
Q4
import numpy as np a = np.array([[2, 4], [6, 8]]) print(a * 2) print(a.sum(axis=0), a.mean())
Show answer
[[ 4 8] [12 16]] [ 8 12] 5.0
Q5
import numpy as np b = np.arange(10) print(b[b % 3 == 0], b[2:8:2], b.reshape(2, 5)[1])
Show answer
[0 3 6 9] [2 4 6] [5 6 7 8 9]
Q6
for i in range(1, 4):
print('*' * i + '-' * (3 - i))Show answer
*-- **- ***
Short answer & SQL questions
Differentiate between RAM and ROM.
Show answer
RAM is volatile, read-write memory holding running programs and data. ROM is non-volatile, mostly read-only memory holding the start-up firmware (BIOS).
What is the difference between a list and a NumPy array?
Show answer
A list can store mixed data types and arithmetic operators do not work element-wise. A NumPy array stores one data type, uses less memory, is faster and supports element-wise operations such as arr * 2.
Explain primary key, candidate key and foreign key with an example.
Show answer
In STUDENT(RollNo, Name, AadhaarNo), RollNo and AadhaarNo can both identify a student — candidate keys. RollNo is chosen as the primary key; AadhaarNo becomes an alternate key. In FEE(ReceiptNo, RollNo, Amount), RollNo refers to STUDENT and is a foreign key.
Differentiate between DELETE and DROP.
Show answer
DELETE (DML) removes rows from a table; the table structure remains. DROP (DDL) removes the whole table including its structure and data.
Find mean, median, mode and range of 12, 7, 9, 7, 15.
Show answer
Sorted: 7, 7, 9, 12, 15. Mean = 50 ÷ 5 = 10; median = 9; mode = 7; range = 15 − 7 = 8.
What are IaaS, PaaS and SaaS? Give one example each.
Show answer
IaaS provides virtual hardware (AWS EC2); PaaS provides a platform to build apps (Google App Engine); SaaS provides ready software over the internet (Gmail, Google Docs).
Write SQL to show names and marks of students of XI-B with marks above 70, highest first.
Show answer
SELECT Name, Marks FROM STUDENT WHERE Class = 'XI-B' AND Marks > 70 ORDER BY Marks DESC;
Write SQL to add a column Phone to STUDENT and then set it for RollNo 101.
Show answer
ALTER TABLE STUDENT ADD Phone CHAR(10); UPDATE STUDENT SET Phone = '9876543210' WHERE RollNo = 101;
Viva questions
| Question | Answer |
|---|---|
| Full form of NumPy? | Numerical Python. |
| What does ndim tell? | Number of dimensions of an array. |
| Function to create evenly spaced numbers including the end value? | np.linspace(). |
| Why is input() converted with int()? | Because input() returns a string. |
| Which Python data type stores key-value pairs? | Dictionary. |
| What is a DBMS? | Software to create and manage databases, e.g. MySQL. |
| Command to see the structure of a table? | DESCRIBE table_name; |
| What is NULL? | An unknown or missing value — not zero or blank. |
| Difference between CHAR and VARCHAR? | CHAR is fixed length; VARCHAR is variable length. |
| Give two sensors in a smartphone. | Accelerometer, proximity sensor (also GPS, gyroscope). |
