Self Studies

Programming and...

TIME LEFT -
  • Question 1
    2 / -0.33

    A stack A has 4 entries as following sequence a,b,c,d and stack B is empty. An entry popped out of stack A can be printed or pushed to stack B. An entry popped out of stack B can only be printed.

    Then the number of possible permutations that the entries can be printed will be ?

  • Question 2
    2 / -0.33

    What is the maximum height of any AVL tree with 20 nodes?

    NOTE: Height of tree with single node is 0.

  • Question 3
    2 / -0.33

    Which one of the choices given below would be printed when the following program is executed?

    #include<stdio.h>

    struct node {

    int i;

    char *s;

    }tb[] = {1, "poor", 10, "average", 3, "good", 4, "very good", 5, "excellent"};

    int main()

    {

    struct node *p = tb;

    printf("%s", (++p+2)-> s);

    return 0;

    }

  • Question 4
    2 / -0.33

    Consider a binary tree which consist of 255 nodes. Height of a tree is 1 if it consists of single node. What is the minimum height of the tree?

  • Question 5
    2 / -0.33

    An item that is read as input can be either pushed to a stack and later popped and printed, or printed directly. Which of the following will be the output if the input is the sequence of items -1, 2, 3, 4, 5?

  • Question 6
    2 / -0.33

    The concatenation of two lists is to be performed in O(1) time. Which of the following implementations of a list could be used?

  • Question 7
    2 / -0.33

    Identify the wrong output stack permutation for the Input sequence in 1, 2, 3, 4, 5 and pop can occur at any time in stack.

  • Question 8
    2 / -0.33

    What is the output of the below given code
    #include<stdio.h>
    #include<string.h>
    int main()
    {
    char s1[] = "TESTBOOk";
    char s2[] = "TESTBOOK";
    printf("%d",strcmp(s1,s2));
    return 0;
    }

  • Question 9
    2 / -0.33

    Consider the following C program:

    #include <stdio.h>

    int main ( )

    {

    int  A[ ] = {4, 3, 2, 1, 5, 6, 7, 9, 10, 11, 12, 0 }, *ptr = A + 6;

    printf (“ % d \n”, 3[ptr]);

    return 0;

    }

    The number that will be displayed on execution of the program is _________.

  • Question 10
    2 / -0.33

    Which of the following is essential for converting an infix expression to the postfix form efficiently?

  • Question 11
    2 / -0.33

    Consider the following C program:

    #include <stdio.h>

    int swap (int *p, int  *q)

    {

    *p = 3*(*p) + (*q);

    return *p;

    }

    int main ( )

    {

    int a = 12, b = 21;

    a = swap(&b, &a);

    b = swap(&a, &b);

    printf("%d\n", b);

    }

    The value printed by the program is _________.

  • Question 12
    2 / -0.33

    Carefully observe the below given queue

    REAR

    22

    57

    96

    68

    19

    15

    28

    FRONT

    How many dequeue operations needed to delete the largest element from the queue?

  • Question 13
    2 / -0.33

    Consider a two dimensional array X[-10…5, 7….15] in which staring location is at 250. If every data of given array takes 4 byte of space and store in column major order, then what will be the location of A[2][10]

  • Question 14
    2 / -0.33

    What can we say about the array representation of a circular queue when it contains only one element?

  • Question 15
    2 / -0.33

    Which of the following statement is/are not true?

    I. First-in-first out types of computations are efficiently supported by stacks.

    II. Implementing queues on a linear array with two indices is more efficient then implementing queues on a circular array.

    III. The best data structure to check whether an arithmetic expression has balanced parenthesis is a queue.

  • Question 16
    2 / -0.33

    In a compact single dimensional array representation for lower triangular matrices (i.e. all the elements above the diagonal are zero) of size n x n, non-zero elements (i.e. elements of the lower triangle) of each row are stored one after another, starting from the first row, the index of the (i, j)th element of the lower triangular matrix in this new representation is

  • Question 17
    2 / -0.33

    What is the postfix expression corresponding to the infix expression?

    x – y + z ^ a × b ^ c / d + e

    In the above expression, ^ is exponentiation operator, × is multiplication operator, / is division operator, + is addition operator and – is subtraction operator also ×, + and – are left associative wile ^ is right associative.

  • Question 18
    2 / -0.33

    Consider the following C program:

    #include<stdio.h>

    #include<string.h>

    int main()

    {

        char *t = "GATECSITtwenty-20";

        char *p = t;

        printf("%d", (int)strlen(p + 3[p]-4[p] + 1));

        return 0;

    }

    The output of the above code is ____.

  • Question 19
    2 / -0.33

    Let A be a two-dimensional array declared as follows:

    A : array [1 ... 10] [1... 15] of integer;

    Assuming that each integer takes one memory location. The array is stored in row-major order and the first element of the array is stored at location 100, what is the address of the element A [i] [j] ?

  • Question 20
    2 / -0.33

    Consider the following C program:

    #include <stdio.h>

    int main () {

    float s = 0.0, m = 1.0, n = 2.0;

    while (n/m>= 0.03125) {

    m = m + m;

    s= s + n/m;

    printf(" % .4f \n", s);  //line 7

    }

    return 0;

    }

    The number of times line 7 will be executed is _______.

  • Question 21
    2 / -0.33

    An n x n array v is defined as follows: v[i, j] = i - j for all i, j, 1 < i < n, 1 < j < n.The sum of the elements of the array v is:

  • Question 22
    2 / -0.33

    Suppose you are given an array s[1...n] and a procedure reverse (s, i, j) which reverses the order of elements in between positions i and j (both inclusive). What does the following sequence do, where 1 < k < n:

    reverse (s, 1, k):
    reverse (s, k + 1, n):
    reverse (s, 1, n);

  • Question 23
    2 / -0.33

    Which of these best describes an array?

  • Question 24
    2 / -0.33

    Consider the below given code?

    #include <stdio.h>

    int main()

    {

    int ary[ ] = {1, 3, 5, 7, 9, 11};

    int k, count = 0, *p = ary + 4;

    for (k = 0; k < 6; k++)

    count = count + (*p - k) - *(p - k);

    printf ("%d \n",count);

    return 0;

    }

    What is the value printed after the code execution?

  • Question 25
    2 / -0.33

    What is the output in a 32 bit machine with 32 bit compiler?

    #include<stdio.h>

    rer(int **ptr2,int **ptr1)

    {

        int*ii;

        ii=*ptr2;

        *ptr2=*ptr1;

        *ptr1=ii;

        **ptr1 *= **ptr2;

        **ptr2 += **ptr1;

    }

    void main( )

    {

        int var1=5, var2=10;

        int *ptr1=&var1, *ptr2=&var2;

        rer(&ptr1, &ptr2);

        printf(“%d %d “,var2, var1);

    }

Submit Test
Self Studies
User
Question Analysis
  • Answered - 0

  • Unanswered - 25

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
Submit Test
Self Studies Get latest Exam Updates
& Study Material Alerts!
No, Thanks
Self Studies
Click on Allow to receive notifications
Allow Notification
Self Studies
Self Studies Self Studies
To enable notifications follow this 2 steps:
  • First Click on Secure Icon Self Studies
  • Second click on the toggle icon
Allow Notification
Get latest Exam Updates & FREE Study Material Alerts!
Self Studies ×
Open Now