0% found this document useful (0 votes)
5 views

Database Programming

A summary of the course, Data base programming for third year students.

Uploaded by

ekeochachuks
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Database Programming

A summary of the course, Data base programming for third year students.

Uploaded by

ekeochachuks
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

DBASE PLUS MINI NOTES

Chapter1 summary
dBase was one of the first database management systems for microcomputers. The four major
components of dBase management systems are the core database engine, form engine, query
system and the programming language that ties it all together.
In 15 years dBase has evolved from a command-driven MS-DOS environment to an
event-driven windows visual IDE.
dBase .dbf file is widely used in applications requiring a simple format to store structured data.
dBase object oriented features can be used to build applications like
1. Server based web application
2. Windows rich client application
3. Middleware application.

dBase uses Open Database Connectivity(ODBC) drivers to access


1. Most modern database engines such as Paradox, Ms Access, FoxPro.
2. data in database management systems - using SQL as a standard for accessing data.

Questions
1. Question: What are the four major components of dBase management systems?
a. Data manipulation, form design, query language, programming language
b. Core database engine, form engine, query system, programming language **
c. File storage, user interface, indexing system, scripting language
d. Table structure, form builder, report generator, graphical interface

2. Question: In what environment did dBase initially operate before evolving into an event-driven
Windows visual IDE?
a. Linux command line
b. MS-DOS command-driven environment **
c. macOS graphical interface
d. Unix-based terminal

3. Question: What type of file format is widely used in applications requiring a simple structure to
store structured data in dBase?
a. .csv
b. .txt
c. .dbf **
d. .xml

4. Question: What can dBase's object-oriented features be used to build?


a. Mobile applications
b. 3D games
c. Server-based web applications, Windows rich client applications, Middleware applications **
d. Artificial intelligence models

5. Question: Which technology does dBase utilize to access data in most modern database
engines such as Paradox, MS Access, and FoxPro?
a. Java Database Connectivity (JDBC)
b. File Transfer Protocol (FTP)
c. Open Database Connectivity (ODBC) drivers **
d. Structured Query Language (SQL)

6. Question: In dBase, what is the primary purpose of the core database engine?
a. Generating reports
b. Executing queries
c. Managing the data storage and retrieval **
d. Designing forms

7. Question: What language is used as a standard for accessing data in dBase when using
Open Database Connectivity (ODBC) drivers?
a. Python
b. C++
c. Structured Query Language (SQL) **
d. Java

8. Question: Which component of dBase is responsible for handling the visual design and layout
of user interfaces?
a. Query system
b. Form engine **
c. Programming language
d. Core database engine

9. Question: What is the primary purpose of the query system in dBase?


a. Storing data
b. Designing forms
c. Executing database queries **
d. Managing programming logic

10. Question: How has dBase evolved over 15 years in terms of its user interface?
a. It transitioned from a graphical interface to a command-driven environment.
b. It remained a command-driven MS-DOS environment.
c. It evolved from a command-driven MS-DOS environment to an event-driven Windows
visual IDE. **
d. It shifted from a Linux-based terminal to an MS-DOS command-driven environment.

11. Question: Which of the following is NOT a possible use of dBase's object-oriented features?
a. Server-based web application
b. Windows rich client application
c. Mobile application development **
d. Middleware application

12. Question: What role does the programming language in dBase play in the overall system?
a. Managing data storage
b. Form design
c. Tying together core components **
d. Handling visual interface layout

13. Question: Which file format is widely used in applications requiring a simple format to store
structured data in dBase?
a. .xml
b. .csv
c. .txt
d. .dbf **

14. Question: What does dBase use as a standard for accessing data when utilizing Open
Database Connectivity (ODBC) drivers?
a. File Transfer Protocol (FTP)
b. Java Database Connectivity (JDBC)
c. Structured Query Language (SQL) **
d. Python

15. Question: In dBase, what technology does it use to access data in most modern database
engines such as Paradox, MS Access, and FoxPro?
a. Java Database Connectivity (JDBC)
b. Open Database Connectivity (ODBC) drivers **
c. Structured Query Language (SQL)
d. File Transfer Protocol (FTP)

Chapter 6 summary
Data Type
Data types are crucial for informing the compiler or translator about the nature of the data a
variable holds, facilitating proper handling and processing within the program
There are 3 classes of data types and they are COMMON, DATABASE-SPECIFIC, and
PROGRAMMING data types.
1. Common Data Types:
a. Numeric: Represents integer and floating-point numbers.
b. String: A sequence of characters, with the possibility of being empty or null. The
maximum length varies based on storage location.
c. Logical/Boolean: Holds True, False, or Null values.
d. Date: Date data enclosed in curly braces.
e. Null: Represents a non-existent or undefined value, distinct from blank or zero.

