Data Structure and Algorithms (DSA) MCQs with answers Page - 29

Here, you will find a collection of MCQ questions on Data Structure and Algorithms (DSA). Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

A

Admin • 833.24K Points
Coach

Q. What will be output if you will compile and execute the following c code? #include<stdio.h>
int main(){
printf("%d",sizeof(5.2)); return 0;
}

  • (A) 2
  • (B) 4
  • (C) 8
  • (D) 10

A

Admin • 833.24K Points
Coach

Q. What will be output if you will compile and execute the following c code? #include<stdio.h>
#define call(x,y) x##y
int main(){
int x=5,y=10,xy=20;
printf("%d",xy+call(x,y)); return 0;
}

  • (A) 35
  • (B) 510
  • (C) 15
  • (D) 40

A

Admin • 833.24K Points
Coach

Q. What will be output if you will compile and execute the following c code? #include<stdio.h>
int * call();
int main(){ int *ptr;
ptr=call();
printf("%d",*ptr); return 0;
} int * call(){
int a=25;
a++;
return &a;
}

  • (A) 25
  • (B) 26
  • (C) any adress
  • (D) garbage value

A

Admin • 833.24K Points
Coach

Q. The program fragment
int i = 263 ;
putchar (i) ;
prints

  • (A) 263
  • (B) ascii equivalent of 263
  • (C) rings the bell
  • (D) garbage

A

Admin • 833.24K Points
Coach

Q. The variables which can be accessed by all modules in a program, are called

  • (A) local variables
  • (B) internal variables
  • (C) external variable
  • (D) global variables

A

Admin • 833.24K Points
Coach

Q. The main measures of efficiency of an algorithm are

  • (A) processor and memory
  • (B) complexity and capacity
  • (C) time and space
  • (D) data and space

A

Admin • 833.24K Points
Coach

Q. The worst case occures in linear search algorithms when

  • (A) item is somewhere in the middle of the array
  • (B) item is not there in the array at all
  • (C) item is last element in the array
  • (D) item is last element in the array or is not there at all.

A

Admin • 833.24K Points
Coach

Q. the terms push and pop are related to

  • (A) stack
  • (B) queue
  • (C) array
  • (D) none of the above

A

Admin • 833.24K Points
Coach

Q. What will be the output of the program? #include<stdio.h>
int main()
{
int X=40;
{
int X=20;
printf("%d ", X);
}
printf("%d
", X);
return 0;
}

  • (A) 40 40
  • (B) 20 20
  • (C) 20
  • (D) error

A

Admin • 833.24K Points
Coach

Q. What additional requirement is placed on an array, so that binary search may be used to locate an entry?

  • (A) the array elements must form a heap
  • (B) the array must have at least 2 entries.
  • (C) the array must be sorted.
  • (D) the arrays size must be a power of two.

Add MCQ in this Category

If you want to share an MCQ question in this category, it's a great idea! It will be helpful for many other students using this website.

Share Your MCQ