Login
Register
Dark Mode
Brightness
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Webpage
Programming in C.
Recursion.
Filter
Recent
Hot!
Most votes
Most answers
Most views
Previous GATE
Featured
Most viewed questions in Programming and DS
72
votes
4
answers
31
GATE CSE 2003 | Question: 2
Assume the following C variable declaration: int *A[10], B[10][10]; Of the following expressions: $A[2]$ $A[2][3]$ $B[1]$ $B[2][3]$ which will not give compile-time errors if used as left hand sides of assignment statements in a C program? I, II, and IV only II, III, and IV only II and IV only IV only
Assume the following C variable declaration:int *A[10], B[10][10];Of the following expressions:$A $$A [3]$$B $$B [3]$which will not give compile-time errors if used as le...
Kathleen
30.2k
views
Kathleen
asked
Sep 16, 2014
Programming in C
gatecse-2003
programming
programming-in-c
easy
pointers
+
–
45
votes
8
answers
32
GATE CSE 1998 | Question: 2.14
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]$? $15i+j+84$ $15j+i+84$ $10i+j+89$ $10j+i+89$
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 sto...
Kathleen
29.9k
views
Kathleen
asked
Sep 25, 2014
DS
gate1998
data-structures
array
easy
+
–
62
votes
11
answers
33
GATE IT 2007 | Question: 28
Consider a hash function that distributes keys uniformly. The hash table size is $20$. After hashing of how many keys will the probability that any new key hashed collides with an existing one exceed $0.5$. $5$ $6$ $7$ $10$
Consider a hash function that distributes keys uniformly. The hash table size is $20$. After hashing of how many keys will the probability that any new key hashed collide...
Ishrat Jahan
29.4k
views
Ishrat Jahan
asked
Oct 29, 2014
DS
gateit-2007
data-structures
hashing
probability
normal
+
–
3
votes
2
answers
34
ISRO2018-79
A doubly linked list is declared as: struct Node { int Value; struct Node *Fwd; struct Node *Bwd; }; Where Fwd and Bwd represent forward and backward link to the adjacent elements of the list. Which of the following segment of code deletes the node pointed to by ... Bwd = X.Bwd; X$\rightarrow$Bwd$\rightarrow$Fwd = X$\rightarrow$Bwd; X$\rightarrow$Fwd$\rightarrow$Bwd = X$\rightarrow$Fwd;
A doubly linked list is declared as:struct Node { int Value; struct Node *Fwd; struct Node *Bwd; };Where Fwd and Bwd represent forward and backward link to the adjacent e...
Arjun
28.7k
views
Arjun
asked
Apr 22, 2018
DS
isro2018
linked-list
data-structures
+
–
110
votes
6
answers
35
GATE CSE 2015 Set 1 | Question: 35
What is the output of the following C code? Assume that the address of $x$ is $2000$ (in decimal) and an integer requires four bytes of memory. int main () { unsigned int x [4] [3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12}}; printf ("%u, %u, %u", x + 3, *(x + 3), *(x + 2) + 3); } $2036, 2036, 2036$ $2012, 4, 2204$ $2036, 10, 10$ $2012, 4, 6$
What is the output of the following C code? Assume that the address of $x$ is $2000$ (in decimal) and an integer requires four bytes of memory.int main () { unsigned int ...
makhdoom ghaya
28.3k
views
makhdoom ghaya
asked
Feb 13, 2015
Programming in C
gatecse-2015-set1
programming
programming-in-c
array
normal
+
–
75
votes
11
answers
36
GATE CSE 1994 | Question: 1.11
In a compact single dimensional array representation for lower triangular matrices (i.e all the elements above the diagonal are zero) of size $n \times n$, non-zero elements, (i.e elements of lower triangle) of each row are stored one after another, starting from the first row, the index of the ... is: $i+j$ $i+j-1$ $(j-1)+\frac{i(i-1)}{2}$ $i+\frac{j(j-1)}{2}$
In a compact single dimensional array representation for lower triangular matrices (i.e all the elements above the diagonal are zero) of size $n \times n$, non-zero eleme...
Kathleen
28.3k
views
Kathleen
asked
Oct 4, 2014
DS
gate1994
data-structures
array
normal
+
–
39
votes
4
answers
37
GATE CSE 2002 | Question: 2.8
Consider the following declaration of a two-dimensional array in C: char $a[100][100]$; Assuming that the main memory is byte-addressable and that the array is stored starting from memory address $0$, the address of $a [40][50]$ is: $4040$ $4050$ $5040$ $5050$
Consider the following declaration of a two-dimensional array in C:char $a[100][100]$;Assuming that the main memory is byte-addressable and that the array is stored start...
Kathleen
28.0k
views
Kathleen
asked
Sep 15, 2014
Programming in C
gatecse-2002
programming-in-c
programming
easy
+
–
70
votes
13
answers
38
GATE CSE 2017 Set 2 | Question: 55
Consider the following C program. #include<stdio.h> #include<string.h> int main() { char* c="GATECSIT2017"; char* p=c; printf("%d", (int)strlen(c+2[p]-6[p]-1)); return 0; } The output of the program is _______
Consider the following C program.#include<stdio.h #include<string.h int main() { char* c="GATECSIT2017"; char* p=c; printf("%d", (int)strlen(c+2[p]-6[p]-1)); return 0; }T...
Madhav
28.0k
views
Madhav
asked
Feb 14, 2017
Programming in C
gatecse-2017-set2
programming-in-c
numerical-answers
array
pointers
+
–
35
votes
11
answers
39
GATE CSE 2017 Set 2 | Question: 13
A circular queue has been implemented using a singly linked list where each node consists of a value and a single pointer pointing to the next node. We maintain exactly two external pointers FRONT and REAR pointing to the front node and the rear node of the queue, respectively ... to the front node. (I) only. (II) only. Both (I) and (II). Neither (I) nor (II).
A circular queue has been implemented using a singly linked list where each node consists of a value and a single pointer pointing to the next node. We maintain exactly t...
Madhav
27.7k
views
Madhav
asked
Feb 14, 2017
DS
gatecse-2017-set2
data-structures
queue
+
–
59
votes
9
answers
40
GATE CSE 2019 | Question: 27
Consider the following C program: #include <stdio.h> int r() { static int num=7; return num--; } int main() { for (r();r();r()) printf(“%d”,r()); return 0; } Which one of the following values will be displayed on execution of the programs? $41$ $52$ $63$ $630$
Consider the following C program:#include <stdio.h int r() { static int num=7; return num ; } int main() { for (r();r();r()) printf(“%d”,r()); return 0; }Which one of...
Arjun
27.4k
views
Arjun
asked
Feb 7, 2019
Programming in C
gatecse-2019
programming-in-c
programming
2-marks
+
–
73
votes
10
answers
41
GATE CSE 2010 | Question: 53
A hash table of length $10$ uses open addressing with hash function $h(k) = k \: \mod \: 10$, and linear probing. After inserting $6$ ... of the key values using the same hash function and linear probing will result in the hash table shown above? $10$ $20$ $30$ $40$
A hash table of length $10$ uses open addressing with hash function $h(k) = k \: \mod \: 10$, and linear probing. After inserting $6$ values into an empty hash table, the...
go_editor
27.3k
views
go_editor
asked
Apr 21, 2016
DS
data-structures
hashing
normal
gatecse-2010
+
–
101
votes
6
answers
42
GATE IT 2006 | Question: 49
Which one of the choices given below would be printed when the following program is executed ? #include <stdio.h> struct test { int i; char *c; }st[] = {5, "become", 4, "better", 6, "jungle", 8, "ancestor", 7, " ... $\text{etter, u, 6, ungle}$ $\text{cetter, k, 6, jungle}$ $\text{etter, u, 8, ncestor}$
Which one of the choices given below would be printed when the following program is executed ?#include <stdio.h struct test { int i; char *c; }st[] = {5, "become", 4, "be...
Ishrat Jahan
27.2k
views
Ishrat Jahan
asked
Oct 31, 2014
Programming in C
gateit-2006
programming
programming-in-c
normal
structure
+
–
36
votes
9
answers
43
GATE CSE 2020 | Question: 16
What is the worst case time complexity of inserting $n$ elements into an empty linked list, if the linked list needs to be maintained in sorted order? $\Theta(n)$ $\Theta(n \log n)$ $\Theta ( n)^{2}$ $\Theta(1)$
What is the worst case time complexity of inserting $n$ elements into an empty linked list, if the linked list needs to be maintained in sorted order?$\Theta(n)$$\Theta(n...
Arjun
26.6k
views
Arjun
asked
Feb 12, 2020
DS
gatecse-2020
linked-list
1-mark
+
–
57
votes
11
answers
44
GATE IT 2006 | Question: 9
In a binary tree, the number of internal nodes of degree $1$ is $5$, and the number of internal nodes of degree $2$ is $10$. The number of leaf nodes in the binary tree is $10$ $11$ $12$ $15$
In a binary tree, the number of internal nodes of degree $1$ is $5$, and the number of internal nodes of degree $2$ is $10$. The number of leaf nodes in the binary tree i...
Ishrat Jahan
26.2k
views
Ishrat Jahan
asked
Oct 31, 2014
DS
gateit-2006
data-structures
binary-tree
normal
+
–
31
votes
8
answers
45
GATE CSE 2007 | Question: 43
A complete $n-ary$ tree is a tree in which each node has $n$ children or no children. Let $I$ be the number of internal nodes and $L$ be the number of leaves in a complete $n-ary$ tree. If $L = 41$ and $I = 10$, what is the value of $n$? $3$ $4$ $5$ $6$
A complete $n-ary$ tree is a tree in which each node has $n$ children or no children. Let $I$ be the number of internal nodes and $L$ be the number of leaves in a complet...
Kathleen
25.9k
views
Kathleen
asked
Sep 21, 2014
DS
gatecse-2007
data-structures
tree
normal
+
–
73
votes
5
answers
46
GATE CSE 2016 Set 2 | Question: 34
A complete binary min-heap is made by including each integer in $[1, 1023]$ exactly once. The depth of a node in the heap is the length of the path from the root of the heap to that node. Thus, the root is at depth $0$. The maximum depth at which integer $9$ can appear is _________.
A complete binary min-heap is made by including each integer in $[1, 1023]$ exactly once. The depth of a node in the heap is the length of the path from the root of the h...
Akash Kanase
25.9k
views
Akash Kanase
asked
Feb 12, 2016
DS
gatecse-2016-set2
data-structures
binary-heap
normal
numerical-answers
+
–
26
votes
4
answers
47
GATE CSE 2007 | Question: 12
The height of a binary tree is the maximum number of edges in any root to leaf path. The maximum number of nodes in a binary tree of height $h$ is: $2^h -1$ $2^{h-1} -1$ $2^{h+1} -1$ $2^{h+1}$
The height of a binary tree is the maximum number of edges in any root to leaf path. The maximum number of nodes in a binary tree of height $h$ is:$2^h -1$$2^{h-1} -1$$2^...
Kathleen
25.9k
views
Kathleen
asked
Sep 21, 2014
DS
gatecse-2007
data-structures
binary-tree
easy
+
–
85
votes
11
answers
48
GATE CSE 2017 Set 1 | Question: 08
Consider the C code fragment given below. typedef struct node { int data; node* next; } node; void join(node* m, node* n) { node* p = n; while(p->next != NULL) { p = p->next; } p->next = m; } Assuming that m and n ... append list m to the end of list n. cause a null pointer dereference for all inputs. append list n to the end of list m for all inputs.
Consider the C code fragment given below.typedef struct node { int data; node* next; } node; void join(node* m, node* n) { node* p = n; while(p->next != NULL) { p = p->ne...
khushtak
25.8k
views
khushtak
asked
Feb 14, 2017
DS
gatecse-2017-set1
data-structures
linked-list
normal
+
–
0
votes
1
answer
49
Linked list insertion
In a linked list with $n$ nodes, the time taken to insert an element after an element pointed by some pointer is: $(A) O(1)$ $(B) O(logn)$ $(C) O(n)$ $(D) O(nlogn)$
In a linked list with $n$ nodes, the time taken to insert an element after an elementpointed by some pointer is:$(A) O(1)$$(B) O(logn)$$(C) O(n)$$(D) O(nlogn)$
Lakshman Bhaiya
25.6k
views
Lakshman Bhaiya
asked
Oct 17, 2018
DS
data-structures
linked-list
+
–
85
votes
6
answers
50
GATE IT 2006 | Question: 50
Which one of the choices given below would be printed when the following program is executed? #include <stdio.h> void swap (int *x, int *y) { static int *temp; temp = x; x = y; y = temp; } void printab () { static int i, a = -3, b = -6; i = 0; while (i <= 4) { if ((i++)%2 == 1 ... $a = 12, b = 9$ $a = 3, b = 6$ $a = 3, b = 6$ $a = 6, b = 3$ $a = 15, b = 12$
Which one of the choices given below would be printed when the following program is executed?#include <stdio.h void swap (int *x, int *y) { static int *temp; temp = x; x ...
Ishrat Jahan
25.6k
views
Ishrat Jahan
asked
Oct 31, 2014
Programming in C
gateit-2006
programming
programming-in-c
normal
parameter-passing
+
–
Page:
« prev
1
2
3
4
5
6
7
...
310
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register