2. Database-Specific Data Types:


a. Memo: Essentially a very long character string, with dBASE PLUS tables having
a maximum limit of 254 characters, while memo fields accept unlimited
characters.
b. Binary/OLE: Typically designed to be manipulated by programs outside of dBASE
PLUS.

3. Programming Data Types:


a. Function Pointers: A distinct data type that can be assigned to variables or
passed as parameters. The function's name serves as a pointer to that function.
b. Codeblock: Enables the creation of compiled code, holding code without needing
a separate program. It comes in two forms: Expression and Statement
Codeblocks.
c. Object Reference: A data type that refers to an object.

Questions

Q1: What does the Numeric data type represent?


A) Only integers
B) Only floating-point numbers
C) Both integers and floating-point numbers **
D) Only characters

Q2: What is the purpose of the Logical/Boolean data type?


A) Representing dates
B) Storing character sequences
C) Holding True, False, or Null values **
D) Storing non-existent values

Q3: How is the Date data type represented?


A) In square brackets
B) Enclosed in curly braces **
C) Using quotation marks
D) With a leading zero
Q4: When would you use the Null data type?
A) To represent a non-existent value **
B) For storing only integers
C) When working with binary data
D) To store floating-point numbers

Q5: What is the maximum character limit for Memo fields in dBASE PLUS tables?
A) 128 characters
B) 254 characters **
C) Unlimited characters
D) 512 characters

Q6: What is the primary purpose of Binary/OLE data types in databases?


A) Storing dates
B) Handling compiled code
C) Manipulation by external programs **
D) Representing True or False values

Q7: What does a Function Pointer data type refer to?


A) A type that holds only integers
B) A reference to an object
C) A distinct data type assigned to variables or passed as parameters **
D) A sequence of characters with a maximum length

Q8: In what ways can Codeblock data type come?


A) Only as Expression Codeblocks
B) Only as Statement Codeblocks
C) Both as Expression and Statement Codeblocks **
D) As Function Codeblocks

Q9: What does an Object Reference data type refer to?


A) A data type for handling compiled code
B) A type for representing dates
C) A reference to an object **
D) A data type for storing True or False values

Q10: Which class of data types is specifically designed for databases?


A) Common Data Types
B) Database-Specific Data Types **
C) Programming Data Types
D) Numeric Data Types

Q11: What is the purpose of the Null data type?


A) Storing non-existent values **
B) Representing dates
C) Handling compiled code
D) Storing character sequences

Q12: What is the main characteristic of the Memo data type?


A) Holds True, False, or Null values
B) Represents a very long character string **
C) Refers to an object
D) Represents only integers

Q13: What is the primary use of the codeblock data type?


A) Storing dates
B) Handling compiled code **
C) Representing character sequences
D) Holding True, False, or Null values

Q14: Which data type can be assigned to variables or passed as parameters using the
function's name as a pointer?
A) Logical/Boolean
B) Function Pointers **
C) Object Reference
D) Codeblock

Q15: What is the maximum length of a String data type?


A) Fixed at 254 characters
B) Unlimited characters
C) Varies based on storage location **
D) Limited to 128 characters

Q16: Which data type represents a sequence of characters with the possibility of being empty or
null?
A) Numeric
B) Date
C) String **
D) Logical/Boolean

Q17: What does the Object Reference data type refer to in programming?
A) A data type for handling compiled code
B) A reference to an object **
C) A type for representing dates
D) A data type for storing True or False values
Q18: Which Codeblock data type allows the creation of compiled code without needing a
separate program?
A) Function Codeblocks
B) Expression Codeblocks
C) Statement Codeblocks
D) Object Codeblocks

Q19: In which class of data types would you find the Memo data type?
A) Common Data Types
B) Database-Specific Data Types **
C) Programming Data Types
D) Numeric Data Types

20: What is the primary purpose of the Logical/Boolean data type?


A) Storing dates
B) Holding True, False, or Null values **
C) Handling compiled code
D) Storing non-existent values

