Databases and Programming Languages
Databases, SQL terms, programming languages and common abbreviations. Open a topic to read its notes and practise it: each question shows whether you were right and why, as soon as you answer.
Topics: notes and practice
Database basics10 questions
A database is an organised collection of related data, stored so that it can be searched, updated and shared. The software that creates and manages it is a DBMS (Database Management System). MySQL, Oracle, MS Access, PostgreSQL and SQL Server are DBMS software. The person who looks after a database, its users and its security is the DBA (Database Administrator).
Tables and their parts
Most databases keep data in tables. A table is made of rows and columns.
| Everyday term | Formal term | Meaning |
|---|---|---|
| Table | Relation | The whole grid of data |
| Row | Record or tuple | All the details of one item |
| Column | Field or attribute | One kind of detail, such as Name |
- Degree is the number of columns. Cardinality is the number of rows. The heading row is not counted as a record.
- A schema is the design of the database: its tables, columns and links.
- A data dictionary stores the details about the data, such as column names and types.
Keys
| Key | What it does |
|---|---|
| Primary key | Identifies each record uniquely. It cannot repeat and cannot be empty (null). A table has one. |
| Super key | Any set of columns that identifies a record uniquely. |
| Candidate key | Any column or set of columns that could serve as the primary key. The one chosen becomes the primary key. |
| Alternate key | A candidate key not chosen as the primary key. |
| Composite key | A primary key made of two or more columns together. |
| Foreign key | A column that refers to the primary key of another table. It links the tables, and its values may repeat. |
Why a DBMS is better than separate files
It reduces data redundancy (the same data repeated in many places), avoids data inconsistency (copies that disagree), improves data integrity (accuracy), allows many users to share data safely and protects it with passwords and permissions. Normalisation is the step-by-step splitting of tables to remove redundancy.
Normal forms and the ER model
- 1NF: no repeating groups, and each cell holds one value.
- 2NF: 1NF with no partial dependency, meaning no column depends on only part of a composite key.
- 3NF: 2NF with no transitive dependency, meaning no non-key column depends on another non-key column.
- An ER diagram (Entity-Relationship) plans a database: an entity is drawn as a rectangle, an attribute as an oval and a relationship as a diamond.
- Relationships are one-to-one, one-to-many and many-to-many. One customer placing many orders is one-to-many.
Types of database
- Hierarchical: a tree. Each child record has one parent.
- Network: a record can have more than one parent.
- Relational (RDBMS): data in tables linked by keys. The most common type today. E. F. Codd proposed the relational model in 1970.
- Object-oriented: stores data as objects.
- Distributed: one database spread over computers at different places.
- NoSQL: non-table databases for very large and varied data.
A data warehouse stores years of data from many sources for analysis, and data mining searches it for patterns.
Problem 1. A table of train bookings has 250 rows and 9 columns, plus a heading row. A new column is added and 30 rows are deleted. What are its degree and cardinality? (a) 10 and 220 (b) 9 and 220 (c) 10 and 221 (d) 9 and 280
Answer: (a) 10 and 220
Degree counts columns: 9 + 1 = 10. Cardinality counts records: 250 − 30 = 220. The heading row only names the columns and is not a record, so 221 is wrong.
Practise this topic10 questions, each with its solution
SQL and query terms10 questions
SQL (Structured Query Language) is the standard language for working with a relational database. It does not run programs. It asks the database for data, or tells it to store or change data. It is a fourth generation language, because it states what is wanted and not how to find it.
Groups of SQL commands
| Group | Full name | Commands |
|---|---|---|
| DDL | Data Definition Language | CREATE, ALTER, DROP, TRUNCATE |
| DML | Data Manipulation Language | INSERT, UPDATE, DELETE |
| DQL | Data Query Language | SELECT |
| DCL | Data Control Language | GRANT, REVOKE |
| TCL | Transaction Control Language | COMMIT, ROLLBACK, SAVEPOINT |
Some books put SELECT under DML. If an exam gives DQL as a choice, choose it for SELECT.
What each command does
- CREATE makes a new table. ALTER changes its structure, for example by adding a column. DROP removes the table with all its data.
- TRUNCATE empties all rows but keeps the table. DELETE removes chosen rows, using WHERE. UPDATE changes values in existing rows. INSERT adds new rows.
- GRANT gives a user a permission and REVOKE takes it back.
- COMMIT saves the changes of a transaction permanently. ROLLBACK undoes the changes made since the last COMMIT.
Parts of a SELECT query
A query reads like this: SELECT Name FROM Student WHERE Class = 10 ORDER BY Name;
- SELECT names the columns wanted.
*means all columns. - FROM names the table.
- WHERE keeps only the rows that meet a condition.
- ORDER BY sorts the result, smallest first unless DESC is given.
- GROUP BY collects rows with the same value, usually to count or total them.
- DISTINCT removes repeated values from the result.
- JOIN combines rows of two tables through a common column, normally primary key and foreign key.
- HAVING filters groups after GROUP BY, while WHERE filters rows before grouping.
- LIKE matches patterns, with
%for any number of characters and_for exactly one. BETWEEN gives an inclusive range, and AND, OR and IN combine or list conditions. - Functions: COUNT counts rows, SUM adds, AVG gives the average, MAX and MIN give the largest and smallest.
Problem 2. The table EMP has the salaries of five employees, in thousands: 20, 35, 35, 50, 20. How many rows does SELECT DISTINCT Salary FROM EMP return, and what does SELECT MAX(Salary) return? (a) 3 rows, 50 (b) 5 rows, 50 (c) 3 rows, 35 (d) 4 rows, 20
Answer: (a) 3 rows, 50
DISTINCT keeps one copy of each different value: 20, 35 and 50, which is 3 rows. MAX gives the largest value, 50.
Practise this topic10 questions, each with its solution
Language generations10 questions
A program is a set of instructions that tells a computer what to do. The language it is written in decides how much the computer must translate.
| Generation | Language | Feature |
|---|---|---|
| First (1GL) | Machine language | Binary 0s and 1s. The only language the CPU runs directly. Fast, but hard to write. |
| Second (2GL) | Assembly language | Short codes called mnemonics, such as ADD. Needs an assembler. |
| Third (3GL) | High-level languages | English-like words. C, Java, Python, FORTRAN, COBOL, Pascal, BASIC. |
| Fourth (4GL) | Very high-level languages | Say what result is wanted. SQL and report generators. |
| Fifth (5GL) | AI languages | Problem solving by rules and logic. Prolog. |
- Machine and assembly languages are low-level and machine dependent: a program for one type of processor does not run on another.
- High-level languages are machine independent (portable). Only the translator changes from one computer to another.
Translators
| Translator | Converts | Note |
|---|---|---|
| Assembler | Assembly language to machine code | Used for 2GL |
| Compiler | The whole high-level program to machine code at once | Reports the errors found in the whole program. Runs fast afterwards. |
| Interpreter | One statement at a time, and runs it | Stops at the first error. Slower in running. |
- The program a programmer writes is source code. The machine-language program a compiler produces is object code.
- A compiler translates the whole program and then reports the errors found in it. After a successful compile, the object code can be run again without recompiling unless the source changes.
- C, C++ and Pascal are normally compiled. Python and JavaScript are normally interpreted. Java is compiled into bytecode, which a Java Virtual Machine (JVM) then runs, and this is why Java programs run on many systems.
- A linker joins object code of several parts into one program. A loader places it in memory to run.
- A syntax error breaks the rules of the language. A logical error gives wrong results although the program runs.
Problem 3. A student's program lists a grammar mistake on line 6 and another on line 18. The tool stops at line 6 and shows only that one. Which translator is it, and in which generation of language is it used? (a) compiler, second (b) assembler, third (c) interpreter, third (d) interpreter, first
Answer: (c) interpreter, third
Stopping at the first error is how an interpreter behaves. A compiler would list both errors. Interpreters translate high-level languages, which are the third generation. An assembler belongs to the second generation.
Practise this topic10 questions, each with its solution
Popular programming languages10 questions
The questions ask the use of a language, or who made it and when. Learn the pairs.
| Language | Made by | Year | Main use |
|---|---|---|---|
| FORTRAN | John Backus and a team at IBM | 1957 | Scientific and engineering calculation. Name is Formula Translation. |
| LISP | John McCarthy | 1958 | Artificial intelligence |
| COBOL | A committee of experts, with Grace Hopper a leading contributor | 1959 | Business and banking records |
| BASIC | John Kemeny and Thomas Kurtz, Dartmouth College | 1964 | Easy language for beginners |
| Pascal | Niklaus Wirth | 1970 | Teaching structured programming |
| C | Dennis Ritchie, Bell Labs | 1972 | System programs. UNIX was written in C. |
| C++ | Bjarne Stroustrup | 1979 as C with Classes, named C++ in 1983 | C with objects and classes |
| Python | Guido van Rossum | 1991 | Data work, AI, scripts, simple readable code |
| Java | James Gosling, Sun Microsystems | 1995 | Programs that run on any system through the JVM |
| JavaScript | Brendan Eich, Netscape | 1995 | Making web pages interactive |
More names
- Ada was ordered by the US Department of Defense and is named after Ada Lovelace, regarded as the first programmer.
- Logo teaches children programming by drawing with a turtle.
- Prolog is an artificial intelligence language based on logic.
- R is for statistics. Swift is Apple's language for its devices. Kotlin is a modern language used for Android apps.
Programming ideas
- Procedural languages, such as C and Pascal, build a program from procedures (functions).
- Object-oriented languages, such as C++, Java and Python, build it from objects that join data and actions. Their features include class, object, inheritance, encapsulation and polymorphism.
- An IDE (Integrated Development Environment) gives an editor, a translator and a debugger in one tool. Debugging is finding and removing errors in a program.
Problem 4. Which sequence lists the languages from the oldest to the newest? (a) COBOL, C, Java, Python (b) FORTRAN, COBOL, C, Java (c) C, FORTRAN, Java, Python (d) Pascal, FORTRAN, C, Java
Answer: (b) FORTRAN, COBOL, C, Java
The years are FORTRAN 1957, COBOL 1959, Pascal 1970, C 1972, Python 1991 and Java 1995. Choice (a) puts Java before Python, which is the wrong order, and (d) puts Pascal before FORTRAN.
Practise this topic10 questions, each with its solution
Web languages10 questions
A web page is a document that a browser shows. Three languages work together on most pages, and each has its own task.
HTML
HTML (HyperText Markup Language) gives a page its structure. It is a markup language, which means it labels content with tags. It is not a programming language, since it has no calculation or decisions. Tim Berners-Lee developed it, together with the World Wide Web and the first browser, at CERN. HTML files end in .html or .htm.
| Tag | Use |
|---|---|
h1 to h6 |
Headings, with h1 the largest |
p |
A paragraph |
a |
Anchor: a hyperlink, with the address in href |
img |
An image |
br |
A line break |
ul, ol, li |
Bulleted list, numbered list, list item |
table, tr, td |
A table, its row and its cell |
html |
The whole page |
head |
Information about the page |
title |
Text shown on the browser tab |
body |
The visible content |
<!-- --> |
A comment, not shown on the page |
HTML5 is the current version. Most tags come in pairs: an opening tag and a closing tag. The br and img tags stand alone.
CSS
CSS (Cascading Style Sheets) controls how a page looks: colours, fonts, spacing and layout. One external style sheet can be linked to many pages, so a single change updates the whole site. HTML says what is on the page and CSS says how it looks.
Scripting languages
- Client-side scripts run in the visitor's browser. JavaScript is the main one. It checks forms, shows alerts and changes the page without reloading it.
- Server-side scripts run on the web server and send the finished page to the browser. PHP, ASP and JSP are examples.
- XML (eXtensible Markup Language) describes and carries data. Unlike HTML, its tags are made up by the user, and it is not about how things look.
- DHTML (Dynamic HTML) joins HTML, CSS and scripting for moving, responsive pages.
Web terms
- HTTP carries web pages between server and browser. A URL is the address of a page, such as the protocol, the domain name and the file path.
- A browser (Chrome, Firefox, Edge, Safari) reads HTML and shows the page. A web server stores the pages.
Problem 5. A shop owner wants the price list page to turn the price red when a customer clicks a button, and to show the same red price colour on all pages. Which two languages are used, for the click and for the common colour in that order? (a) CSS and HTML (b) JavaScript and CSS (c) PHP and XML (d) HTML and JavaScript
Answer: (b) JavaScript and CSS
A click is handled by a script in the browser, which is JavaScript. A colour shared across all pages is set once in a style sheet, which is CSS. HTML only lays out the content, and XML describes data.
Practise this topic10 questions, each with its solution
Computer abbreviations and miscellaneous10 questions
Full forms are asked directly, and as odd-one-out items. Learn them in groups.
Programming and data
| Short form | Full form |
|---|---|
| ASCII | American Standard Code for Information Interchange |
| EBCDIC | Extended Binary Coded Decimal Interchange Code |
| BIOS | Basic Input Output System |
| COBOL | Common Business Oriented Language |
| FORTRAN | Formula Translation |
| BASIC | Beginner's All-purpose Symbolic Instruction Code |
| SQL | Structured Query Language |
| DBMS | Database Management System |
| RDBMS | Relational Database Management System |
| IDE | Integrated Development Environment |
| API | Application Programming Interface |
Internet and files
| Short form | Full form |
|---|---|
| HTML | HyperText Markup Language |
| XML | eXtensible Markup Language |
| CSS | Cascading Style Sheets |
| HTTP | HyperText Transfer Protocol |
| FTP | File Transfer Protocol |
| SMTP | Simple Mail Transfer Protocol |
| HTTPS | HyperText Transfer Protocol Secure |
| TCP/IP | Transmission Control Protocol / Internet Protocol |
| VPN | Virtual Private Network |
| URL | Uniform Resource Locator |
| DNS | Domain Name System |
| ISP | Internet Service Provider |
| Portable Document Format | |
| JPEG | Joint Photographic Experts Group |
| GIF | Graphics Interchange Format |
| PNG | Portable Network Graphics |
| MPEG | Moving Picture Experts Group |
Hardware and others
| Short form | Full form |
|---|---|
| GUI | Graphical User Interface |
| UPS | Uninterruptible Power Supply |
| USB | Universal Serial Bus |
| OCR | Optical Character Recognition |
| OMR | Optical Mark Recognition |
| MICR | Magnetic Ink Character Recognition |
| CPU | Central Processing Unit |
| RAM | Random Access Memory |
| ROM | Read Only Memory |
| SIM | Subscriber Identity Module |
| CMOS | Complementary Metal Oxide Semiconductor |
| LAN, MAN, WAN | Local, Metropolitan, Wide Area Network |
| WWW | World Wide Web |
Odd-one-out sets
- Compiler, interpreter, assembler are translators. A scanner, mouse or keyboard is an input device.
- HTTP, FTP, SMTP are protocols. JPEG, GIF, PNG are image formats. PDF is a document format.
- MySQL, Oracle, PostgreSQL are DBMS. Python, Java, C are programming languages.
- CREATE, ALTER, DROP are DDL. INSERT, UPDATE, DELETE are DML.
- ASCII uses 7 bits (128 characters), and extended ASCII uses 8 bits (256). Unicode covers the characters of all languages, including Indian scripts.
Problem 6. Find the odd one out: MySQL, Oracle, PostgreSQL, JavaScript. (a) MySQL (b) Oracle (c) PostgreSQL (d) JavaScript
Answer: (d) JavaScript
MySQL, Oracle and PostgreSQL are database management systems. JavaScript is a scripting language for web pages.
Practise this topic10 questions, each with its solution
Quick revision
| Topic | Fact to remember |
|---|---|
| Row, column | Record or tuple, field or attribute |
| Degree, cardinality | Columns, rows |
| Primary key | Unique and not null. Foreign key links to another table's primary key. |
| Tree database | Hierarchical. A record with many parents: network. |
| DDL, DML, DCL, TCL | CREATE ALTER DROP, INSERT UPDATE DELETE, GRANT REVOKE, COMMIT ROLLBACK |
| Compiler, interpreter | Whole program, report all errors. One line at a time, stop at the first error. |
| 1GL to 4GL | Machine, assembly, high-level, SQL |
| Languages | FORTRAN 1957 science, COBOL 1959 business, C 1972 Ritchie, Python 1991 van Rossum, Java 1995 Gosling |
| Web | HTML structure, CSS look, JavaScript behaviour, XML data |
| Full forms | ASCII, BIOS, URL, SMTP, JPEG, GIF are asked most |
Common mistakes
- Counting the heading row as a record. Records are the data rows only. Degree is the number of columns and cardinality the number of rows, and students swap them.
- Mixing DROP, DELETE and TRUNCATE. DROP removes the whole table, DELETE removes chosen rows, and TRUNCATE removes all rows but keeps the table.
- Thinking a foreign key must be unique. The primary key is unique. A foreign key may repeat, as one customer places many orders.
- Saying a compiler runs the program line by line. That is the interpreter. The compiler translates the whole program first.
- Calling HTML a programming language or giving CSS the structure. HTML is markup for structure, CSS is for appearance and JavaScript gives behaviour.
- Mixing up inventors and years. Python is by Guido van Rossum (1991), Java by James Gosling (1995), C by Dennis Ritchie (1972) and Pascal by Niklaus Wirth.
By ICE Academy · Updated 4 Dec 2026 · Found a mistake? Write to info@iceacademy.in
All 60 questions of this chapter on paper, with the answer key and solutions. Free: the first download asks for your name, phone number and email.