Search Header Logo

Unit 1 - DSA - AI A

Authored by Reshmy Krishnan

Computers

University

Used 3+ times

Unit 1 - DSA - AI A
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What are the disadvantages of arrays?

Index value of an array can be negative

Elements are sequentially accessed

Data structure like queue or stack cannot be implemented

There are chances of wastage of memory space if elements inserted in an array are lesser than the allocated size

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What will be the size of the following structure?

#include <stdio.h>
struct temp {
  int a[5];
  char p;
};

6

10

20

24

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the time complexity to insert a single element in the array?

O(1)

O(n)

O(log n)

O(n log n)

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the output of the following program?

#include <stdio.h>

int main()

{

int arr[5] = { 2, 6, 8, 13, 19 };

// Modifing the data

for (int i = 0; i < 5; i += 2)

arr[i]++;

for (int i = 0; i < 5; i++)

printf("\t %d", arr[i]);

return 0;

}

2, 6, 8, 13, 19 

3, 6, 9, 13, 20

3, 7, 9, 14, 20

2, 6, 8, 14, 20

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the output of the following program?

int main()

{

 

    int arr[ ] = { 1, 2, 3, 4, 5 };

    for (int i = 0; i < 5; i++)

        printf("\t %d", *(arr + i) );

    return 0;

}

1, 3, 5, 7, 9

1200, 1201, 1202, 1203, 1204

1 2 3 4 5

2, 4, 6, 8, 10

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Comment on the following pointer declaration:

int *ptr, p;

ptr is a pointer to integer, p is not.

ptr and p, both are pointers to integer.

ptr is pointer to integer, p may or may not be.

ptr and p both are not pointers to integer.

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which of the following is an incorrect syntax for pointer to structure?

struct temp{

int b;

}*my_struct;

*my_struct.b = 10;

(*my_struct).b = 10;

my_struct->b = 10;

Both my_struct.b = 10; and (my_struct).b = 10;

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?