Variables
Variables is a symbolic name that refers to a memory location that is used to store data.
Memory variable is a temporary storage location. It is used to hold data from a table field while it
is altered. It is used to hold values entered by a user until they can be processed, also to hold
data used in many programs and storage of constants frequently in use.
RELEASE, RELEASE ALL and CLEAR ALL are commands used to conserve memory space by
forcing variables that are active to leave the memory.
The CLEAR ALL releases and also closes open files. RELEASE ALL releases variables without
closing files. And the RELEASE is used for specified variables.
Scope of a variable
Private: A private variable can only be accessed in the module where it is initialized and its
subordinate modules. They are available to programs in which they are created and programs
called by the creating program. By default all variables in DBL initialized without a scope are
private. They automatically clear when program execution is complete.
Public: public variables are available to all programs, no matter where they are initialized.They
are sometimes referred to as global variables. they are not automatically cleared when the
program ends, they can be released only by RELEASE and CLEAR ALL commands. By default
all variables initialized in the command window are public.
Local: Local variables are declared as memory variables and they are accessed only in the
subprogram where they are declared.
Static: static variables are memory variables which are declared local in visibility but public in
duration. That is, they are visible only in subprograms where they are declared but are not
automatically cleared when the subprogram ends.they are released using the CLEAR MEMORY
command.
Questions

1. What is the primary purpose of a variable in programming?


- A) To hold data in a temporary storage location **
- B) To execute commands
- C) To close open files
- D) To create subprograms

2. When is a memory variable typically used in programming?


- A) To store constants
- B) To alter table fields **
- C) To clear memory space
- D) To close programs

3. Which command is used to release variables without closing files?


- A) RELEASE
- B) RELEASE ALL **
- C) CLEAR ALL
- D) CLEAR MEMORY

4. What is the purpose of the RELEASE command?


- A) To close open files
- B) To release specified variables **
- C) To conserve memory space
- D) To declare local variables

5. How does CLEAR ALL differ from RELEASE ALL in memory conservation?
- A) CLEAR ALL releases specified variables
- B) RELEASE ALL closes open files
- C) CLEAR ALL releases and closes open files **
- D) RELEASE ALL conserves memory space

6. In the context of variables, what does the scope determine?


- A) Memory space
- B) Variable names
- C) Accessibility **
- D) Data types

7. What is the default scope of variables initialized in dBASE PLUS without specifying a scope?
- A) Public
- B) Local
- C) Private **
- D) Static
8. How are private variables different from public variables in terms of accessibility?
- A) Private variables are accessible globally
- B) Public variables are only accessible in the creating program **
- C) Private variables are accessible in all programs
- D) Public variables are automatically cleared on program completion

9. What action is required to release public variables in a dBASE PLUS program?


- A) CLEAR ALL
- B) RELEASE ALL **
- C) CLEAR MEMORY
- D) RELEASE

10. What characterizes local variables in programming?


- A) Accessed globally
- B) Declared as memory variables **
- C) Released using RELEASE command
- D) Automatically cleared on program completion

11. Which command is used to release static variables in dBASE PLUS?


- A) CLEAR ALL
- B) RELEASE
- C) CLEAR MEMORY **
- D) RELEASE ALL

12. What is the duration of public variables in dBASE PLUS?


- A) Cleared on program completion
- B) Local to subprograms
- C) Accessed globally **
- D) Declared as memory variables

13. When is a memory variable used to hold data from a table field?
- A) During memory release
- B) While processing user-entered values **
- C) To alter constants
- D) In global scope only

14. What distinguishes static variables in terms of visibility and duration?


- A) Local in visibility, cleared on program completion **
- B) Public in visibility, cleared on program completion
- C) Global in visibility, not automatically cleared
- D) Local in visibility, public in duration

15. Which command is used to clear memory space in dBASE PLUS and close open files?
- A) CLEAR MEMORY
- B) RELEASE ALL
- C) RELEASE **
- D) CLEAR ALL

16. What is the primary function of a static variable in programming?


- A) To store constants
- B) To conserve memory space **
- C) To hold data from table fields
- D) To retain its value beyond subprogram execution

17. Which command is used to clear all memory and release specified variables in dBASE
PLUS?
- A) RELEASE
- B) RELEASE ALL
- C) CLEAR ALL
- D) CLEAR MEMORY **

18. In dBASE PLUS, what does a public variable become after program execution is complete?
- A) Cleared automatically **
- B) Local variable
- C) Null variable
- D) Global variable

19. How are local variables different from public variables in terms of accessibility?
- A) Local variables are accessible globally
- B) Public variables are only accessible in the creating program
- C) Local variables are accessible only in the subprogram where declared **
- D) Public variables are accessed in all subprograms

20. When is the CLEAR MEMORY command typically used in dBASE PLUS?
- A) To release public variables
- B) To clear all memory and close open files **
- C) To declare local variables
- D) To alter table fields

