Databases MCQ Flashcards

1
Q

What is Data?

A

A collection of facts and figures that can be processed to produce info

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a database?

A

a collection of related data designed to meet the information needs of an organisation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

DBMS

A

a database management system is the software that manages and controls access to the database.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Database application

A

a program that interacts with the database at some point in its execution

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Database system

A

a collection of application programs that interacts with the database and the DBMS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Limits of file Based approach

A

Separation and Duplication of data
Data Dependence
Incompatible file Formats
Fixed queries

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Entity

A

a distinct object in the org that is to be represented in the database (person,place,thing)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

attribute

A

property that describes some aspect of the object we wish to record

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

relationship

A

an association between entities

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Where is computer data stored?

A

In main memory (RAM)
In secondary memory (USB,Flash drives etc)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Why not always use RAM?

A

RAM is volatile, as it needs power to store and process data meaning when power is witched off, data is lost.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Reasons to store in disk/hard memory

A

Capacity
Volatility

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Implications of 2 types of memory

A
  1. What data is stored
  2. How it is stored
  3. Performance of a DBMS
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Meta Data

A

Data that describes other data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Three types of data

A

Processing Data,
Programs,
Meta data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Why are there many application programming languages

A

Application type,
language design,
data typing,
data independece

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Strongly typed

A

In strongly typed languages, type constraints are strictly enforced by the compiler or runtime system (Java, C#, and Best eg: Arduino int,long,char)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Weakly typed

A

In weakly typed languages, type constraints are more relaxed, allowing for implicit type conversions and flexible operations between different types.(JavaScript, PHP, and Perl.)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Procedural language

A

program lists step by step the sequence of processing instructions, C, Java,Python

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Non-procedural

A

the program states the logic required to isolate
the data, but not a procedure on how to do it. MYSQL

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

MYSQL is

A

Weakly typed and non procedural primarily

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Design objectives in DBMS programs

A
  1. Implementation of logical and physical data dependence.
  2. Data sharing
  3. Strict control over data
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

Physical DI

A

(DI = data independece)independence from the physical hardware

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

Advantage of physical DI

A

Allows the program to respond to changes to any physical element within the system

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

Logical DI

A

The ability to change the logical structure of the database without affecting the application programs that access the data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

SELECT Name,address
FROM Students;
Is this a logically independent query?

A

Yes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

Why is MYSQL non-procedural?

A

The SQL programmer just indicates what data is required
rather than how to get it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

What’s the problem with data sharing?

A

if data is shared it must have a common definition to all users/applications

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

Two sections of MYSQL

A

Data Definition
Data Manipulation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

Data definition (DDL)

A

records structures and attribute data types.(INSERT,UPDATE,CREATE)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

Data Manipulation (DM)

A

WHERE/FROM/SELECT etc.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

Order of a full sample query

A

SELECT
FROM
WHERE
GROUP BY
HAVING
ORDER BY

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

Impact of Restrict data structure to a table

A

Makes it common to all users
No need for output formatting statements
User operations simplified

34
Q

4 Basic Properties of Relational Model

A
  1. Data only stored in table
  2. System can use multiple tables
  3. Data in diff tables can be linked using relationships.
  4. Each row in a table is unique and you must declare a primary key
35
Q

Terminology

A

Relation = Table = File
Tuple = Row = Record
Attribute = Column = Field

36
Q

Flat files

A

Flat file = data files that contain records with no structured relationships

37
Q

Data Model

A

Data Model = integrated collection of concepts for describing and manipulation data,relationships between data and constraints on the data in an org.
Purpose is to represent data and make data understandable

38
Q

Components of data model

A

Structural part
Manipulative Part
Integrity Constraints

39
Q

Fortnite

A

Ninja

40
Q

Relational Data Model

A

divides info into logical subsets and places each subset in a separate table

41
Q

Relation/Table

A

Logical concept, not a representation of the physical structure.

42
Q

Domain

A

definition of the allowable set or range of values allowed in an attribute

43
Q

Primary Key

A

primary key constraints will uniquely identify each record in a table.
they must contain unique values and can’t contain null values.
there can be only one primary key in a table eg StudentNo

44
Q

Candidate key

A

when more than one combination of attributes uniquely identify a row.

45
Q

Alternate key

A

Candidate keys are unique but also minimal in that
they cannot be reduced. That is, no subset of the key can
be a candidate key itself (extra attribute(s) are
redundant).

46
Q

Why is key uniqueness important

A

Search Mechanism
Prevents duplication,waste of storage
Count function
Implement relationships (JOINS)

47
Q

Referential Integrity

A

There can be no unmatched foreign key values

48
Q

Required Fields

A

Marked as NOT NULL

49
Q

Why use DBMS

A

Data Management & sharing
Data Integrity
Security
Recovery
Concurrency

50
Q

Alternatives to RDBMS

A

NoSQL
MongoDB
HADOOP

50
Q

DBA

A

Database Administrator manages and controls the DBMS tools

51
Q

Brief History

A

Big changes - 1992
Made - 1972
Maker - Donald D. Chamberlin
SQL 3 - 1999
Latest - SQL:2016 released

51
Q

SQL Dialects

A

MYSQL,SQLLite, Oracle,Ingres,MYSQL server, DB2

51
Q

Objectives of SQL

A

Portable
Create database and relation structures
Perform inserts,modifications,deletion
Perform Simple/Complex queries

52
Q

Reserved Words

A

fixed part of SQL and must be spelt as required and cannot be split across lines

52
Q

Portability

A

Ability to move code from one database installation to another.
Easiest eg: using ‘’ instead of “ “. as some dialects don’t support double quotes

53
Q

User-defined words

A

made up by user and represent names of database objects.

53
Q

BNF notation (kind of an aside?)

A

UPPER CASE -reserved words
lower case - user defined
| indicates choice
{} indicates required element
[] indicates optional element
… indicates optional repitition

54
Q

SELECT

A

query data in db

54
Q

UPDATE

A

updates data in a table

55
Q

INSERT

A

inserts data in table

55
Q

WHERE

A

filters rows

56
Q

DELETE

A

deletes data from table

57
Q

USE

A

specifies database to be used

57
Q

FROM

A

specifies table to be used

57
Q

HAVING

A

filters groups subject to some conditon. needs GROUP BY to work

58
Q

ORDER BY

A

specifies the order of the output

58
Q

AS

A

creates temporary column

58
Q

GROUP BY

A

forms groups of rows with same column value. isolates subsets

58
Q

DISTINCT

A

eliminates duplicates

59
Q

BETWEEN

A

creates a range of values between such a number and another number (BETWEEN 2000 AND 300)

59
Q

Mandatory queries

A

SELECT FROM

60
Q

IN

A

allows you to specify multiple values in a WHERE clause

60
Q

LIKE

A

search for a specified pattern in a column

61
Q

%sampleword%

A

looks for sequence of characters of any length containing sampleword

61
Q

_sampleword

A

looks for a match with only one character before sampleword

61
Q

sampleword_

A

looks for a match with only one character after sampleword

61
Q

IS NULL

A

checks if a value is NULL

62
Q

IS NOT NULL

A

checks for non null values

62
Q

Difference between WHERE and HAVING

A

WHERE: filters rows
HAVING: filters groups

63
Q

Subquery

A

Query inside a Query (SELECT inside a SELECT)
SELECT staffNo, fName, lName, position
FROM Staff
WHERE branchNo=(SELECT branchNo
FROM Branch
WHERE street = ‘163 Main St’)