0% found this document useful (0 votes)
3 views6 pages

More Mcqs Data Structure and Algorithms (Set 11)

The document contains a series of multiple-choice questions related to data structures and algorithms, specifically focusing on linked lists and strings. It covers topics such as time complexity, types of linked lists, memory allocation in C, and operations involving strings. Each question is followed by the correct answer, providing a quick reference for understanding linked list concepts and string manipulation in programming.

Uploaded by

mmaimsalim95
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views6 pages

More Mcqs Data Structure and Algorithms (Set 11)

The document contains a series of multiple-choice questions related to data structures and algorithms, specifically focusing on linked lists and strings. It covers topics such as time complexity, types of linked lists, memory allocation in C, and operations involving strings. Each question is followed by the correct answer, providing a quick reference for understanding linked list concepts and string manipulation in programming.

Uploaded by

mmaimsalim95
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Data Structure and Algorithms (DSA)

11 of 14 sets

501. What would be the asymptotic time complexity to find an element in the
linked list?
A. o(1)
B. o(n)
C. o(n2)
D. none
Answer:B

502. What would be the asymptotic time complexity to insert an element at the
second position in the linked list?
o m
A. o(1)
. c
B. o(n)
te
C. o(n2)
a
D. none

q M
Answer:A
c
Mlist can performed in O(1) time. Which of the
503. The concatenation of two
following variation of linked list can be used?
A. singly linked list
B. doubly linked list
C. circular doubly linked list
D. array implementation of list
Answer:C

504. Consider the following definition in c programming language

struct node
{
int data;
struct node * next;
}
typedef struct node NODE;
NODE *ptr;
Which of the following c code is used to create new node?
A. ptr=(node*)malloc(sizeof(node));
B. ptr=(node*)malloc(node);
C. ptr=(node*)malloc(sizeof(node*));
D. ptr=(node)malloc(sizeof(node));
Answer:A

505. A variant of linked list in which last node of the list points to the first node of
the list is?
A. singly linked list
B. doubly linked list
C. circular linked list
D. multiply linked list
Answer:C

506. In doubly linked lists, traversal can be performed?


A. only in forward direction
B. only in reverse direction
C. in both directions
D. none
Answer:C

507. What kind of linked list is best to answer question like “What is the item at
position n?”
A. singly linked list
B. doubly linked list
C. circular linked list
D. array implementation of linked list
Answer:D

508. A variation of linked list is circular linked list, in which the last node in the list
points to first node of the list. One problem with this type of list is?
A. it waste memory space since the pointer head already points to the first node and thus the list
node does not need to point to the first node.
B. it is not possible to add a node at the end of the list.

View all MCQ's at McqMate.com


C. it is difficult to traverse the list as the pointer of the last node is now not null
D. all of above
Answer:C

509. A variant of the linked list in which none of the node contains NULL pointer
is?
A. singly linked list
B. doubly linked list
C. circular linked list
D. none
Answer:C

510. In circular linked list, insertion of node requires modification of?


A. one pointer
B. two pointer
C. three pointer
D. none
Answer:B

511. Which of the following statements about linked list data structure is/are
TRUE?
A. addition and deletion of an item to/ from the linked list require modification of the existing
pointers
B. the linked list pointers do not provide an efficient way to search an item in the linked list
C. linked list pointers always maintain the list in ascending order
D. the linked list data structure provides an efficient way to find kth element in the list
Answer:B

512. Linked lists are not suitable to for the implementation of?
A. insertion sort
B. radix sort
C. polynomial manipulation
D. binary search
Answer:D

View all MCQ's at McqMate.com


513. In worst case, the number of comparison need to search a singly linked list of
length n for a given element is
A. log n
B. n/2
C. log2n-1
D. n
Answer:D

514. consider the function f defined here:

struct item
{
int data;
struct item * next;
};
int f (struct item *p)
{
return((p==NULL) ||((p->next==NULL)||(p->data<=p->next->data) && (p-
>next)));
}

For a given linked list p, the function f returns 1 if and only if


A. the list is empty or has exactly one element
B. the element in the list are sorted in non-decreasing order of data value
C. the element in the list are sorted in non-increasing order of data value
D. not all element in the list have the same data value
Answer:B

515. Finite sequence S of Zero or more chatacters is called_____


A. array
B. list
C. string
D. block
Answer:C

516. String with zero characters is called____string


A. null
B. binary

View all MCQ's at McqMate.com


C. totalled
D. list
Answer:A

517. Groups of consecutive element in a string.Such as words,phrase and sentences


are called___
A. main string
B. substring
C. index
D. block
Answer:B

518. _____operation of word processing invovles replacing one string in the text by
another.
A. insertion
B. deletion is easier
C. searching
D. replacement
Answer:D

519. _____is the problem of deciding whether or not a given string problem p
appears in a text T.
A. pattern matching
B. searching
C. sorting
D. deletion
Answer:A

520. If string1=john,and string2=Rivers are merged,the process is called


A. insertion
B. deletion
C. concatenation
D. replacement
Answer:C

521. ____is a variable whose length may vary during the execution of a program.

View all MCQ's at McqMate.com


A. dynamic
B. static
C. semistatistic
D. global
Answer:A

522. NurseryLand.Nursery.Students = 10;


A. the structure students is nested within the structure nursery
B. the structure nurseryland is nested within the structure nursery.
C. the structure nursery is nested within the structure nurseryland.
D. the structure nursery is nested within the structure students
Answer:C

523. If a function is declared as void fn(int *p), then which of the following
statements is valid to call function fn?
A. fn(x) where x is defined as int x;
B. fn(x) where x is defined as int *x;
C. fn(&x) where x is defined as int *x;
D. fn(*x) where x is defined as int *x;
Answer:B

524. To declare an array S that holds a 5-character string, you would write
A. char s[5]
B. char s[6]
C. string s[5]
D. stringchar s[5]
Answer:A

525. The constructed datatype in C is known as


A. string
B. array
C. structure
D. pointer
Answer:C

View all MCQ's at McqMate.com

You might also like