Chapter 8 summary
Input and output statements
A major way of data entry in dBASE plus is done using the form-based or the dBASE plus data
objects. Input statements include the GET, INPUT, READ, ACCEPT commands. while READ is
used for reading data from tables, GET, ACCEPT, and INPUT are used for interactive user input,
with ACCEPT and INPUT providing additional capabilities for displaying prompts.
? and ?? commands; the LIST command and DISPLAY command are commands to output
values or write to the command window.
? command is used to display output to the next line of the current output device.
?? command is used to display output to the current cursor location.
LIST command displays records from the current table in the result pane of the
Command window without pausing(continuously until complete). The scope of LIST is ALL.
DISPLAY command displays records from the current table in the result pane of the
command window but pauses after each screenful of information. The scope of DISPLAY is
NEXT 1
Because LIST does not pause between screens, it is more appropriate to use when directing
output to a file or printer.

The WAIT and CLEAR commands


The WAIT command halts program execution temporarily, and resumes execution when any key
is pressed.
The CLEAR command is used to clear the command window.

Questions
1. Which commands are considered input statements in dBASE plus for data entry?
a. ? and ??
b. GET, INPUT, READ, ACCEPT **
c. LIST and DISPLAY
d. WAIT and CLEAR

2. What is the purpose of the READ command in dBASE plus?


a. Reading data from tables **
b. Displaying output to the next line
c. Clearing the command window
d. Pausing program execution temporarily

3. Which command is used to display output to the current cursor location in dBASE plus?
a. LIST
b. DISPLAY
c. ?
d. ?? **

4. What is the scope of the LIST command in dBASE plus?


a. NEXT 1
b. ALL **
c. Displaying output to the next line
d. Displaying output to the current cursor location
5. When is the WAIT command used in dBASE plus?
a. Pausing program execution temporarily **
b. Clearing the command window
c. Reading data from tables
d. Displaying output continuously until complete

6. Which command is more appropriate for directing output to a file or printer in dBASE plus?
a. LIST **
b. DISPLAY
c. ACCEPT
d. INPUT

7. What does the DISPLAY command do in dBASE plus?


a. Clears the command window
b. Pauses after each screenful of information **
c. Reads data from tables
d. Displays output continuously until complete

8. How does the ? command differ from the ?? command in dBASE plus?
a. ? displays output to the next line, while ?? displays output to the current cursor location. **
b. ?? displays output to the next line, while ? displays output to the current cursor location.
c. Both ? and ?? display output to the next line.
d. Both ? and ?? display output to the current cursor location.

9. Which commands are used for interactive user input in dBASE plus?
a. LIST and DISPLAY
b. ? and ??
c. WAIT and CLEAR
d. GET, INPUT, READ, ACCEPT **

10. What is the primary purpose of the WAIT command in dBASE plus?
a. Displaying output to the next line
b. Clearing the command window
c. Pausing program execution temporarily**
d. Reading data from tables

11. Which command is used to clear the command window in dBASE plus?
a. ??
b. WAIT
c. CLEAR**
d. DISPLAY

12. In dBASE plus, which command is used to display records from the current table
continuously until complete?
a. LIST**
b. DISPLAY
c. ??
d. ACCEPT

13. What is the scope of the DISPLAY command in dBASE plus?


a. ALL
b. NEXT 1**
c. Pausing after each screenful of information
d. Continuously until complete

14. Which command is suitable for displaying output to the current cursor location in dBASE
plus?
a. LIST
b. DISPLAY
c. ?**
d. ??

15. How does the LIST command behave in terms of pausing between screens in dBASE plus?
a. It pauses after each screenful of information.
b. It does not pause between screens. **
c. It pauses continuously until complete.
d. It pauses only for the first screenful of information.

16. What is the primary purpose of the INPUT command in dBASE plus?
a. Displaying output to the next line
b. Clearing the command window
c. Reading data from tables
d. Providing interactive user input **

17. Which command is used to display output to the next line of the current output device in
dBASE plus?
a. DISPLAY
b. LIST
c. ??
d. ACCEPT
e. None of the above **

18. What is the purpose of the ACCEPT command in dBASE plus?


a. Displaying output to the current cursor location
b. Reading data from tables
c. Providing additional capabilities for displaying prompts **
d. Pausing program execution temporarily
19. Which command is used to halt program execution temporarily in dBASE plus?
a. READ
b. WAIT **
c. INPUT
d. CLEAR

