search
Log In
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
Welcome to GATE CSE Doubts, where you can ask questions and receive answers from other members of the community.

Recent questions tagged programming

0 votes
0 answers 9 views
The correct answer is (b). I am not able to understand how it is the correct answer, please explain.
asked 4 days ago in Programming akshansh 15 points 9 views
0 votes
0 answers 7 views
Write a C macro without using any conditional checks to set or reset a particular bit in a variable based on the third argument. SETRESET (variable, bitposition, set/reset) Could you help me with this??
asked Jun 2 in Programming suryavasu1012 9 points 7 views
0 votes
0 answers 10 views
Which c standard is considered by gate syllabus c89, c99 or c11 ? I often encounter people saying that this C standard allows it, that doesn't. so, which standard to follow ?
asked May 27 in GATE Application Praveen Parashar 5 points 10 views
0 votes
0 answers 15 views
#include <iostream> using namespace std; int main() { int a[3][4][2] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20}; printf("%d", *((*(a+2)-3))[2]); return 0; } How the output of this code coming out to be 15. Can someone please explain this?
asked May 2 in Programming CSHuB 33 points 15 views
0 votes
1 answer 28 views
Consider the following set of Functional dependencies for relational schema R{A,B,C} F={A->BC, B->C, A->B, AB->C} (i) Find the key of relation R
asked Apr 23 in Databases Sneha Vashishtha 5 points 28 views
0 votes
0 answers 17 views
Is Space Also Allocated In Memory For Other Literal Constants(int/char/float Etc)? Because For String Literal Constants Memory Is Allocated.
asked Apr 10 in Programming akshansh 15 points 17 views
1 vote
1 answer 29 views
https://www.onlinegdb.com/edit/r1CBB9EHO #include<stdio.h> int main() { short int i = 10; char c = 'a'; float p = 3.0; short int s = i+c; printf("%d\n", sizeof(short int)); //size of short int is 2 printf("%d\n", sizeof(char)); // size of char is 1 printf(" ... + short int) should be short int whose size should be 2. */ printf("%d", sizeof(s)); // though here it is 2 which is correct. return 0; }
asked Apr 3 in Programming akshansh 15 points 29 views
0 votes
0 answers 17 views
please explain the difference in extern and global variable both have global scope then what is the difference how they used as in programme
asked Mar 29 in Programming gurichouhan 5 points 17 views
0 votes
0 answers 7 views
If the time to failure of a machine component is exponentially distributed, the reliability of the same at Mean Time to Failure (MTTF) is ____
asked Mar 22 in Operating System kartikb94 5 points 7 views
0 votes
0 answers 41 views
function mu(a,b:integer) returns integer; var i,y: integer; begin ---------P---------- i = 0; y = 0; while (i < a) do begin --------Q------------ y := y + b ; i = i + 1 end return y end I arrived at the answer that Q=y<a P=y<i
asked Mar 21 in Programming hari1998 5 points 41 views
1 vote
1 answer 46 views
Please explain how to get the outputs here? void main() { int i=255, j; char *p; p=&i; j=*p; *p=32; printf("%d %d",i,j); } void main() { int i=265, j; char *p; p=&i; j=*p; *p=32; printf("%d %d",i,j); }
asked Mar 9 in Programming Dheera -14 points 46 views
0 votes
0 answers 23 views
#include <stdio.h> #define VAL 32 int main() { char arr[] = "geeksquiz"; *(arr + 0) &= ~VAL; *(arr + 5) &= ~VAL; printf("%s", arr); return 0; }
asked Feb 18 in Programming Sur_1611 5 points 23 views
0 votes
0 answers 30 views
In the question number mentioned above, I had a doubt that what will happen if *px = INT_MIN and *py = INT_MAX. Because if we do *px = *px – *py, then ideally *px will become less than INT_MIN which will not be possible to store in int data type, and hence may give unexpected results, so according to me S4 should also be correct
asked Jan 12 in Programming hadarsh 5 points 30 views
0 votes
0 answers 17 views
Q. What does the following program do when the input is unsigned 16-bit integer? #include<stdio.h> main() { unsigned int num; int i; scanf("%u",&num); for(i=0;i<16;i++) { printf("%d.",(num << i&1 <<15)?1:0); } } (A) it prints all even bits from num (B) it prints all odd bits from num (C) it prints binary equivalent of num (D) none of the above
asked Dec 30, 2020 in Programming Enolx.21 53 points 17 views
0 votes
1 answer 35 views
void main() { int x = 0; if(0 && ++x) x++; printf("%d\n", x); }
asked Dec 26, 2020 in Programming savvysiddharth 5 points 35 views
0 votes
1 answer 56 views
What will be the output of the following program? #include "stdio.h" int main() { char a[] = { 'P', 'Q', 'R', 'S' }; char* p = &a[0]; *p++; printf("%c ", *++p); } According to my solution As we know that the precedence of * and ++ is the same ... above explanation my answer comes out to be Q , but when I ran the program, then it showed my R as the output. Can someone please help me with this?
asked Dec 2, 2020 in Programming Samarth Kejriwal 7 points 56 views
0 votes
0 answers 27 views
If a question is asked in GATE regarding bubble sort,should i take normal bubble sort or improved version of bubble sort? In some test series question, they are giving best case time complexity as O(n) instead of O(n^2) for bubble sort. So, which one should i take?
asked Nov 26, 2020 in Algorithms phaneendrababu 11 points 27 views
0 votes
1 answer 34 views
Can someone explain how to find the complexity of this code( in a detailed way)
asked Nov 22, 2020 in Programming Ashutosh777 -219 points 34 views
1 vote
2 answers 81 views
consider the below function mystery(a,b) { if(a<0 or b<0) return 0; else if (a==0) return b+1; else if(b==0) return mystery(a-1,1); else return mystery(a-1,mystery(a,b-1)); } what would be the value of mystery(3,3)? ans is 61.I am not able to solve it in less time.can someone explain how to solve such type of questions?
asked Nov 17, 2020 in Programming 404 found 37 points 81 views
0 votes
1 answer 46 views
which of the following relationship holds in general between the scope of a variable and the lifetime of a variable(in a language like c)? a)the scope of a variable is contained in the lifetime of the variable b)the scope of a variable is same as the lifetime of the variable c)the scope of a variable is disjoint from the scope of the variable d)none of the above ans is a.can someone explain?
asked Nov 17, 2020 in Programming 404 found 37 points 46 views
1 vote
2 answers 56 views
#include <stdio.h> int main(void) { int b=-1,a=-2; while(+(+b--)!=1){ b-=a++; } printf("%d",b); return 0; } What will be output of this code? I thought output should be 1, but getting no output. Plz tell me why no output here?
asked Nov 13, 2020 in Programming srestha 1k points 56 views
2 votes
0 answers 60 views
Isnt the answer 21?
asked Nov 12, 2020 in Programming ijnuhb 747 points 60 views
1 vote
0 answers 24 views
int main() { int arr[2][3][3]= {'A','B','C','D','E','F','G','H','I','J','K' ,'L','M','N'}; int (*p)[2][3][3]= &arr; printf("%d",(*(*(*p)[0]+5))-(*(*(*p)[1]-3))); } ANS: -1 //F-G here the pointer p is a 4D array pointer as for 3D array it should have been “(*p) [3][3]” and that is why (*p) is pointing to the whole 3D array not any element of it. Please correct me if i am wrong.
asked Nov 12, 2020 in Programming Sahil91 683 points 24 views
2 votes
1 answer 32 views
Find the number of times ‘for’ loop runs successfully and the output printed by variable ‘sum’ for the given below code: #include<stdio.h> int x = 14; int fun() { return x--; } int main () { int sum = 0; for(fun();--x;fun()) sum = sum + fun(); printf(‘%d”, sum); return 0; } Options are : 4, 30 5, 26 4, 26 5, 30
asked Nov 9, 2020 in Programming rsamarth 29 points 32 views
1 vote
1 answer 42 views
main() { int a=1, b=2, c=0; c+=a++*++b; print(a,b,c); if(fork()==0) { a+=b+=c+=2; print(a,b,c); c++; } else { b+=c+=a+=3; print(a,b,c); c--; } print(c); } What is the output when this program is executed? Please show the intermediate results also.
asked Nov 7, 2020 in Operating System Dheera -14 points 42 views
0 votes
0 answers 24 views
what is time complexity to insert a node based on key in a priority queue? O(nlogn) O(logn) O(n) (n2) i am unable to get the meaning of the question . is it a simple insertion in the priority queue?? . what is the meaning of “based on key”.Please explain this….
asked Oct 20, 2020 in Programming manal jain 5 points 24 views
0 votes
0 answers 33 views
int a=14; a=a++; Why is the final output of a is 14 and not 15? Since post operator is used so first the value 14 will be assigned to “a” and then “a” will get incremented to 15.So final value should be 15.But why it is coming output as 14?
asked Oct 19, 2020 in Programming vishal burnwal 77 points 33 views
1 vote
2 answers 51 views
I was having a doubt that should we consider = or I am finding different answers on the internet.
asked Oct 17, 2020 in Algorithms satvik 11 points 51 views
0 votes
0 answers 27 views
https://gateoverflow.in/960/gate2003-73 In this question it is said that Call-by-Need works the same way as Call-by-Name with the difference that the evaluation of the parameter reference is done the first time it is encountered in the called function. global int i = 1, j = ... encounter x it will be calculated and saved as 3 and rest of the time x = 3 will only be used producing the output 31 3?
asked Oct 12, 2020 in Programming Mellophi 363 points 27 views
0 votes
0 answers 18 views
I know that . is used when there is a direct access to a variable in the structure and -> is used when you are accessing a variable of a structure through a pointer to that structure. Also a->b is equivalent to (*a).b Here we are accessing ... works fine. If anyone can help me understand this with memory diagram that would be a great help, Thanks. I made this diagram for better understanding
asked Sep 25, 2020 in Programming shashank023 5 points 18 views
0 votes
1 answer 54 views
#include <stdio.h> int main() { void demo(); void (*fun)(); fun = demo; (*fun)(); fun(); return 0; } void demo() { printf("GeeksQuiz "); } what will be its output and please explain as well!
asked Sep 22, 2020 in Programming Setika Mehra 13 points 54 views
0 votes
0 answers 43 views
In this last statement printf(“ \n %d %d “,s,t ) ; s value should be printed as 2 beacuse in the statement t= p + q+ s++ , s is post incremented so its value is incremented next statement but the sol gives value of s=2. What is the approach ?
asked Sep 22, 2020 in Programming nitin21038 2 points 43 views
0 votes
0 answers 15 views
You are given a list of 5 integers and these integers are in the range from 1 to 6. There are no duplicates in list. One of the integers is missing in the list. Which of the following expression would give the missing number. ^ is bitwise XOR operator. ~ is bitwise NOT operator. Let elements of list can be ... list[4] ^ 1 ^ 2 ^ 3 ^ 4 ^ 5 D ~(list[0] ^ list[1] ^ list[2] ^ list[3] ^ list[4])
asked Sep 21, 2020 in Programming Musa 5 points 15 views
0 votes
2 answers 55 views
A 3-ary tree in which every internal node has exactly 3 children. The number of leaf nodes in such a tree with 10 internal nodes will be _____
asked Sep 13, 2020 in Programming nitin21038 2 points 55 views
0 votes
0 answers 52 views
no of digits in n integer part of logarithm of n base 2 fn always return 0 n/2 the sol is given as b) but I am getting a) as the answer
asked Sep 12, 2020 in Programming nitin21038 2 points 52 views
0 votes
0 answers 71 views
#include<stdio.h> int main() { char *p1="Graduate"; char *p2=p1; printf("%c",*++p2); printf("%d",sizeof(p2)); return 0; }
asked Sep 11, 2020 in Programming sarthakdarji 9 points 71 views
0 votes
0 answers 55 views
Can anyone please provide the output of the below code with proper explanation:- #include <stdio.h> show(int(*q)[3][4],int ii,int jj,int kk){ int i,j,k; int *p; for(i=0;i<ii;i++){ for(j=0;j<jj;j++){ p=q[i][j]; printf("\nThis is %d\n",q[i][j]); for(k=0;k<kk;k++){ printf("%d",*(p+k)); } ... ={ { 1,2,3,4, 5,6,7,8, 9,3,2,1}, { 2,3,5,7, 4,3,9,2, 1,6,3,6} }; show(a, 2, 3,4 ) ; } Thanks in advance.
asked Sep 9, 2020 in Programming Pratyush Priyam Kuan 1.1k points 55 views
0 votes
1 answer 91 views
What will be meaning of printf("%d",--*p); will return? I mean if ‘p’ pointing some address, will --*p decrement on the address or it will decrement the value of that address?
asked Sep 6, 2020 in Programming srestha 1k points 91 views
0 votes
0 answers 52 views
#include<stdio.h> int main(){ int i=500; int *p=&i; foo(&p); printf("%d",*p); return 0; } void foo(int **p1){ int j=2; *p1=&j; printf("%d",**p1); } My doubt what happen when double pointer working as single pointer? *p1=&j in 11th line? Will it work like single pointer? And what will be the output?
asked Sep 6, 2020 in Programming srestha 1k points 52 views
0 votes
0 answers 65 views
#include <stdio.h> int main(void) { char a[20]="GATE 2021"; char *p1; p1=a+2; while((*p1++)&&(*p1!=NULL)){ (*p1)++; } printf("%s",a); return 0; } Will ASCII value of T increment? if not, why not??
asked Sep 5, 2020 in Programming srestha 1k points 65 views
...