gs gs121 Abstract Data Types - Stack using Array - Quiz No.1
gs gs121 Data Structures and Algorithms Quiz
This quiz belongs to book/course code gs gs121 Data Structures and Algorithms of gs organization. We have 169 quizzes available related to the book/course Data Structures and Algorithms. This quiz has a total of 10 multiple choice questions (MCQs) to prepare and belongs to topic Abstract Data Types. NVAEducation wants its users to help them learn in an easy way. For that purpose, you are free to prepare online MCQs and quizzes.
NVAEducation also facilitates users to contribute in online competitions with other students to make a challenging situation to learn in a creative way. You can create one to one, and group competition on an topic of a book/course code. Also on NVAEducation you can get certifications by passing the online quiz test.
#define MAX 10 typedef struct stack { int top; int item[MAX]; }stack; int function(stack *s) { if(s->top == -1) return 1; else return 0; }
Assume: 'a' is a non empty array of integers, the Stack class creates an array of specified size and provides a top pointer indicating TOS(top of stack), push and pop have normal meaning.
public void some_function(int[] a) { Stack S=new Stack(a.length); int[] b=new int[a.length]; for(int i=0;i<a.length;i++) { S.push(a[i]); } for(int i=0;i<a.length;i++) { b[i]=(int)(S.pop()); } System.out.println("output :"); for(int i=0;i<b.length;i++) { System.out.println(b[i]); } }