Cis 277 homework adt assignment
.docx
keyboard_arrow_up
School
Bergen Community College *
*We aren’t endorsed by this school
Course
277
Subject
Computer Science
Date
Jan 9, 2024
Type
docx
Pages
2
Uploaded by CommodoreDove3466
Cis 277 homework adt assignment
1. A scalar (atomic) data type is a data type that stores a singular atomic
value at a time. Considered non decomposable.
a) A boolean (bool) data type stores either 't' or 'f'
b) A character (char) data type stores character types that range from -128
to 127 or 0 to 255.
c) An integer (int) data type stores either a positive or a negative integer.
2. The three things that are determined by the data type of a variable is:
a)the legal value that it may assume.
b)how much storage is required
c)the operations that may be performed on it.
3. A data structure is a collection of cells and each cell holds a value that can
be either a scalar/atomic type or it can be a structure itself.
struct Grades
{
char Name[30];
int Numbergrade;
bool Pass;
}
4. Three different types of efficiencies are Stack ADTs, Physical structures,
and list ADT
5.An ADT is a set of objects together with a set of operations. They are
basically mathematical abstractions. Lists, sets and graphs are three
examples of ADTs.
6. encapsulation refers to keeping data, functions and objects separately
from the implementation and to not reveal internal details. It basically
prevents from exposing the methods used for the data.In a way it is like the
powder for a pill within the capsule, which could be compared to as a class.
7. What is meant by the "implementation of an ADT" is the transcription into
statements of a programming language,the declaration that defines a
variable to be of an ADT, in addition to a procedure in said programming
language for each operation of that ADT.
8. The criteria would be Is the data structure a good representation of the
collection of the data and its properties?
What is the difficulty to write the algorithms/ functions to implement the
operations in the Abstract Data Type?
Will the data structure be an efficient implementation in accordance of
storage requirements and will it be executed within an appropriate time?
9. Three advantages of creating ADT implementations would be
a)It can be more abstract allowing the source code to be readable at a higher
level.
b) You can write and debug the application faster. The application program
can just make calls to the functions that are in the implementation.
c) Due to the encapsulation of the source code, the source code for the
function can be modified singularly, the rest can be left alone.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Questions
Pointers
A pointer is basically a reference to an object or a function. In fact, it is a variable that holds memory address. This address is the
location of some other variable or object in memory. For example, if one variable contains the address of another variable, first
one is said to point to the second one. Pointers may have many uses, such as to make functions implement “call-by-reference”
methodology and to construct dynamic arrays or structures at run-time.
a) Write a complete C program that demonstrates the usage of call-by-reference technique needed for swapping.
Develop a call-by-value version to see that changes done to the parameters inside the function are lost.
b) Write a complete C program that implements below given user-defined function prototypes for arrays-of-integers.
void input_1d_array( int*, int );
void output_1d_array( int*, int );
int sum_1d_array( int*, int );
float average_1d_array( int*, int );
Test each function separately!
c) [if time allows]…
arrow_forward
Pointers (and/or reference) types are necessary in modern programming languages because
they aid readability and reliabilty
they provide the means to access and manipulate dynamic storage
they are easy to use and easy to get right
otherwise everyone would be able to program
arrow_forward
Choose the correct alternatives for the following:
iv) Representation of data structure in memory is known as
a) Recursion b) Abstract data type c) Storage structured) File structure
v) An ADT is defined to be a mathematical model of a user-defined type along with the collection of all operations on that model
a) Cardinality b) Assignment c) Primitive d) Structured
arrow_forward
In C++
Declare a Character Pointer and allocate a dynamic array of 22 characters.
arrow_forward
Match the following memory/pointer concepts and code structures:
Leading asterisk, like *p
pointer reference
Trailing asterisk, like int*
pointer variable data type
Leading ampersand, like &a
the thing pointed to by a poin v
Trailing ampersand, like int&
the memory location of a varia v
Trailing star-ampersand, like int*&
non-pointer reference
arrow_forward
It is a type used to represent a heterogeneous collection of data.
array
O function
struct
pointer
Check It!
Structure is a user-defined data type in C which allows you to
combine different data types to store a particular type of record.
O True
False
Check It!
arrow_forward
Programming Language: C++
Make a program wherein you have to create an Abstract Data Type, which will store 2 integer number. After that, make operations which will set the value of the two numbers, add, subtract, multiply and divide. After creating the abstract data type, use it in the main class. Ask the user for the value of two integers. Ask the user what operation to use, then call the necessary operation based on the user's input. Then display the answer with the correct label. Do not copy paste codes from other sites.
arrow_forward
Write a C/C++ function that receives, as arguments, a pointer to a double array, as well as the number of elements in the array (int). The function must use pointer operations (no block notation such as arr[i]) and must display each element in the array.
arrow_forward
Abstract data types are not specifically specified types of data.
arrow_forward
Subject : Data structure and algorithms
Goal of the work : Consolidating knowledge on the theoretical foundations of abstract data structures, mastering the skills of calculating the declared amount of memory for structures using C++ syntax.
Task : Given a data structure with three fields: an array of integers, a matrix of real numbers, and a string of characters. Calculate the total memory size (in bits, bytes, kilobytes, and megabytes) for record A, table B, and dynamic array variables C.
*note: The data types are respectively equal to the memory size "short-2 byte", "int-4", "long-8", "float-4", "double-8", "long double -12", " char-1".
arrow_forward
*Java code*
Implement a data structure called RunningTotal supporting the following API:
a) RunningTotal() - creates an empty running-total data structure
b) void add(int value) - adds the given value to the data structure
c) void remove() - removes the least-recently added value
d) int sum() - returns the sum of values in the data structure
e) double average() - returns the average of values in the data structure
Here's a Example:
RunningTotal rt = new RunningTotal ();rt . add (1); // 1 ( adds 1 )rt . add (2); // 1 2 ( adds 2 )rt . add (3); // 1 2 3 ( adds 3 )rt . sum (); // 1 2 3 ( returns 6 )rt . add (4); // 1 2 3 4 ( adds 4 )rt . remove (); // 2 3 4 ( removes 1 )rt . sum (); // 2 3 4 ( returns 9 )rt . average (); // 2 3 4 ( returns 3.0 )
arrow_forward
T or F
-Functions are considered to be objects in JavaScript because they contain three critical attributes: data, methods that act on the data, parameters for passing the data also known as awareness.
-A recursive function is a function that calls itself and eventually returns default value to break out of the recursion.
-A function that is used to create a new object is called an anonymous function.
-Attributes define additional characteristics or properties of the element which is the same as for the start tag.
-Javascript is similar to the Java programming language
arrow_forward
Function Implementation with Data Abstraction in C Programming
1. Create a new file and SAVE as MATHV1.H Define and Implement the following functions: int sum(int x, int y); - returns the computed sum of two numbers x and y int diff(int x, int y); - returns the computed difference of two numbers x and y. Make sure that the larger number is deducted by the smaller number to avoid a negative answer long int prod(int x, int y); - returns the computed product of two number x and y float quot(int x, int y); - returns the computed quotient of two numbers x and y. Make sure that the larger number is always the numerator and divided by the smaller number to avoid division by zero error. int mod(int x, int y); - returns the computed remainder of two numbers x and y using the modulo operator %2. Create another new file and save as MYTOOLS.H void center(int row, char str[]); /*centers text across the screen -calculate here for the center col using the formula col=(80-strlen(str))/2; -then use…
arrow_forward
C Programming
arrow_forward
Why is ‘this’ Pointer is widely used than object pointer?
arrow_forward
The design of pointers has been associated with certain issues. Most programming languages restrict pointers to referencing only one type of variable.
arrow_forward
Upload answer sheets
Write a C program to find the number of occurrences of characters in the first string which is present in the second string using pointers.
arrow_forward
What are any similarities that exist between a reference and a pointer?
arrow_forward
In C programming:
Write a main() function using the following requirements:• Define a SIZE constant (the value is irrelevant, but for testing, you may want to keep it small enough – no bigger than 5)• Create an array of course pointers using SIZE• Dynamically allocate each element of the array• Call inputAllCourses()• Call printAllCourses().
arrow_forward
What are some ways in which a reference and a pointer are alike?
arrow_forward
C LANGUAGE IS THE NEEDED COMPUTER LANGUAGE. COUT something like that.
arrow_forward
What are the advantages of an enumeration type over a set of named constants? What are the advantages of a subrange type over its base type? In what instances may a string be better than a character array?
arrow_forward
C++
arrow_forward
What is meant by a pointer variable? How is it used?
What is a dynamic array? What is the relationship between a dynamic array and pointers?
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning
Related Questions
- Pointers A pointer is basically a reference to an object or a function. In fact, it is a variable that holds memory address. This address is the location of some other variable or object in memory. For example, if one variable contains the address of another variable, first one is said to point to the second one. Pointers may have many uses, such as to make functions implement “call-by-reference” methodology and to construct dynamic arrays or structures at run-time. a) Write a complete C program that demonstrates the usage of call-by-reference technique needed for swapping. Develop a call-by-value version to see that changes done to the parameters inside the function are lost. b) Write a complete C program that implements below given user-defined function prototypes for arrays-of-integers. void input_1d_array( int*, int ); void output_1d_array( int*, int ); int sum_1d_array( int*, int ); float average_1d_array( int*, int ); Test each function separately! c) [if time allows]…arrow_forwardPointers (and/or reference) types are necessary in modern programming languages because they aid readability and reliabilty they provide the means to access and manipulate dynamic storage they are easy to use and easy to get right otherwise everyone would be able to programarrow_forwardChoose the correct alternatives for the following: iv) Representation of data structure in memory is known as a) Recursion b) Abstract data type c) Storage structured) File structure v) An ADT is defined to be a mathematical model of a user-defined type along with the collection of all operations on that model a) Cardinality b) Assignment c) Primitive d) Structuredarrow_forward
- In C++ Declare a Character Pointer and allocate a dynamic array of 22 characters.arrow_forwardMatch the following memory/pointer concepts and code structures: Leading asterisk, like *p pointer reference Trailing asterisk, like int* pointer variable data type Leading ampersand, like &a the thing pointed to by a poin v Trailing ampersand, like int& the memory location of a varia v Trailing star-ampersand, like int*& non-pointer referencearrow_forwardIt is a type used to represent a heterogeneous collection of data. array O function struct pointer Check It! Structure is a user-defined data type in C which allows you to combine different data types to store a particular type of record. O True False Check It!arrow_forward
- Programming Language: C++ Make a program wherein you have to create an Abstract Data Type, which will store 2 integer number. After that, make operations which will set the value of the two numbers, add, subtract, multiply and divide. After creating the abstract data type, use it in the main class. Ask the user for the value of two integers. Ask the user what operation to use, then call the necessary operation based on the user's input. Then display the answer with the correct label. Do not copy paste codes from other sites.arrow_forwardWrite a C/C++ function that receives, as arguments, a pointer to a double array, as well as the number of elements in the array (int). The function must use pointer operations (no block notation such as arr[i]) and must display each element in the array.arrow_forwardAbstract data types are not specifically specified types of data.arrow_forward
- Subject : Data structure and algorithms Goal of the work : Consolidating knowledge on the theoretical foundations of abstract data structures, mastering the skills of calculating the declared amount of memory for structures using C++ syntax. Task : Given a data structure with three fields: an array of integers, a matrix of real numbers, and a string of characters. Calculate the total memory size (in bits, bytes, kilobytes, and megabytes) for record A, table B, and dynamic array variables C. *note: The data types are respectively equal to the memory size "short-2 byte", "int-4", "long-8", "float-4", "double-8", "long double -12", " char-1".arrow_forward*Java code* Implement a data structure called RunningTotal supporting the following API: a) RunningTotal() - creates an empty running-total data structure b) void add(int value) - adds the given value to the data structure c) void remove() - removes the least-recently added value d) int sum() - returns the sum of values in the data structure e) double average() - returns the average of values in the data structure Here's a Example: RunningTotal rt = new RunningTotal ();rt . add (1); // 1 ( adds 1 )rt . add (2); // 1 2 ( adds 2 )rt . add (3); // 1 2 3 ( adds 3 )rt . sum (); // 1 2 3 ( returns 6 )rt . add (4); // 1 2 3 4 ( adds 4 )rt . remove (); // 2 3 4 ( removes 1 )rt . sum (); // 2 3 4 ( returns 9 )rt . average (); // 2 3 4 ( returns 3.0 )arrow_forwardT or F -Functions are considered to be objects in JavaScript because they contain three critical attributes: data, methods that act on the data, parameters for passing the data also known as awareness. -A recursive function is a function that calls itself and eventually returns default value to break out of the recursion. -A function that is used to create a new object is called an anonymous function. -Attributes define additional characteristics or properties of the element which is the same as for the start tag. -Javascript is similar to the Java programming languagearrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrSystems ArchitectureComputer ScienceISBN:9781305080195Author:Stephen D. BurdPublisher:Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning