TCS Linked List Quiz-1

Question 1

Time: 00:00:00
What type of sorting algorithm can be used to sort the random linked list with minimum time complexity?

Heap sort

Heap sort

Quick sort

Quick sort

Merge sort

Merge sort

Insertion Sort

Insertion Sort

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 2

Time: 00:00:00
Suppose a person sees a picture, so he slides the picture left and can see the next picture and when he wants to see the previous image so he slides picture right. So in viewing previous or next image, what type of data structure is used in it?

Stack

Stack

Queue

Queue

Linked list

Linked list

Tree

Tree

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 3

Time: 00:00:00
What is time complexity to count the number of elements of a linked list.

O(n)

O(n)

O(log n)

O(log n)

O(1)

O(1)

None of them

None of them

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

it should be O(n) as it needs to travel to entire list

To count the number of elements, you have to traverse through the entire list, hence complexity is O(n).

For count, you have to travel all the link list so correct answer is O(n).

Start

Question 4

Time: 00:00:00
what type of functionality the following code performs

Public void(Node node)

        {

            if(size==0)

            head==node;

            else

            {

            Node temp,cur;

            for(cur = head(temp=cur.getNext())! = Null; cur = temp);

            cur.setNext(node);

            }

          size++;

        }

Insertion from beginning

Insertion from beginning

Deletion from beginning

Deletion from beginning

Insertion from end

Insertion from end

Deletion from end

Deletion from end

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 5

Time: 00:00:00
 What is the functionality of the following piece of code

Public int function(int data)

    {

        Node temp = head;

        Int var=0;

        while(temp!=Null)

        {

            if(temp.getData()==data)

Return var;

            var=var+1;   

            Temp = temp.getNext();

        }

        Return Integer.Min_value;

    }

Find the data

Find the data

Find the data and return position

Find the data and return position

Find the data and insert new element

Find the data and insert new element

Find the data and return data

Find the data and return data

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 6

Time: 00:00:00
Which of the following functionality is true for the count the number of the element of the link list.

A. public void insertBegin(Node node)
{
node.setNext(head);
head = node;
size++;
}

B. public void insertBegin(Node node)
{
head = node;
node.setNext(head);
size++;
}

C. public void insertBegin(Node node)
{
Node temp = head.getNext()
node.setNext(temp);
head = node;
size++;
}

D. public void insertBegin(Node node)
{
Node temp = head.getNext()
node.setNext(temp);
node = head;
size++;
}

A

A

B

B

C

C

D

D

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 7

Time: 00:00:00
There is a following code of simply link list. The code is for modifying the list by moving the last element to the front of the list. Some part of the code is left blank so choose a right statement for fill this blank.

 

typedef struct node

{

    Int value;

    Struct node *next;

}Node;

 

Node *function(Node *head)

{

    Node=*p,*q;

    if((head == null)||(head- >next==null))

        return head;

    q=null;

    p=head;

    while(p- >next == null)

    {

q=p;

p=p- >next;

    }

    _______________________________

    Return head;

}

q- >next=null; p- >next=head;head=p;

q- >next=null; p- >next=head;head=p;

head=p;p- >next=q; q- >next=null;

head=p;p- >next=q; q- >next=null;

q- >next=null; head=p; p- >next=head;

q- >next=null; head=p; p- >next=head;

q=null; p- >next=head;head=p;

q=null; p- >next=head;head=p;

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 8

Time: 00:00:00
In a circular link list

Forward and backward traversal within the list is permitted

Forward and backward traversal within the list is permitted

Nodes are arranged in hierarchical manner

Nodes are arranged in hierarchical manner

There is no beginning and no end

There is no beginning and no end

Compounds are all linked together in sequential manner.

Compounds are all linked together in sequential manner.

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 9

Time: 00:00:00
A link list contains minimum two field. One of them is data field to store the data so what is the second field?

It’s a pointer to character.

It’s a pointer to character.

It’s a pointer to integer.

It’s a pointer to integer.

It’s a pointer to node

It’s a pointer to node

None.

None.

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 10

Time: 00:00:00
 The concatenation of two linked list takes O(1) time. Which of the following variation of linked list can be performed.

Singly linked list.

Singly linked list.

Doubly linked list

Doubly linked list

Circular linked list

Circular linked list

Circular doubly linked list.

Circular doubly linked list.

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

["0","40","60","80","100"]
["Need more practice!","Keep trying!","Not bad!","Good work!","Perfect!"]

Buy TCS Prog. Logic (C MCQ) Paid Materials

Join TCS Online Classes

Personalized Analytics only Availble for Logged in users

Analytics below shows your performance in various Mocks on PrepInsta

Your average Analytics for this Quiz

Rank

-

Percentile

0%

Completed

0/10

Accuracy

0%

Get Prepinsta Prime

Get all 200+ courses offered by Prepinsta

Never Miss an OffCampus Update

Get OffCampus Updates on Social Media from PrepInsta

Follow us on our Media Handles, we post out OffCampus drives on our Instagram, Telegram, Discord, Whatsdapp etc.

Get Hiring Updates
Amazon,Google,Delottie & 30+companies are hiring ! Get hiring Updates right in your inbox from PrepInsta

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others.

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others.

Get PrepInsta Prime Subscription

Get access to all the courses that PrepInsta offers, check the out below -

Companies

TCS, Cognizant, Delloite, Infosys, Wipro, CoCubes, KPMG, Amazone, ZS Associates, Accenture, Congnizant & other 50+ companies

Programming

Data Structures, Top 500 Codes, C, C++, Java Python & other 10+ subjects

Skills

Full Stack Web Development, Data Science, Machine Learning, AWS Cloud, & other 10+ skills and 20+ projects

Comments