20. When is the READ command in dBASE plus typically used?


a. For providing additional capabilities for displaying prompts
b. For reading data from tables **
c. For displaying output continuously until complete
d. For clearing the command window

Chapter 9 summary
Traditionally, program execution is sequential, that is statements are executed strictly based on
the physical arrangement of the statements in the program.

Conditional control structures


conditional control structures chooses one of several sets of statements to execute based on
the value of a particular logical expression. Logical expressions are expressions that evaluate to
TRUE or FALSE. Conditional control structures could either be single-way, double-way or
multiple way. dBASE Plus supports two conditional control structures, and they are IF …ENDIF
and DO CASE… ENDCASE.

Loop control structures


Loop control structure allows the execution of a block of code, a specific number of times, as
long as the logical expression is true. Loops are sometimes referred to as iteration or repetition.
dBASE plus supports the following loops:
● DO WHILE … ENDDO : This structure executes the statements between DO WHILE
and ENDDO as long as the specified logical expression is true.
● FOR … ENDFOR : This structure executes the statements between FOR and ENDFOR,
the number of times as specified by the FOR statement.
● DO … UNTIL : This structure executes the statements between DO and UNTIL as long
as the specified logical expression is false. It executes at least once, even when the
condition is initially through.
● SCAN … ENDSCAN : This construct is often used for scanning through a collection or
data structure. The code within the "SCAN" block is executed for each element of the
collection.

Questions
1. What is the purpose of the IF ... ENDIF structure in dBASE Plus?
- A) Single-way conditional execution **
- B) Multiple-way conditional execution
- C) Loop iteration
- D) Error handling

2. How many conditional control structures does dBASE Plus support?


- A) One
- B) Two **
- C) Three
- D) Four

3. In dBASE Plus, what does the DO CASE ... ENDCASE structure allow you to do?
- A) Loop through a collection
- B) Execute a block of statements based on a logical expression **
- C) Handle errors
- D) Perform a specific number of iterations

4. Which loop structure in dBASE Plus executes a block of statements as long as a specified
logical expression is true?
- A) FOR ... ENDFOR
- B) DO ... UNTIL
- C) SCAN ... ENDSCAN
- D) DO WHILE ... ENDDO **

5. What is the purpose of the FOR ... ENDFOR loop in dBASE Plus?
- A) Single-way conditional execution
- B) Multiple-way conditional execution
- C) Loop iteration a specific number of times **
- D) Execute statements until a logical expression is true

6. The DO ... UNTIL structure in dBASE Plus executes the statements between DO and UNTIL
as long as the specified logical expression is:
- A) True
- B) False **
- C) Undefined
- D) Both A and B

7. How is the SCAN ... ENDSCAN construct in dBASE Plus commonly used?
- A) Single-way conditional execution
- B) Multiple-way conditional execution
- C) Loop iteration through a collection **
- D) Error handling
8. Which loop structure ensures that the block of statements is executed at least once, even if
the condition is initially true?
- A) DO ... UNTIL **
- B) FOR ... ENDFOR
- C) DO WHILE ... ENDDO
- D) SCAN ... ENDSCAN

9. What term is often used to describe loops in programming?


- A) Branching
- B) Iteration **
- C) Switching
- D) Sequencing

10. The DO WHILE ... ENDDO structure in dBASE Plus is an example of a:


- A) Single-way conditional structure
- B) Multiple-way conditional structure
- C) Loop control structure **
- D) Error handling structure

11. What is the primary purpose of the DO CASE ... ENDCASE structure in dBASE Plus?
- A) Loop iteration
- B) Single-way conditional execution
- C) Multiple-way conditional execution **
- D) Error handling

12. Which loop structure in dBASE Plus is suitable for iterating through a fixed range of values?
- A) DO WHILE ... ENDDO
- B) FOR ... ENDFOR **
- C) DO ... UNTIL
- D) SCAN ... ENDSCAN

13. The FOR ... ENDFOR structure in dBASE Plus specifies the number of iterations based on:
- A) Logical expression
- B) Fixed range of values **
- C) Error conditions
- D) Dynamic user input

14. In the DO ... UNTIL structure, when does the loop execution stop?
- A) When the specified logical expression is true **
- B) When the specified logical expression is false
- C) When the loop reaches the maximum allowed iterations
- D) When an error occurs
15. What is the primary purpose of the SCAN ... ENDSCAN construct in dBASE Plus?
- A) Loop iteration
- B) Single-way conditional execution
- C) Multiple-way conditional execution **
- D) Error handling

You might also like