Login
Register
Dark Mode
Brightness
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Webpage
Programming in C.
Recursion.
Filter
No answer
No selected answer
No upvoted answer
Previous GATE
Featured
Questions without a selected answer in Programming and DS
1
votes
0
answers
1
Arrays
Consider an integer upper triangular 2D array arr[–8 to +7][–8 to +7] having base address 1000. If the size of the integer is 4 bytes, the address of the element present at location arr[–6][4] is- ____________.
Consider an integer upper triangular 2D array arr[–8 to +7][–8 to +7] having base address 1000. If the size of the integer is 4 bytes, the address of the element pres...
piyush512
57
views
piyush512
asked
4 days
ago
DS
array
data-structures
+
–
0
votes
1
answer
2
C Programming - Arrays & Pointer (NAT)
#include <stdio.h> int main() { int a[3][2] = {1, 3, 5, 7, 9, 11}; int *ptr = a[0]; ptr += sizeof(int); printf("%d", *ptr); return 0; } (Assume size of int to be $2$ bytes.) The output is __________.
#include <stdio.h int main() { int a[3] = {1, 3, 5, 7, 9, 11}; int *ptr = a[0]; ptr += sizeof(int); printf("%d", *ptr); return 0; }(Assume size of int to be $2$ bytes.)T...
Debargha Mitra Roy
72
views
Debargha Mitra Roy
asked
Apr 16
Programming in C
array
data-structures
programming-in-c
+
–
0
votes
0
answers
3
Bitwise Operator - C Programming
Problem Statement: Class teacher to IX-C wants to store whether a particular student has passed in exams. The class has a strength of $32$ students. Their roll numbers lie in the range: $[1, 32]$. The teacher used bits of an integer to store ... Bitwise OR (|) operator and count number of set bits d. Apply Bitwise AND (&) operator and count number of set bits
Problem Statement: Class teacher to IX-C wants to store whether a particular student has passed in exams. The class has a strength of $32$ students. Their roll numbers li...
Debargha Mitra Roy
128
views
Debargha Mitra Roy
asked
Apr 12
Programming in C
programming-in-c
operator-precedence
boolean-algebra
+
–
0
votes
1
answer
4
Consider the following program: #include <stdio.h> int main(){ int a=2, i; static int b=a++; for(i=0;i<a+b;i++) printf("GATE Wallah"); return 0; } Which of the following is/are CORRECT? (a) GATE Wallah is printed 3 times. (b) GATE Wallah is printed 4 times. (c) GATE Wallah is printed 5 times. (d) Compilation Error.
Consider the following program: #include <stdio.h int main(){ int a=2, i; static int b=a++; for(i=0;i<a+b;i++) printf("GATE Wallah"); return 0; }Which of the following is...
Pradeep kori 73
76
views
Pradeep kori 73
asked
Apr 11
1
votes
1
answer
5
#Recursivefunctions
int bar(int val){ int x=0; while(val > 0){ x=x+bar(val -1); } return val; } Q: For bar(3) this function is supposed to be stuck in an infinite loop but I do not know how please can someone explain?
int bar(int val){int x=0;while(val 0){x=x+bar(val -1);}return val;}Q: For bar(3) this function is supposed to be stuck in an infinite loop but I do not know how please c...
sumitkumarsethi
91
views
sumitkumarsethi
asked
Apr 8
Programming in C
recursion
functions
+
–
1
votes
0
answers
6
GATE CSE SET-1 2024
My question is that can we use command line arguments without use of main function's parameters argc and *argv?
My question is that can we use command line arguments without use of main function's parameters argc and *argv?
RahulVerma3
151
views
RahulVerma3
asked
Mar 22
Programming in C
programming-in-c
programming
+
–
0
votes
0
answers
7
GATE 2024 CSE1
I have a question that can we use command line arguments without main function arguments? int main(int argc, char **argv){ }
I have a question that can we use command line arguments without main function arguments?int main(int argc, char argv){}
RahulVerma3
146
views
RahulVerma3
asked
Mar 16
Programming in C
gatecse2024-set1
programming-in-c
+
–
0
votes
1
answer
8
class question self doubt
#include<stdio.h> #include<conio.h> int main(){ int a[][3]={ {4,14,24},{5,15,25},{6,16,26}}; int *p[3]; int **ptr=p; p[0]=a; p[1]=a+1; p[2]=a+2; ++*p; ++p[0]; ++**ptr; ++*p[0]; ++ptr; ++*ptr; --*p[1]; --*ptr; ++ptr; --p[ ... ("\n%d,%d,%d",a[0][2],a[1][1],a[2][0]); printf("\n%d,%d,%d",*p[0],*p[1],*p[2]); } what is the output of above program
#include<stdio.h>#include<conio.h>int main(){ int a[][3]={ {4,14,24},{5,15,25},{6,16,26}}; int *p[3]; int ptr=p; p[0]=a; p =a+1; p =a+2; ++*p; ...
Emankashyap
191
views
Emankashyap
asked
Mar 1
1
votes
1
answer
9
c programming
#include <stdio.h> int main() { int i = -1; int x = (unsigned char)i; printf("%d", x); return 0; } output is 255 , but please explain how
#include <stdio.h int main() { int i = -1; int x = (unsigned char)i; printf("%d", x); return 0; }output is 255 , but please explain how
SSR17
254
views
SSR17
asked
Feb 29
Programming in C
programming-in-c
+
–
1
votes
0
answers
10
I have purchased the IIIT Hyderabad 2024 test series but i can't find the test series anywhere
Khushbu Chaudhary
106
views
Khushbu Chaudhary
asked
Feb 25
0
votes
1
answer
11
Linked List
How can we find the highest element in a singly linked list in O(1)? We are free to use any extra space.
How can we find the highest element in a singly linked list in O(1)? We are free to use any extra space.
Mrityudoot
183
views
Mrityudoot
asked
Feb 25
Programming in C
linked-list
data-structures
algorithms
+
–
0
votes
1
answer
12
s.balaguruswami
Find the error of the following IP addresses. If the IP is valid, check its Class and determine whether the address is Unicast or Multicast. i) 237.15.2.1 ii) 256.1.8.9 iii) 114.34.2.8 iv) 255.254.0.1 v) 8.8.8.8
Find the error of the following IP addresses. If the IP is valid, check its Class and determine whether the address is Unicast or Multicast.i) 237.15.2.1ii) 256.1.8.9iii)...
Sheikh Rafi
109
views
Sheikh Rafi
asked
Feb 24
1
votes
1
answer
13
GATE DS&AI 2024 | Question: 11
Consider performing uniform hashing on an open address hash table with load factor $\alpha=\frac{n}{m}<1$, where $n$ elements are stored in the table with $m$ slots. The expected number of probes in an unsuccessful search is at most $\frac{1}{1-\alpha}$. Inserting ... $\frac{1}{1-\alpha}$ $1+\frac{\alpha}{2}$ $\frac{1}{1+\alpha}$
Consider performing uniform hashing on an open address hash table with load factor $\alpha=\frac{n}{m}<1$, where $n$ elements are stored in the table wi...
Arjun
815
views
Arjun
asked
Feb 16
DS
gate-ds-ai-2024
data-structures
hashing
uniform-hashing
+
–
0
votes
1
answer
14
GATE DS&AI 2024 | Question: 22
The fundamental operations in a double-ended queue $D$ are: insertFirst (e) - Insert a new element $e$ at the beginning of $D$. insertLast (e) - Insert a new element $e$ at the end of D. removeFirst () - Remove and return the first element of $D$. removeLast () ... $\mathbf{a} \leftarrow$ removeLast () The value of $\mathbf{a}$ is $\_\_\_\_\_\_\_\_$.
The fundamental operations in a double-ended queue $D$ are: insertFirst (e) - Insert a new element $e$ at the beginning of $D$. insertLast (e) - Insert a new element $e$ ...
Arjun
729
views
Arjun
asked
Feb 16
DS
gate-ds-ai-2024
numerical-answers
data-structures
+
–
0
votes
1
answer
15
GATE DS&AI 2024 | Question: 28
Consider the following Python code: def count(child_dict, i): if i not in child_dict.keys(): return 1 ans $=1$ for $j$ in child_dict[i]: ans $+=$ count (child_dict, j) return ans child_dict $=$ dict () child_dict $[0]=[1,2]$ child_dict $[1]=[3,4,5]$ ... $)$ ) Which ONE of the following is the output of this code? $6$ $1$ $8$ $9$
Consider the following Python code:def count(child_dict, i):if i not in child_dict.keys():return 1ans $=1$for $j$ in child_dict[i]:ans $+=$ count (child_dict,...
Arjun
839
views
Arjun
asked
Feb 16
Programming in Python
gate-ds-ai-2024
programming
+
–
0
votes
2
answers
16
GATE DS&AI 2024 | Question: 31
Consider the following Python function: def $\operatorname{fun}(D, s 1, s 2)$ : if $\mathrm{s} 1<\mathrm{s} 2$ ... both inclusive. It swaps the elements in $\mathrm{D}$ at indices $\mathrm{s} 1$ and $\mathrm{s} 2$, and leaves the remaining elements unchanged.
Consider the following Python function:def $\operatorname{fun}(D, s 1, s 2)$ :if $\mathrm{s} 1<\mathrm{s} 2$ :$\mathrm{D}[\mathrm{s} 1], \mathrm{D}[\mathrm...
Arjun
936
views
Arjun
asked
Feb 16
Programming in Python
gate-ds-ai-2024
programming
+
–
4
votes
2
answers
17
GATE CSE 2024 | Set 2 | Question: 3
Consider the following $\text{C}$ program. Assume parameters to a function are evaluated from right to left. #include <stdio.h> int g( int p) { printf("%d", p); return p; } int h(i nt q) { printf("%d", q) ... one of the following options is the CORRECT output of the above $\text{C}$ program? $20101020$ $10202010$ $20102010$ $10201020$
Consider the following $\text{C}$ program. Assume parameters to a function are evaluated from right to left.#include <stdio.h int g( int p) { printf("%d", p); return p; }...
Arjun
3.8k
views
Arjun
asked
Feb 16
Programming in C
gatecse2024-set2
programming
programming-in-c
+
–
4
votes
1
answer
18
GATE CSE 2024 | Set 2 | Question: 23
Consider the following $\mathrm{C}$ function definition. int f X(char * a) { char * b = a; while (*b) b ++; return b - a; } Which of the following statements is/are TRUE? The function call $\text{f X("a b c d''}$) will ... ${ }^{*} \mathrm{C}=$ "abcd" in main (), the function call $\mathrm{fX}(\mathrm{c})$ will always return a value
Consider the following $\mathrm{C}$ function definition.int f X(char * a) { char * b = a; while (*b) b ++; return b - a; }Which of the following statements is/ar...
Arjun
2.4k
views
Arjun
asked
Feb 16
Programming in C
gatecse2024-set2
programming
programming-in-c
multiple-selects
+
–
2
votes
2
answers
19
GATE CSE 2024 | Set 2 | Question: 26
What is the output of the following $\text{C}$ program? #include <stdio.h> int main() { double a[2]=20.0,25.0,* p,* q; p=a ; q=p+1 ; printf("%d,%d", (int) (q-p),( int)(* q- * p)); return 0; $4,8$ $1,5$ $8,5$ $1,8$
What is the output of the following $\text{C}$ program?#include <stdio.h int main() { double a =20.0,25.0,* p,* q; p=a ; q=p+1 ; printf("%d,%d", (int) (q-...
Arjun
2.9k
views
Arjun
asked
Feb 16
Programming in C
gatecse2024-set2
programming
programming-in-c
+
–
3
votes
2
answers
20
GATE CSE 2024 | Set 2 | Question: 32
Consider an array $\mathrm{X}$ that contains $\mathrm{n}$ positive integers. A subarray of $\mathrm{X}$ is defined to be a sequence of array locations with consecutive indices. The $\mathrm{C}$ code snippet given below has been written to compute the length of the longest ... $\text{(P) } \text{len} 2+1$ $\text{(Q) } \text{len} 1+1$
Consider an array $\mathrm{X}$ that contains $\mathrm{n}$ positive integers. A subarray of $\mathrm{X}$ is defined to be a sequence of array locations with co...
Arjun
2.0k
views
Arjun
asked
Feb 16
Programming in C
gatecse2024-set2
programming
programming-in-c
+
–
1
votes
1
answer
21
GATE CSE 2024 | Set 2 | Question: 38
Let $\mathrm{S} 1$ and $\mathrm{S} 2$ be two stacks. $\mathrm{S} 1$ has capacity of $4$ elements. $\mathrm{S} 2$ has capacity of $2$ elements. $\text{S1}$ already has $4$ elements: $100,200,300$, and $400$ ... output sequences can be generated by using the above operations? $100,200,400,300$ $200,300,400,100$ $400,200,100,300$ $300,200,400,100$
Let $\mathrm{S} 1$ and $\mathrm{S} 2$ be two stacks. $\mathrm{S} 1$ has capacity of $4$ elements. $\mathrm{S} 2$ has capacity of $2$ elements. $\text{S1}$ ...
Arjun
2.0k
views
Arjun
asked
Feb 16
DS
gatecse2024-set2
data-structures
stack
multiple-selects
+
–
3
votes
3
answers
22
GATE CSE 2024 | Set 1 | Question: 8
Consider the following $\mathrm{C}$ program: #include <stdio.h> int main() { int a=6; int b = 0; while (a<10) { a = a / 12+1 ; a += b ;} printf ("%d", a); return 0 ; } Which one of the following ... The program prints $9$ as output The program prints $10$ as output The program gets stuck in an infinite loop The program prints $6$ as output
Consider the following $\mathrm{C}$ program:#include <stdio.h int main() { int a=6; int b = 0; while (a<10) { a = a / 12+1 ; a += b ;} printf ("%d", a); return 0 ; }Whi...
Arjun
6.0k
views
Arjun
asked
Feb 16
Programming in C
gatecse2024-set1
programming
programming-in-c
+
–
1
votes
3
answers
23
GATE CSE 2024 | Set 1 | Question: 9
Consider the following $\mathrm{C}$ program: #include <stdio.h> void fX (); int main(){ fX(); return 0 }; void fX () { char a; if ((a=g e t c h a r()) ! = '\n') fX(); if (a ! ... program will not terminate The program will terminate with no output The program will terminate with $4321$ as output The program will terminate with $1234$ as output
Consider the following $\mathrm{C}$ program:#include <stdio.h void fX (); int main(){ fX(); return 0 };void fX () { char a; if ((a=g e t c h a r()) ! = '\n') ...
Arjun
3.0k
views
Arjun
asked
Feb 16
Programming in C
gatecse2024-set1
programming
programming-in-c
+
–
0
votes
2
answers
24
GATE CSE 2024 | Set 1 | Question: 33
Consider a binary min-heap containing $105$ distinct elements. Let $k$ be the index (in the underlying array) of the maximum element stored in the heap. The number of possible values of $k$ is $53$ $52$ $27$ $1$
Consider a binary min-heap containing $105$ distinct elements. Let $k$ be the index (in the underlying array) of the maximum element stored in the heap. The number of pos...
Arjun
2.3k
views
Arjun
asked
Feb 16
DS
gatecse2024-set1
data-structures
+
–
2
votes
2
answers
25
GATE CSE 2024 | Set 1 | Question: 38
Consider the following $\mathrm{C}$ ... the return value is less than $2^{10}$ If the inputs are $x=10, y=20$, then the return value is greater than $2^{20}$
Consider the following $\mathrm{C}$ function definition.int f (int x, int y){ for (int i=0 ; i<y ; i++ ) { x= x + x + y; } return x; }Which of the following stateme...
Arjun
2.2k
views
Arjun
asked
Feb 16
Programming in C
gatecse2024-set1
multiple-selects
programming
programming-in-c
+
–
7
votes
1
answer
26
GO Classes Test Series 2024 | Mock GATE | Test 14 | Question: 16
Consider the following C code: double A[2][3] = {{1, 2, 3}, {4, 5, 6}}; Assume that A[0] = 0xFFAA0000 and the sizeof(double) is 8. What will be the value of `A[1]`? 0xFFAA0024 0xFFAA0003 0xFFAA000C 0xFFAA0018
Consider the following C code:double A [3] = {{1, 2, 3}, {4, 5, 6}};Assume that A[0] = 0xFFAA0000 and the sizeof(double) is 8.What will be the value of A ?0xFFAA00240x...
GO Classes
591
views
GO Classes
asked
Feb 5
Programming in C
goclasses2024-mockgate-14
programming
programming-in-c
array
1-mark
+
–
5
votes
2
answers
27
GO Classes Test Series 2024 | Mock GATE | Test 14 | Question: 27
What is a statically allocated variable in C programming? A variable allocated at an absolute address in a program’s data space A variable allocated on the stack A variable allocated on the heap A variable which can NOT be defined as local variable
What is a statically allocated variable in C programming? A variable allocated at an absolute address in a program’s data spaceA variable allocated on the stackA variab...
GO Classes
396
views
GO Classes
asked
Feb 5
Programming in C
goclasses2024-mockgate-14
programming
programming-in-c
storage-classes-in-c
1-mark
+
–
7
votes
2
answers
28
GO Classes Test Series 2024 | Mock GATE | Test 14 | Question: 33
On a $64$-bit system, which of the following C expressions is equivalent to the C expression $(x[2]+4)[3]?$ Assume $\mathrm{x}$ is declared as $\textsf{int}\ast \ast \textsf{x}$ $\ast((*(x+16))+28)$ $\ast((*(x+2))+7)$ $\ast(((* x)+2)+7)$ $(* \ast(x+2)+7)$
On a $64$-bit system, which of the following C expressions is equivalent to the C expression $(x +4)[3]?$ Assume $\mathrm{x}$ is declared as $\textsf{int}\ast \ast \text...
GO Classes
453
views
GO Classes
asked
Feb 5
Programming in C
goclasses2024-mockgate-14
programming
programming-in-c
pointers
1-mark
+
–
4
votes
1
answer
29
GO Classes Test Series 2024 | Mock GATE | Test 14 | Question: 34
Suppose you implement a queue using a singly linked list with head and tail pointers so that the front of the queue is at the tail of the list, and the rear of the queue is at the head of the list. What is the best possible worst-case running ... $O(n)$ for dequeue. $O(n)$ for enqueue and $O(1)$ for dequeue. $O(n)$ for both functions.
Suppose you implement a queue using a singly linked list with head and tail pointers so that the front of the queue is at the tail of the list, and the rear of the queue ...
GO Classes
399
views
GO Classes
asked
Feb 5
DS
goclasses2024-mockgate-14
data-structures
queue
linked-list
1-mark
+
–
4
votes
1
answer
30
GO Classes Test Series 2024 | Mock GATE | Test 14 | Question: 42
The provided C code is a version of the C string library function strlen(), which calculates the length of a given string. unsigned int mystrlen(char *c) { unsigned int i = 0; /* Your code here. */ } Which line of code creates a working and ... != '\0') i++; return i; while (*(c + i) != '\0') ++i; return i;
The provided C code is a version of the C string library function strlen(), which calculates the length of a given string.unsigned int mystrlen(char *c) { unsigned in...
GO Classes
430
views
GO Classes
asked
Feb 5
Programming in C
goclasses2024-mockgate-14
programming
programming-in-c
strings
multiple-selects
2-marks
+
–
To see more, click for the
full list of questions
or
popular tags
.
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register