Sunday , November 10 2024
Breaking News

CS201: Elementary Data Structures Certification Answers

Elementary data structures are fundamental building blocks used in computer science and programming to organize and manage data efficiently. These structures are the basic components that form more complex data structures and algorithms. Some common elementary data structures include:

  1. Arrays: Arrays are a collection of elements, each identified by at least one array index or key. They store elements of the same type and allow random access to elements using their indices.
  2. Linked Lists: Linked lists are collections of nodes where each node contains data and a reference (link) to the next node in the sequence. They are dynamic in size and provide efficient insertion and deletion operations, but accessing elements requires traversing the list from the beginning.
  3. Stacks: Stacks are abstract data types that follow the Last-In-First-Out (LIFO) principle. Elements are added and removed from only one end, called the top. Common operations include push (add element) and pop (remove element).
  4. Queues: Queues are abstract data types that follow the First-In-First-Out (FIFO) principle. Elements are added at the rear (enqueue) and removed from the front (dequeue). Common implementations include arrays and linked lists.
  5. Trees: Trees are hierarchical data structures composed of nodes, where each node has a value and a list of references to its child nodes. They are commonly used for organizing hierarchical data, such as file systems, and implementing various algorithms, such as binary search trees and AVL trees.
  6. Graphs: Graphs are collections of nodes (vertices) and edges that connect pairs of nodes. They can be directed or undirected and may contain cycles. Graphs are used to model relationships between objects and solve various real-world problems, such as network routing and social network analysis.

These elementary data structures are essential for understanding more complex data structures and algorithms used in software development and computer science. Understanding their properties, operations, and performance characteristics is crucial for designing efficient and scalable solutions.

