Login
Register
@
Dark Mode
Profile
Edit my Profile
Messages
My favorites
Register
Activity
Q&A
Questions
Unanswered
Tags
Subjects
Users
Ask
Previous Years
Blogs
New Blog
Exams
Dark Mode
Webpage
Programming in C.
Recursion.
Filter
Recent
Hot!
Most votes
Most answers
Most views
Previous GATE
Featured
Previous GATE Questions in Programming and DS
13
votes
6
answers
41
GATE CSE 2019 | Question: 24
Consider the following C program: #include <stdio.h> int main() { int arr[]={1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 5}, *ip=arr+4; printf(“%d\n”, ip[1]); return 0; } The number that will be displayed on execution of the program is _______
Arjun
asked
in
Programming in C
Feb 7, 2019
by
Arjun
13.4k
views
gatecse-2019
numerical-answers
programming-in-c
programming
array
easy
1-mark
59
votes
9
answers
42
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$
Arjun
asked
in
Programming in C
Feb 7, 2019
by
Arjun
27.2k
views
gatecse-2019
programming-in-c
programming
2-marks
32
votes
7
answers
43
GATE CSE 2019 | Question: 40
Consider the following statements: The smallest element in a max-heap is always at a leaf node The second largest element in a max-heap is always a child of a root node A max-heap can be constructed from a binary search tree in $\Theta(n)$ time A binary search tree ... time Which of the above statements are TRUE? I, II and III I, II and IV I, III and IV II, III and IV
Arjun
asked
in
DS
Feb 7, 2019
by
Arjun
20.5k
views
gatecse-2019
data-structures
binary-heap
2-marks
71
votes
9
answers
44
GATE CSE 2019 | Question: 46
Let $T$ be a full binary tree with $8$ leaves. (A full binary tree has every level full.) Suppose two leaves $a$ and $b$ of $T$ are chosen uniformly and independently at random. The expected value of the distance between $a$ and $b$ in $T$ (ie., the number of edges in the unique path between $a$ and $b$) is (rounded off to $2$ decimal places) _________.
Arjun
asked
in
DS
Feb 7, 2019
by
Arjun
30.6k
views
gatecse-2019
numerical-answers
data-structures
binary-tree
2-marks
21
votes
3
answers
45
GATE CSE 2019 | Question: 52
Consider the following C program: #include <stdio.h> int main() { float sum = 0.0, j=1.0, i=2.0; while (i/j > 0.0625) { j=j+j; sum=sum+i/j; printf("%f\n", sum); } return 0; } The number of times the variable sum will be printed, when the above program is executed, is _________
Arjun
asked
in
Programming in C
Feb 7, 2019
by
Arjun
12.6k
views
gatecse-2019
numerical-answers
programming-in-c
programming
2-marks
18
votes
2
answers
46
GATE CSE 2019 | Question: 53
Consider the following C program: #include <stdio.h> int main() { int a[] = {2, 4, 6, 8, 10}; int i, sum=0, *b=a+4; for (i=0; i<5; i++) sum=sum+(*b-i)-*(b-i); printf("%d\n", sum); return 0; } The output of the above C program is _______
Arjun
asked
in
Programming in C
Feb 7, 2019
by
Arjun
15.3k
views
gatecse-2019
numerical-answers
programming-in-c
programming
2-marks
1
vote
0
answers
47
GATE CSE 1997 | Question: 16
In this GATE ques- Part a) For Size balanced tree the recurrence (max height) is T(h)=T(h-1) +T(h-2) +1, solving which we get T(0)=1, T(1)=2,T(2)=1+2+1=4, T(3)=4+2+1=7 Here, T(0),T(1),T(2) are of the form 2h but T(3) is not equal to 23 then how can we claim that "size-balance binary tree of height 'h' contain at least 2h nodes." ?
closed
Mamta Satywali
asked
in
DS
Mar 14, 2018
by
Mamta Satywali
1.1k
views
gate1997
data-structures
binary-tree
67
votes
14
answers
48
GATE CSE 2018 | Question: 46
The number of possible min-heaps containing each value from $\{1,2,3,4,5,6,7\}$ exactly once is _______
gatecse
asked
in
DS
Feb 14, 2018
by
gatecse
38.9k
views
gatecse-2018
binary-heap
numerical-answers
combinatory
2-marks
46
votes
5
answers
49
GATE CSE 2018 | Question: 29
#include<stdio.h> void fun1(char* s1, char* s2){ char* temp; temp = s1; s1 = s2; s2 = temp; } void fun2(char** s1, char** s2){ char* temp; temp = *s1; *s1 = *s2; *s2 = temp; } int main(){ char *str1="Hi", *str2 = "Bye"; fun1 ... of the program above is: $\text{Hi Bye Bye Hi}$ $\text{Hi Bye Hi Bye}$ $\text{Bye Hi Hi Bye}$ $\text{Bye Hi Bye Hi}$
gatecse
asked
in
Programming in C
Feb 14, 2018
by
gatecse
15.1k
views
gatecse-2018
programming-in-c
pointers
parameter-passing
normal
programming
2-marks
33
votes
5
answers
50
GATE CSE 2018 | Question: 32
Consider the following C code. Assume that unsigned long int type length is $64$ bits. unsigned long int fun(unsigned long int n) { unsigned long int i, j=0, sum = 0; for( i=n; i>1; i=i/2) j++; for( ; j>1; j=j/2) sum++; return sum; } The value returned when we call fun with the input $2^{40}$ is: $4$ $5$ $6$ $40$
gatecse
asked
in
Programming in C
Feb 14, 2018
by
gatecse
16.0k
views
gatecse-2018
programming-in-c
normal
programming
2-marks
23
votes
5
answers
51
GATE CSE 2018 | Question: 21
Consider the following $\text{C}$ program: #include<stdio.h> int counter=0; int calc (int a, int b) { int c; counter++; if(b==3) return (a*a*a); else { c = calc(a, b/3); return (c*c*c); } } int main() { calc(4, 81); printf("%d", counter); } The output of this program is ______.
gatecse
asked
in
Programming in C
Feb 14, 2018
by
gatecse
10.9k
views
gatecse-2018
programming-in-c
numerical-answers
recursion
programming
1-mark
22
votes
3
answers
52
GATE CSE 2018 | Question: 20
The postorder traversal of a binary tree is $\text{8, 9, 6, 7, 4, 5, 2, 3, 1}$. The inorder traversal of the same tree is ${8, 6, 9, 4, 7, 2, 5, 1, 3}$. The height of a tree is the length of the longest path from the root to any leaf. The height of the binary tree above is _____
gatecse
asked
in
DS
Feb 14, 2018
by
gatecse
12.0k
views
gatecse-2018
data-structures
binary-tree
numerical-answers
1-mark
36
votes
6
answers
53
GATE CSE 2018 | Question: 3
A queue is implemented using a non-circular singly linked list. The queue has a head pointer and a tail pointer, as shown in the figure. Let $n$ denote the number of nodes in the queue. Let 'enqueue' be implemented by inserting a new node at the head, and 'dequeue' ... $\Theta(1), \Theta(n)$ $\Theta(n), \Theta(1)$ $\Theta(n), \Theta(n)$
gatecse
asked
in
DS
Feb 14, 2018
by
gatecse
15.3k
views
gatecse-2018
algorithms
data-structures
queue
normal
linked-list
1-mark
42
votes
9
answers
54
GATE CSE 2018 | Question: 2
Consider the following C program: #include<stdio.h> struct Ournode{ char x, y, z; }; int main() { struct Ournode p={'1', '0', 'a'+2}; struct Ournode *q=&p; printf("%c, %c", *((char*)q+1), *((char*)q+2)); return 0; } The output of this program is: 0, c 0, a+2 '0', 'a+2' '0', 'c'
gatecse
asked
in
Programming in C
Feb 14, 2018
by
gatecse
20.3k
views
gatecse-2018
programming-in-c
programming
structure
normal
1-mark
2
votes
1
answer
55
GATE CSE 2017 Set 1 | Question: 36
https://gateoverflow.in/118319/gate2017-1-36 what is the logic of bar() function please help
A_i_$_h
asked
in
Programming in C
Oct 25, 2017
by
A_i_$_h
737
views
85
votes
11
answers
56
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.
khushtak
asked
in
DS
Feb 14, 2017
by
khushtak
25.7k
views
gatecse-2017-set1
data-structures
linked-list
normal
101
votes
9
answers
57
GATE CSE 2017 Set 1 | Question: 53
Consider the following C program. #include<stdio.h> #include<string.h> void printlength(char *s, char *t) { unsigned int c=0; int len = ((strlen(s) - strlen(t)) > c) ? strlen(s) : strlen(t); printf("%d\n", len); } ... in $string.h$ as returning a value of type $size\_t$, which is an unsigned int. The output of the program is __________ .
srestha
asked
in
Programming in C
Feb 14, 2017
by
srestha
24.9k
views
gatecse-2017-set1
programming
programming-in-c
normal
numerical-answers
68
votes
5
answers
58
GATE CSE 2017 Set 1 | Question: 55
The output of executing the following C program is _______________ . #include<stdio.h> int total(int v) { static int count = 0; while(v) { count += v&1; v >>= 1; } return count; } void main() { static int x=0; int i=5; for(; i>0; i--) { x = x + total(i); } printf("%d\n", x); }
srestha
asked
in
Programming in C
Feb 14, 2017
by
srestha
22.4k
views
gatecse-2017-set1
programming
programming-in-c
normal
numerical-answers
54
votes
7
answers
59
GATE CSE 2017 Set 2 | Question: 43
Consider the following snippet of a C program. Assume that swap $(\&x, \&y)$ exchanges the content of $x$ and $y$: int main () { int array[] = {3, 5, 1, 4, 6, 2}; int done =0; int i; while (done==0) { done =1; for (i=0; i<=4; i ... i-1]) { swap(&array[i], &array[i-1]); done =0; } } } printf( %d , array[3]); } The output of the program is _______
Arjun
asked
in
Programming in C
Feb 14, 2017
by
Arjun
16.9k
views
gatecse-2017-set2
programming
algorithms
numerical-answers
identify-function
36
votes
6
answers
60
GATE CSE 2017 Set 2 | Question: 37
Consider the C program fragment below which is meant to divide $x$ by $y$ using repeated subtractions. The variables $x$, $y$, $q$ and $r$ are all unsigned int. while (r >= y) { r=r-y; q=q+1; } Which of the following conditions on the variables $x, y, q$ and $r$ ... $(q==0) \ \&\& \ (y>0)$
Arjun
asked
in
Programming in C
Feb 14, 2017
by
Arjun
14.1k
views
gatecse-2017-set2
programming
loop-invariants
Page:
« prev
1
2
3
4
5
6
7
8
...
16
next »
Subscribe to GATE CSE 2024 Test Series
Subscribe to GO Classes for GATE CSE 2024
Quick search syntax
tags
tag:apple
author
user:martin
title
title:apple
content
content:apple
exclude
-tag:apple
force match
+apple
views
views:100
score
score:10
answers
answers:2
is accepted
isaccepted:true
is closed
isclosed:true
Recent Posts
Post GATE 2024 Guidance [Counseling tips and resources]
GATE CSE 2024 Result Responses
[Project Contest] Pytorch backend support for MLCommons Cpp Inference implementation
Participating in MLCommons Inference v4.0 submission (deadline is February 23 12pm IST)
IIITH PGEE 2024 Test Series by GO Classes
Subjects
All categories
General Aptitude
(3.5k)
Engineering Mathematics
(10.4k)
Digital Logic
(3.6k)
Programming and DS
(6.2k)
Programming
(4.1k)
DS
(2.0k)
Algorithms
(4.8k)
Theory of Computation
(6.9k)
Compiler Design
(2.5k)
Operating System
(5.2k)
Databases
(4.8k)
CO and Architecture
(4.0k)
Computer Networks
(4.9k)
Artificial Intelligence
(79)
Machine Learning
(48)
Data Mining and Warehousing
(25)
Non GATE
(1.4k)
Others
(2.7k)
Admissions
(684)
Exam Queries
(1.6k)
Tier 1 Placement Questions
(17)
Job Queries
(80)
Projects
(11)
Unknown Category
(870)
64.3k
questions
77.9k
answers
244k
comments
80.0k
users
Previous GATE Questions in Programming and DS
Recent Blog Comments
category ?
Hi @Arjun sir, I have obtained a score of 591 in ...
download here
Can you please tell about IIT-H mtech CSE self...
Please add your admission queries here:...
Network Sites
GO Mechanical
GO Electrical
GO Electronics
GO Civil
CSE Doubts
Aptitude Overflow