IT Viva Preparation Notes
DATABASE MANAGEMENT SYSTEM & SQL
1. What is a Database?
A database is an organized collection of data that can be easily accessed, managed, and
updated.
2. Name some DBMS
MySQL, Oracle, PostgreSQL, SQLite, Microsoft SQL Server
3. What is DBMS?
Database Management System (DBMS) is software that allows users to store, retrieve, and
manage data efficiently.
4. Advantages and Disadvantages of Database
Advantages:- Reduces data redundancy- Ensures data integrity and security- Allows multi-
user access
Disadvantages:- Costly setup and maintenance- Complexity for large systems
5. Features of Database- Data sharing- Reduced redundancy
- Data integrity- Security- Backup and recovery
6. What is Redundancy and Data Consistency?
Redundancy: Repetition of the same data.
Data Consistency: Ensures all users see the same updated data.
7. Name the DDL and DML Commands
DDL (Data Definition Language): CREATE, ALTER, DROP
DML (Data Manipulation Language): INSERT, UPDATE, DELETE, SELECT
8. What are Keys?
Keys are attributes used to uniquely identify rows and establish relationships between
tables.
9. Name all the Keys
Primary Key, Foreign Key, Candidate Key, Alternate Key, Unique Key, Composite Key, Super
Key
10. Difference between All Keys- Primary Key: Uniquely identifies a row, no NULLs-
Candidate Key: All possible unique keys-
Alternate Key: Candidate keys not chosen as primary-
Unique Key: Unique values, allows one NULL-
Foreign Key: Links two tables-
Composite Key: Made of multiple columns- \Super Key: Any key that uniquely identifies a
row
11. Use of Keys- Identify records uniquely- Enforce data integrity- Link related tables
12. Primary vs Unique Key-
Primary Key: Unique + No NULLs-
Unique Key: Unique + One NULL allowed
13. Primary Key vs Alternate Key vs Candidate Key-
Candidate Key: All possible unique identifiers-
Primary Key: Chosen from candidate keys-
Alternate Key: Remaining candidate keys
14. Difference between DROP and DELETE-
DROP: Deletes entire table and structure-
DELETE: Deletes rows only
15. Difference between ALTER and UPDATE-
ALTER: Modifies table structure-
UPDATE: Modifies table data
16. Types of Joins
Inner Join, Left Join, Right Join, Full Outer Join, Self Join, Cross Join
17. Equi Join vs Natural Join-
Equi Join: Uses = to match columns
Natural Join: Automatically joins on columns with the same name
18. Foreign Key Usage
Used to create relationships by referencing the primary key of another table
19. Difference between COUNT() and COUNT(*)-
COUNT(*): Counts all rows including NULLs-
COUNT(column): Counts non-NULL values
20. Degree and Cardinality-
Degree: Number of columns in a table-
Cardinality: Number of rows in a table
21. Tuples and Attributes- Tuple: A row in a table- Attribute: A column in a table
22. Use of GROUP BY and ORDER BY-
GROUP BY: Groups rows with same values-
ORDER BY: Sorts rows (ascending by default)
23. Default Sorting Order
Ascending (ASC) is the default
24. Use of LIKE Operator, _ and %- LIKE: Pattern matching- %: Matches any number of
characters
- _: Matches a single character
Example: LIKE 'A%' (starts with A)
25. Can GROUP BY be used with WHERE?
Yes. WHERE filters before grouping.
Example:
SELECT dept, COUNT(*) FROM emp
WHERE salary > 10000
GROUP BY dept;
26. Module for Python-SQL Interface
import [Link]
27. What is a Relation or Table?
A relation is a table in a database made of rows (tuples) and columns (attributes).
28. What is RDBMS?
Relational Database Management System stores data in related tables using keys.
JAVA
1. Features of Java- Object-Oriented- Platform Independent- Simple and Secure- Robust and
Portable- Multi-threaded
- High Performance
2. What is a Constructor?
A constructor is a special method used to initialize objects. Same name as class, no return
type.
3. Features of Constructor- Auto-called when object is created- Can be overloaded- No
return type- Initializes class members
4. Primitive Data Types
byte, short, int, long, float, double, char, boolean
5. Number of Primitive Data Types
- 8
6. Sizes of Data Types- byte: 1 byte- short: 2 bytes- int: 4 bytes- long: 8 bytes- float: 4 bytes-
double: 8 bytes- char: 2 bytes- boolean: 1 bit (JVM dependent)
7. What is Assertion?
Used to test assumptions. If false, throws error.
Syntax: assert expression;
8. What is a Function?
Functions in Java are called methods. They perform tasks when called.
9. Types of Functions- Predefined- User-defined- Static- Instance- Recursive
10. What is an Array?
A collection of same-type elements stored in contiguous memory locations.
11. How to Declare an Array?
int[] arr = new int[5];
12. What are Wrapper Classes?
Convert primitives into objects.
Examples: Integer, Double, Boolean, Character
13. While vs Do-While Loop- While: Condition checked before loop- Do-While: Runs at least
once; condition checked after
14. What are Selection Statements?
Used for decision making: if, if-else, switch
15. What is an Infinite Loop?
A loop that never ends.
Example: while(true) { }
16. What are Threads?
Threads are lightweight processes that allow multitasking in Java.