click below
click below
Normal Size Small Size show me how
FA5 and FA6 ComProg
| Question | Answer |
|---|---|
| What is the output of the following? #include <iostream> using namespace std; int main() { int var = 20; int *ip; ip = &var; cout << *ip << endl; return 0; } Group of answer choices 0 20 40 1 | 20 |
| What is the declaration for the pointer that points to a variable of type int? | int *p; |
| When does the void pointer can be dereferenced? Group of answer choices When it cast to another type of object When it doesn’t point to any value Using the delete keyword None of the mentioned | When it cast to another type of object |
| What is the output of the following? #include <iostream> using namespace std; int main() { int var = 40; int *ip; ip = &var; cout << *ip << endl; //cout << "40"; return 0; } Group of answer choices 40 40 error 40 0 | 40 |
| What is the output of the following program? #include <iostream> using namespace std; int main() { string food = "Pizza"; string * ptr = &food; cout << food << " "; cout << *ptr << "\n"; } | Pizza Pizza |
| A void pointer can point to which type of objects? Group of answer choices double float int all of the mentioned | all of the mentioned |
| What is the output of the following code? #include <iostream> using namespace std; int main() { string food = "Pizza"; string* ptr = &food; cout << food << "\n"; return 0; } Group of answer choices ptr Error Pizza food | Pizza |
| Which of the following is a reference operator? Group of answer choices @ & * & | & |
| 0x7fffe867d790 is an example of: Group of answer choices Parameter Data type boolean Memory Address | Memory Address |
| It is a pointer not associated with any data types Group of answer choices operator data type void pointer identifier | void pointer |
| What is the output of the given program? #include <iostream> using namespace std; int main() { int a[2]; a[0] = 12; a[1] = 12; int a[3]; a[0] = 12; a[1] = 12; a[3] = 12; return 0; } | error |
| What is the output of the following? #include <iostream> using namespace std; int main() { int * foo = new int [5]; foo[0] = 8; cout << foo [0]; delete[] foo; return 0; } Group of answer choices 0 NULL Error 8 | 8 |
| Which of the following is NOT true about static arrays? Group of answer choices Fixed size Memory space is allocated during compile time Located in Stack Memory space Memory space is allocated at runtime | Memory space is allocated at runtime |
| What is the output of the program? #include <iostream> using namespace std; int main() { int *ptr = new int; int a = 143; ptr = &a; cout << ptr << endl; return 0; } Group of answer choices 143 A memory address 0 Error | A memory address |
| To create a dynamic array, you have to use: Group of answer choices Array new operator All of the given Pointer Variable | All of the given |
| Denotes a request for memory allocation on the Free Store Group of answer choices new operator dereferencing operator delete operator address operator | new operator |
| What is used for accessing the contents of memory location whose address is stored in a pointer variable? By applying some special function By applying the address operator & By applying the dereference operator By applying an array | By applying the dereference operator |
| What is the output of the given program? #include <iostream> using namespace std; int main() { int *ptr = new int; int a = 143; ptr = &a; cout << *ptr << endl; return 0; } Group of answer choices Error A memory address 0 143 | 143 |
| Which of the following is NOT true about dynamic arrays? Group of answer choices Located in Heap memory space Dynamic size Memory space is allocated during compile time Memory space is allocated at runtime | Memory space is allocated during compile time |
| What is the output of the following? #include <iostream> using namespace std; int main() { int *p1 = new int(); int *p2 = new int(); int *p3 = new int(); *p1 = 45; p2 = p1; *p3 = *p1+*p2; cout << *p3 << endl; return 0; } Group of answe | 90 |
| What will happen in this code? int a = 100, b = 200; int *p = &a, *q = &b; p = q; Group of answer choices a is assigned to b q now points to a b is assigned to a p now points to b | p now points to b |
| A symbol used to access the value of an address Group of answer choices # * & $ | & |
| How a static array is declared? | float a [10]; |
| It stores the memory address as its value | pointer |
| What is the output of the following program? #include <iostream> using namespace std; int main() { int n; n = 3; int * p = new int[n]; for (int i = 0; i<n;i++) { p[n] = 10; cout << p[n] << " "; } delete []p; return 0; } Group of a | 10 10 10 |
| Dynamically allocated memory is allocated on ___________________ Group of answer choices Array Heap Stack Variable | heap |
| What is the output of the program? #include <iostream> using namespace std; int main() { int * foo; foo = new int [5]; foo[0] = 1; foo[1] = 2; foo[2] = 3; foo[3] = 4; foo[4] = 5 delete[] foo; cout ; return 0; } Group of answer choices | error |
| The operation used to create a linked list node | \\Insertion Deletion Creation Traversing |
| Means to visit every element or node in the list beginning from first to last | Create \\Traversal Deletion Insert |
| It is the process of going through all the nodes from one end to another end of a linked list | Insertion Creation Deletion \\Traversing |
| What is the value of the last pointer in a linked list? | 0 1 -1 \\\Null |
| It holds the information content or data to be represented by the node. | Array Data Item Head \\Link |
| A node contains: Group of answer choices Address Identifier Data Item and Address Data | data item and address |
| What is the operation used to delete an item (or node) from the linked list? Group of answer choices Creation Traversing Insertion Deletion | deletion |
| It is a linear collection of varying lengths of homogeneous components. Group of answer choices Parameter Variable List Typedef | list |
| Lists that has a dynamic size in memory Group of answer choices Node Array Linked List Pointer | linked list |
| What is the operation is used to insert a new node at any specified location in the linked list? | Insertion |
| Means to visit every element or node in the list beginning from first to last | traversal |
| What does the following code do? struct Node { int data; Node* next;}; | Creates a Pointer |
| Removes a node in a linked list | deletion |
| What is the basic component of a linked list? Group of answer choices Identifier Constant Node Argument | node |
| What is ADT? Group of answer choices Absolute Data Type Additional Data Type Arithmetic Data Type Abstract Data Type | Abstract Data Type |
| Which of the following is true about the linked list? Group of answer choices Random access is allowed Elements are at contiguous location It has fixed size It is dynamic | It is dynamic |
| Ending node of a linked list is also known as Group of answer choices Head Link Tails Pointer | tail |
| Starting node of a linked list is also known as: Group of answer choices Pointer Head Tails Link | head |
| A type of Linked list where items can be navigated forward and backward. Group of answer choices Diamond Linked list Doubly Linked list Circular Linked list Singly Linked list | Doubly Linked list |
| It is a linear data structure where each element is a separate object Group of answer choices Pointer Array Parameter Linked List | linked list |
| It is a special pointer value that does not reference any memory cell. Group of answer choices 0 null -1 1 | null |
| It holds the addresses of the neighboring nodes or of those nodes which are associated with the given node as dictated by the application Group of answer choices Head Link Array Data Item | link |
| It is the process of combining one list to another list. Group of answer choices Concatenation Copy Traverse Link | Concatenation |
| What is the output of the following program? #include <iostream> using namespace std; struct Node { int data; Node *next; }; int main() { Node *p; p = new Node; p -> data = 70; p -> next = NULL; cout << "Data | Error Data \\Data 70 70 |
| A type of Linked list that where the last item contains link of the first element as next and the first element has a link to the last element as previous Singly Linked list Diamond Linked list Circular Linked list Doubly Linked list | Circular Linked list |
| An operation which adds a node in the list Group of answer choices Creation Display Insertion Search | insertion |