Wednesday, December 30, 2009

Prototype, prototypes, or archetypes is an early form (example) or a standard measure of an entity. In the field of design, a prototype was made before it is developed or created specifically for the development before it is made in the actual scale or mass-produced before


Prototype, prototypes, or archetypes is an early form (example) or a standard measure of an entity. In the field of design, a prototype was made before it is developed or created specifically for the development before it is made in the actual scale or mass-produced before

The entity is something that has a unique presence and distinct, although not necessarily in physical form. Abstraction, for example, is usually considered also as an entity. In developing the system, the entity is used as a model that describes the communication and internal processing of documents such as distinguishing the order processing.

Entities in informatics Data Analysis, Information and Database Entities

* A database can be modeled as
o a set of entities
o Relationship antarentitas
* The entity (entities) is an object whose existence can be distinguished from other objects
o The entity can be people, objects, places, events, concepts

+ Example:

# People: STUDENTS, LECTURERS, SUPPLIERS, sellers
# Objects: CAR, ENGINE, ROOM
# Place: STATE, VILLAGE, VILLAGES
# Genesis: SALES, REGISTER
# Concept: ACCOUNT, COURSE

* An entity has a number of attributes
o Example: a student has a name and address

* The set of entities are entities that share a set of similar attributes
o Example: a group of students, faculty, or companies.

The entity is something that exists and can carry out an activity and Dapa form a separate legal subject.

1. Explain the difference between:

a. A function prototype and a function definition

b. A calling function and called function

c. A formal and actual parameters

d. Local and global variables



2. Find the errors, if any, in the following function prototype.
a. void (function) void;

b. void function (void)

c. void function (a, b);

d. void function (int, int);

e. void function (int a, double b, int c);



3. Given the following function prototypes and variable declarations, find errors in the function calls:



void function1 (void);

function2 void (int n, double x);

void function3 (double, int, double, int);

function4 void (int a, int n, int b, int c):

int main ()

(

int a, b, c, d, e;

double r, s;

/ / other statements here

. . .

return 0;

)



a) function1 (a, b);

b) function2 (a, b);

c) function3 (r, a, s, b);

d) function4 (a, b, c, d e);

e) function1 ();

f) function3 (r, a, r, a);



4. Which of the following is a valid function prototype for a C program that receives two integer values and returns an integer number?

a. void function (int, int);

b. int function (int, int);

c. int function (void);

d. void function (int, void);



5. Find any errors in the following function prototype.

a. int sun (int x, y);

b. int sun (int x, int y);

c. void sun (void, void);

d. void sun (x int, y float);





6. Which of the statements below are TRUE regarding functions?

a. A function must be declared before it is used.

b. Only one value can be returned to the calling function using the return statement.

c. Every parameter listed in a function prototype must have its name and data type.

d. No return statement is required for functions whose return type is void.



7. Write down the function prototype for a function named Convert () which will accept floating-point one inches, and returns a floating-point to the calling function.



8. Define a function prototype for DiffSquare (), which accepts two integers, num1 and num2, and then return the difference of the squares of the two numbers. Then, write the function definition for DiffSquare ().



9. Given a function prototype: int functionX (int); Which of the following function call is VALID?

A. functionX ();

B. functionX (200);

C. y = functionX ();

D. y = functionX (200);



10. Given the following function prototype: int calc (int, int); Which of the following function call is VALID?

A. x = calc (5.3) * calc (3.7)% 2;

B. printf ( "% d", calc (10));

C. x = calc (10.5, 5);

D. calc (3.10);



11. Function Find () receives two integer values, determines and returns the biggest or the smallest values. Which of the following function prototypes is VALID?

A. void Find (int, int);

B. int Find (void, void);

C. int Find (int, int);

D. void Find ();



12. Even_or_odd function () accepts an integer number and returns a remainder of that number divided by 2.

a) Write a function prototype of even_or_odd ().

b) Write a function definition

c) Write the program segment in main () that read an integer num, even_or_odd function call () and display whether num is even or odd.



.



1. Write a function draw () that displays a solid square of character (* $ # & or etc) whose side is specified in integer parameter side and character is contained in character symbol parameters. For example, if side is 4, and symbol is *, the function displays the following:



* * * * * *

* * * * * *

* * * * * *

* * * * * *



2. Write a function integerPower (Base, Exponent) that returns the value of:





For example, integerPower (3.4) = 3 * 3 * 3 * 3. Assume the Exponent is a positive, non-zero integer and that base is an integer. The function integerPower () should use for or while to control the calculation. Do not use any math library functions.



3. Define a function hypotenuse () that calculates the length of the hypotenuse of a right triangle when the other two sides are given. Use this function in a program to determine the length of the hypotenuse for each of the triangles shown below. The function should take two double arguments and return the hypotenuse as a double.



Triangle Side 1 Side2

====== ==== ====

1 3.0 4.0

2 5.0 12.0

3 8.0 15.0



4. Write a program that inputs a series of integers and passes them one at a time to function even (), which uses the modulus operator (%) to determine whether an integer is even or odd. The function should take an integer argument and return true (1) if the integer is even and false (0) otherwise.



5. Write a program to generate:



• One random integer between 15 and 122

• One random uppercase alphabet

• One random lowercase alphabet

• Note: Given ASCII for character 'A' is 65 and 'a' is 97

• Example Output:



Random number is: 22

Random uppercase alphabet is: B

Random lowercase alphabet is: t

No comments:

Post a Comment

 
THANK YOU FOR VISITING