CS201: Elementary Data Structures Exam Quiz Answers

  • 0
  • 49
  • 50
  • 51
  • int my_array [3][4];
  • int my_array [4][3];
  • integer my_array [3][4];
  • int my_array [3], my_array [4];
  • Each abstract data type can have many definitions. Each is a definition instance.
  • An instance is the time taken to allocate memory for a defined abstract data type.
  • An abstract data type has a description or definition that is used to create instances.
  • Abstract data type definitions give instructions on each instance of memory allocation.
  • Another name for a variable that holds the address of a block of memory
  • A floating-point number that specifies the address of an array’s first data value
  • The address of the first byte of a contiguous block of memory allocated by a program
  • The important information embedded in the assembler code generated by the compiler
  • int data [5][6];
  • std: array<std: array<int,5>,6> data;
  • int * data = (int*) malloc (5 * 6 * size of(int));
  • int * data [5]; for (int i = 0; i < 5; i++) data [i] = new int [6];
  • Push, Pop, Empty
  • Push, Sort, Retrieve
  • Add, Remove, Access
  • Insert, Access, Delete
  • Any entry is directly accessible.
  • Only the earliest entry is directly accessible.
  • Only the most recent entry is directly accessible.
  • Only the entry with the lowest value is accessible.
  • ABCD
  • ABDC
  • DBCA
  • DCBA
  • Only one pointer is used to keep track of the “front.”
  • Only one pointer is used to keep track of the “rear.”
  • Two pointers are used, one to track the “front” and the other to track the “rear.”
  • Two pointers are used, one for the next and the other for the previous queue elements.
  • Adding a new element to the rear of a queue.
  • Adding a new element to the front of a queue.
  • Removing an element from the front of a queue.
  • Computing the hash value of the element and inserting it in the queue.
  • 5
  • The memory address of the variable a
  • The memory address of the variable x
  • 0 or NULL (depending on the compiler), since the variable a contains a null pointer
  • *
  • ++
  • Both operators have the same precedence.
  • The syntax is incorrect, since pointer variables cannot be incremented.
  • Yes. Some compilers produce code for lesser bit lengths than the target computer.
  • Yes. The compiler makes decisions on variable numeric ranges based on memory availability.
  • No. Compilers for a given bit length do not produce executable code for different bit lengths.
  • No. The same code syntax is guaranteed to produce the same results regardless of compiler.
  • *
  • &
  • #
  • _
  • The variable a is equal to x.
  • The variable a is equal to 10.
  • The variable a points to the memory location of x.
  • This operation would corrupt the variable a, and should be avoided.
  • The character string g
  • The memory address of g
  • The character string galaxy
  • Nothing; the code will not compile since the syntax is incorrect
  • Scalar: C, Vector: R, Array: data[i]
  • Scalar: int[C], Vector: R, Array: data
  • Scalar: R, Vector: data, Array: int[C]
  • Scalar: R, Vector: data[i], Array: data
  • A constructor is required to contain input arguments.
  • A constructor automatically initializes all data members of a class.
  • A constructor is automatically invoked when a class is instantiated.
  • The name of the constructor is never the same as the name of the class.
  • It is wasted by the compiler.
  • It is available but not usable.
  • It is being used by another program.
  • It is allocated but never deallocated.
  • It is allocated at design time.
  • It is allocated at compile time.
  • It is allocated when an object is deleted.
  • It is used to dynamically allocate memory.
  • Foregoing the use of dynamically-allocated memory
  • Recasting memory pointers for use by other abstract data types
  • Ensuring there is a “delete” for every “new”, and a “free” for every “malloc” or “calloc”
  • Ensuring there is a “free” for every “new”, and a “delete” for every “malloc” or “calloc”
  • Struct declarations are the same in C and C++.
  • A compiler error results when public or private is not specified.
  • Class members are private and structure members are public by default.
  • Class members are public and structure members are private by default.
  • Hash Access
  • First-In/First-Out
  • Last-In/First-Out
  • Random Access
  • 1
  • 2
  • 3
  • 4
  • Adding a node
  • Deleting a node
  • Traversing a node
  • Direct random access to nodes
  • Singly linked list
  • Doubly linked list
  • Circular linked list
  • Hash-extension linked list
  • O (n)
  • O (log n)
  • O (n 2)
  • O (n log n)
  • O (n)
  • O (log n)
  • O (n 2)
  • O (n log n)
  • O (n)
  • O (log n)
  • O (n 2)
  • O (n log n)
  • O (n)
  • O (log n)
  • O (n 2)
  • O (n log n)
  • Bubble sort
  • Insertion sort
  • Merge sort
  • Selection Sort
  • O (1)
  • O (n)
  • O (log n)
  • O (n log n)
  • O (1)
  • O (n)
  • O (log n)
  • O (n log n)
  • Linear search is more efficient.
  • Binary search is more efficient.
  • Linear and binary search are equally efficient.
  • Either can be more efficient, depending on the type of data involved.
  • Bubble sort
  • Insertion sort
  • Merge sort
  • Selection sort
  • n2
  • n
  • n^2
  • log(n)+1
  • n=2(d+1)–1
  • Space efficiency is < n
  • The deepest node has depth < log n
  • Runtime efficiency is log n for all operations
  • At the end of the table
  • At the beginning of the table
  • At the key calculated by the function
  • Relative to the lowest-valued existing item
  • 0
  • 1
  • 2
  • 3
  • Arrays in contiguous memory
  • Linked lists in non-contiguous memory
  • A list to implement the hash table itself
  • A list to store entries with the same keys
  • Graphs are a special case of trees.
  • A graph must have at least one edge.
  • A graph must have at least one vertex.
  • Vertices are each connected via at least two edges.
  • Use real numbers
  • Allow table overflows
  • Use some random function
  • Map any key into one of the slots
  • n
  • n−1
  • 2n
  • log(n+1)/2
  • pre-order
  • post-order
  • depth-first
  • breadth-first
  • When two entries are identical except their keys
  • When two entries with different data have the same key
  • When two entries with the same key have different hash values
  • When two entries with different keys have the same hash value
  • Trails are a subset of walks.
  • Walks are a subset of circuits.
  • Paths are a super-set of walks.
  • Cycles are a super-set of walks.
  • 0
  • 1
  • 2
  • 3
  • Collisions never occur.
  • Sequential search looks for the key or its absence when a collision occurs.
  • Fibonacci steps are used to search for the key or its absence when a collision occurs.
  • A hash-function parameter is adjusted and the function is recalculated when a collision occurs.
  • O (1)
  • O (n)
  • O (log n)
  • O (n log n)
  • Any process having a pointer to the object can call any method within the object.
  • The memory occupied by the object itself and its internal data is entirely contiguous.
  • Structures contained within classes are not necessarily accessible outside the class object.
  • Their data is entirely public and can be changed by any process having a pointer to the object.
  • Garbage cleanup includes memory defragmentation.
  • The allocation method may employ blocks that point to sub-blocks.
  • Memory may be rearranged automatically by the operating system.
  • There may be insufficient memory to allocate the required block size.
  • Inserting
  • Popping
  • Pushing
  • Updating
  • Deleting
  • Popping
  • Pushing
  • Reallocating
  • Push, Pop
  • Insert, Delete
  • Inject, Extract
  • Enqueue, Dequeue
  • The memory address of the program’s main () function
  • A variable that stores the memory address of another variable
  • The memory address of the program’s last executable statement
  • The memory address of the program’s first executable statement
  • *
  • &
  • #
  • _
  • long int i;
  • double int i;
  • unsigned int i;
  • int i [<number of words desired>];
  • The value of the third element of the array is 8.
  • The value of the third element of the array is 10.
  • The pointer ptr1 contains the memory address of the first element of the array.
  • The pointer ptr1 contains the memory address of the third element of the array.
  • Does not point to any memory address
  • Holds the memory address of the main method
  • Points to a memory address that holds no value
  • Holds the memory address to the end of the program
  • At run time
  • At design time
  • At compile time
  • Only when a class constructor is invoked
  • To end a program
  • To release resources used by an object
  • To destroy viruses or malicious programs
  • To pass resources on to a replacement object
  • A data structure to store values in an array
  • A data structure that facilitates random access to stored values
  • A fixed-length data structure that expands and contracts as needed
  • A data structure where one value points to a subsequent and/or previous value
  • Hash Table
  • FIFO Queue
  • LIFO Queue
  • LILO Queue
  • O (n)
  • O (log n)
  • O (n2)
  • O (n log n)
  • O(n), O (log n), O (n2)
  • O (log n), O(n), O (n2)
  • O (n2), O(n), O (log n)
  • O (n2), O (log n), O(n)
  • O (1)
  • O (n)
  • O (log n)
  • O (n log n)
  • The first element in the array
  • The last element in the array
  • In the second half of the array
  • Somewhere in the middle of the array
  • 1
  • n
  • n+1/2
  • log(n)+1
  • O (n)
  • O (n2)
  • O (log n)
  • O (n log n)
  • O (1)
  • O (n)
  • O (log n)
  • O (n log n)
  • trail
  • critical path
  • spanning tree
  • multi-branch tree
  • n
  • n−1
  • n2
  • log(n+1)/2
  • h(i)=i
  • h(i)=i mod t
  • h(i)= (i
  • h(i)= (i mod(b/2)) −b
  • Paths are equivalent to trails.
  • Walks are a superset of trails.
  • Cycles are a subset of circuits.
  • Circuits are a superset of trails.
  • No cycles
  • Fewer edges
  • No spanning trees
  • Edges for traversal in one direction
  • 0
  • 1
  • 2
  • 3
  • Use chaining
  • Rebalance the table
  • Use a random hash function
  • Increase the size of the hash table
  • Memory blocks whose words all have consecutive addresses
  • Memory blocks that are allocated entirely from active memory
  • A collection of memory blocks where each block points to the next
  • A memory block that is allocated using standard language methods
  • The STL is a superset from which abstract data types are derived.
  • An ADT has a description or “definition”. STL members are not so constrained.
  • The STL is a collection of ADTs that offer definitions of commonly-required objects.
  • The STL is a library of ADTs created by the programmer over time to promote reusable code.
  • An infinite loop will occur.
  • The code will not compile.
  • At the end of the loop, the sum will be stored in the variable i.
  • At the end of the loop, the sum will be stored in the variable x.
  • Yes. Compilers have options that can be set for the bit-size of the computer in question.
  • Yes. The loader will always allocate appropriate memory and word lengths for the code in question.
  • No. The loader is not capable of allocating program space for code built for shorter word lengths.
  • No. Compilers for one bit-length will not produce executable code for computers of other bit-lengths.
  • A class cannot have more than one constructor.
  • A constructor without input arguments is not allowed.
  • A constructor with no arguments is called a default constructor.
  • A class without a default constructor will cause a compiler error.
  • Linked lists occupy contiguous memory.
  • Memory is allocated at the beginning of the program.
  • Memory is allocated dynamically as the program runs.
  • There are no nodes without programmer-assigned data values.
  • Singly linked lists
  • Doubly linked lists
  • Multiply linked lists
  • Circular linked lists
  • Array elements can be directly accessed, whereas linked list elements can only be accessed via an indexing vector.
  • Array elements always occupy contiguous memory, whereas linked lists always occupy non-contiguous memory.
  • Arrays use scalar index values to directly reference an element of the array. linked list elements do not have direct reference.
  • linked lists always include arrays as linked elements. These arrays provide pointers to subsequent and previous list elements.
  • It may contain loops.
  • It may have weighted edges.
  • It contains only undirected edges.
  • It has nodes that connect via multiple edges.
  • 0
  • 1
  • 2
  • 3
  • Slot 5
  • Slot 6
  • Slot 7
  • Slot 9
  • Trees can have cycles.
  • Trees are special cases of graphs.
  • Trees cannot be implemented using arrays.
  • Trees must be implemented using objects that point to each other.
  • 0
  • 1
  • 2
  • 3
  • Minimizes collisions
  • Minimizes insertion/deletion time
  • Produces a unique hash value for each different key
  • Produces a unique hash value in the least amount of time

About Clear My Certification

Check Also

CS401: Operating Systems Certification Exam Answers

Operating systems (OS) are the backbone of modern computing, serving as the intermediary between hardware …

Leave a Reply

Your email address will not be published. Required fields are marked *