Login
Register
Dark Mode
Brightness
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Webpage for Programming:
Recent questions tagged programming
50
votes
7
answers
811
GATE CSE 2016 Set 2 | Question: 35
The following function computes $X^{Y}$ for positive integers $X$ and $Y$. int exp (int X, int Y) { int res =1, a = X, b = Y; while (b != 0) { if (b % 2 == 0) {a = a * a; b = b/2; } else {res = res * a; b = b - 1; } } return res; } Which one of the following ... $X^{Y} = a^{b}$ $(res * a)^{Y} = (res * X)^{b}$ $X^{Y} = res * a^{b}$ $X^{Y} = (res * a)^{b}$
The following function computes $X^{Y}$ for positive integers $X$ and $Y$.int exp (int X, int Y) { int res =1, a = X, b = Y; while (b != 0) { if (b % 2 == 0) {a =...
Akash Kanase
14.1k
views
Akash Kanase
asked
Feb 12, 2016
Programming in C
gatecse-2016-set2
programming
loop-invariants
normal
+
–
0
votes
1
answer
812
Ace Test Series: Programming & DS - Programming In C
CKgurav
511
views
CKgurav
asked
Feb 1, 2016
Programming in C
ace-test-series
programming
programming-in-c
+
–
1
votes
2
answers
813
MadeEasy Test Series: Programming & DS - Programming In C
Consider the following program: # define Rec(a) a + a * a int a; a = 20 + Rec(a) * Rec(a + 1); printf(“%d”, a) return 0; } The output of above program for a = 3 is ________.
Consider the following program:# define Rec(a) a + a * aint a;a = 20 + Rec(a) * Rec(a + 1);printf(“%d”, a)return 0;}The output of above program for a = 3 is ________....
khushtak
472
views
khushtak
asked
Jan 30, 2016
Programming in C
made-easy-test-series
programming
programming-in-c
macros
+
–
3
votes
3
answers
814
Ace Test Series: Programming & DS - Programming In C
I am getting 'cd' , but answer is given as 'gh' . How come ??
I am getting 'cd' , but answer is given as 'gh' . How come ??
Tushar Shinde
1.1k
views
Tushar Shinde
asked
Jan 22, 2016
Programming in C
ace-test-series
programming
programming-in-c
array-of-pointers
+
–
0
votes
1
answer
815
Ace Test Series: Programming & DS - Programming In C
Ans is given as (D). But I am not getting it. If we consider HEX format, then it is giving me (A) and in normal format it is giving 2240. Where's the problem??
Ans is given as (D). But I am not getting it. If we consider HEX format, then it is giving me (A) and in normal format it is giving 2240. Where's the problem??
Tushar Shinde
756
views
Tushar Shinde
asked
Jan 22, 2016
Programming in C
ace-test-series
programming
programming-in-c
+
–
0
votes
2
answers
816
Ace Test Series: Programming & DS - Programming In C
I am getting no option correct.. Am I missing something??
I am getting no option correct.. Am I missing something??
Tushar Shinde
480
views
Tushar Shinde
asked
Jan 12, 2016
Programming in C
ace-test-series
programming
programming-in-c
+
–
1
votes
1
answer
817
output
Himanshu1
445
views
Himanshu1
asked
Dec 31, 2015
Programming in C
programming
+
–
1
votes
1
answer
818
returned value
Himanshu1
798
views
Himanshu1
asked
Dec 31, 2015
Programming in C
programming
recursion
+
–
2
votes
2
answers
819
MadeEasy Test Series: Programming & DS - Programming in C
Q.43 Consider the following C program. Which of the following represent the output of above program? 4,500 4,501 5,500 3,500
Q.43Consider the following C program.Which of the following represent the output of above program?4,5004,5015,5003,500
Akash Kanase
641
views
Akash Kanase
asked
Dec 19, 2015
Programming in C
made-easy-test-series
programming-in-c
programming
+
–
3
votes
2
answers
820
What is return value of BSR Routine ?
Consider the following function. Assume that the array contains list of all the numbers from 1 to k –1. What is the return value of function BSR? Sum of all numbers Repeated number in the list Average of all the numbers None of these ------------- ... from it which is also (k-1*k) /2 . So it will always return 0. Q 37 Made Easy FLT 6-Practice Test 14
Consider the following function.Assume that the array contains list of all the numbers from 1 to k –1. What is the return value of function BSR?Sum of all numbersRe...
Akash Kanase
1.0k
views
Akash Kanase
asked
Dec 1, 2015
Programming in C
programming
loop
functions
+
–
2
votes
2
answers
821
C prgram
x– = y+1; does the same as: (a) x= x –y +1 (b) x= – x –y – 1 (c) x= –x + y +1 (d) x= x – y – 1 is ans is a ? given d
x– = y+1; does the same as:(a) x= x –y +1 (b) x= – x –y – 1(c) x= –x + y +1 (d) x= x – y – 1is ans is a ?given d
tiger
7.2k
views
tiger
asked
Nov 25, 2015
Programming in C
programming-in-c
programming
+
–
1
votes
2
answers
822
Output
#include ‬<stdio.h> int main(){ int i = 4; i = printf(" %d ", ++i) + printf(" %d ", i--); printf(" %d ", i); }
#include ‬<stdio.h int main(){ int i = 4; i = printf(" %d ", ++i) + printf(" %d ", i ); printf(" %d ", i); }
Sandip Shaw
720
views
Sandip Shaw
asked
Nov 25, 2015
Programming in C
programming-in-c
programming
+
–
2
votes
1
answer
823
Find the value of Z
P(X:integer,Y:integer) { X = 6; A = 8; return ( X + Y ) } if the function P were invoked by the following program fragment. k = 1; L = 1; Z = (K, L); Then the value of Z would be? where X=call by reference and Y=pass by value
P(X:integer,Y:integer) { X = 6; A = 8; return ( X + Y ) }if the function P were invoked by the following program fragment. k = 1; L = 1; Z = (K, L);Then the value of Z wo...
Nishikant kumar
1.0k
views
Nishikant kumar
asked
Nov 16, 2015
Programming in C
programming
parameter-passing
+
–
5
votes
5
answers
824
Number of moves of smallest disc in tower of Hanoi
______ is the number of moves of the smallest disc in Tower of Hanoi implementation where the tower consisting of 17 discs (numbered from 0 to 16) Answer given: $2^{16}$ = 65536 Please explain
______ is the number of moves of the smallest disc in Tower of Hanoi implementation where the tower consisting of 17 discs (numbered from 0 to 16)Answer given: $2^{16}$ ...
shikharV
3.2k
views
shikharV
asked
Nov 15, 2015
DS
algorithms
programming
recursion
+
–
2
votes
1
answer
825
Please Confirm the answers
Match List-I with List-II and select the correct answer using the codes given below the list: List-I List-II A.Evaluation of infix 1. 1 operand stack B.Evaluation of postfix 2. 1 operator stack C.Evaluation of prefix 3. 1 operator queue CODES: A B C (a) 1 2 3 (b ... sum of elements on right side of root, then the value of $[(Rd)-(Ld)+Root]$ is _______. 1. D 2. 1289 3. 95
Match List-I with List-II and select the correct answer using the codes given below the list: List-IList-IIA.Evaluation of infix1. 1 operand stackB.Evaluation of postfix2...
Aditya
433
views
Aditya
asked
Nov 6, 2015
DS
programming
data-structures
+
–
5
votes
2
answers
826
TIFR CSE 2011 | Part B | Question: 40
Consider the class of object oriented languages. Which of the following is true? Pascal is an object oriented language. Object oriented languages require heap management. Object oriented languages cannot be implemented in ... languages are more powerful than declarative programming languages. Parallelism cannot be realized in object oriented languages.
Consider the class of object oriented languages. Which of the following is true?Pascal is an object oriented language.Object oriented languages require heap management.Ob...
makhdoom ghaya
1.3k
views
makhdoom ghaya
asked
Oct 26, 2015
Object Oriented Programming
tifr2011
programming
object-oriented-programming
non-gate
+
–
24
votes
2
answers
827
TIFR CSE 2011 | Part B | Question: 38
Consider the class of recursive and iterative programs. Which of the following is false? Recursive programs are more powerful than iterative programs. For every iterative program there is an equivalent recursive program. ... memory management. Recursive programs do not terminate sometimes. Iterative programs and recursive programs are equally expressive.
Consider the class of recursive and iterative programs. Which of the following is false?Recursive programs are more powerful than iterative programs.For every iterative p...
makhdoom ghaya
6.5k
views
makhdoom ghaya
asked
Oct 25, 2015
Programming in C
tifr2011
recursion
programming
+
–
9
votes
2
answers
828
TIFR CSE 2011 | Part B | Question: 32
Various parameter passing mechanisms have been in used in different programming languages. Which of the following statements is true? Call by value result is used in language Ada. Call by value result is the same as call by name. Call by value is the most robust. Call by reference is the same as call by name. Call by name is the most efficient.
Various parameter passing mechanisms have been in used in different programming languages. Which of the following statements is true?Call by value result is used in langu...
makhdoom ghaya
1.7k
views
makhdoom ghaya
asked
Oct 22, 2015
Programming in C
tifr2011
programming
parameter-passing
+
–
3
votes
0
answers
829
TIFR CSE 2011 | Part B | Question: 24
Consider the program x:=0; y:=0; (r1:=x; r2:=x; y:= if r1 = r2 then 1 ∥ r3:= y; x:= r3) Note that ∥ denotes the parallel operator. In which of the following cases can the program possibly ... in all sequential programming languages when the compiler appropriately translates the ∥ operator to interleaved statements in the sequential language. None of the above.
Consider the programx:=0; y:=0; (r1:=x; r2:=x; y:= if r1 = r2 then 1 ∥ r3:= y; x:= r3)Note that ∥ denotes the parallel operator. In which of the following cases can t...
makhdoom ghaya
518
views
makhdoom ghaya
asked
Oct 20, 2015
Programming in C
tifr2011
programming
non-gate
+
–
7
votes
5
answers
830
ISRO2015-68
Consider the following program fragment if(a > b) if(b > c) s1; else s2; s2 will be executed if a <= b b > c b >= c and a <= b a > b and b <= c
Consider the following program fragment if(a b) if(b c) s1; else s2;s2 will be executed ifa <= bb cb >= c and a <= ba b and b <= c
ajit
5.8k
views
ajit
asked
Oct 12, 2015
Programming in C
isro2015
programming
programming-in-c
+
–
7
votes
3
answers
831
What is the difference between static scoping and dynamic scoping?
sampad
8.1k
views
sampad
asked
Oct 11, 2015
Programming in C
programming
variable-binding
+
–
23
votes
3
answers
832
TIFR CSE 2010 | Part B | Question: 37
Consider the program where $a, b$ are integers with $b > 0$. x:=a; y:=b; z:=0; while y > 0 do if odd (x) then z:= z + x; y:= y - 1; else y:= y % 2; x:= 2 * x; fi Invariant of the loop is a condition which is ... terminate for some values of $a, b$ but when it does terminate, the condition $z = a * b$ will hold. The program will terminate with $z=a^{b}$
Consider the program where $a, b$ are integers with $b 0$.x:=a; y:=b; z:=0; while y 0 do if odd (x) then z:= z + x; y:= y - 1; else y:= y % 2; x:= 2 * x; fiInvariant of...
makhdoom ghaya
3.4k
views
makhdoom ghaya
asked
Oct 10, 2015
Programming in C
tifr2010
programming
loop-invariants
+
–
16
votes
2
answers
833
TIFR CSE 2010 | Part B | Question: 31
Consider the following computation rules. Parallel-outermost rule: Replace all the outermost occurrences of F (i.e., all occurrences of F which do not occur as arguments of other F's) simultaneously. Parallel - innermost rule: Replace all the innermost ... $0$ and $0$ respectively $w$ and $w$ respectively $w$ and $1$ respectively none of the above
Consider the following computation rules. Parallel-outermost rule: Replace all the outermost occurrences of F (i.e., all occurrences of F which do not occur as arguments ...
Arjun
1.6k
views
Arjun
asked
Oct 10, 2015
Programming in C
tifr2010
programming
recursion
+
–
16
votes
2
answers
834
TIFR CSE 2010 | Part B | Question: 30
Consider the following program for summing the entries of the array $b$: array $[0 .. N-1]$ of integers, where $N$ is a positive integer. (The symbol '$<>$' denotes 'not equal to'). var i, s: integer; Program i:= 0; s:= 0; [*] while i <> N ... $s = \sum\limits^{i-1}_{j=0}b[j] \;\&\; 0 \leq i \leq N$
Consider the following program for summing the entries of the array $b$: array $[0 .. N-1]$ of integers, where $N$ is a positive integer. (The symbol '$<>$' denotes 'not ...
makhdoom ghaya
2.8k
views
makhdoom ghaya
asked
Oct 8, 2015
Programming in C
tifr2010
programming
loop-invariants
+
–
4
votes
3
answers
835
Let a, b be two positive integers, which of the following options correctly relates / and %?
Let a, b be two positive integers, which of the following options correctly relates / and %? (a) b= (a/b) * b + a%b (b) b= (a%b) * b + a/b (c) a= (a/b) * b + a%b (d) a= (a%b) * b + a/b * I am getting answer as c but the answer given is b. Please tell me which one is correct.
Let a, b be two positive integers, which of the following options correctly relates / and %?(a) b= (a/b) * b + a%b(b) b= (a%b) * b + a/b(c) a= (a/b) * b + a%b(d) a= (a%b)...
IgnitorSandeep
6.6k
views
IgnitorSandeep
asked
Oct 5, 2015
Programming in C
programming
programming-in-c
+
–
0
votes
2
answers
836
output?
#define int char main(){ int i=66; printf("%d",sizeof(i)); }
#define int charmain(){int i=66;printf("%d",sizeof(i));}
sdpshaw
693
views
sdpshaw
asked
Oct 2, 2015
Programming in C
programming
programming-in-c
+
–
2
votes
1
answer
837
What will be the output?
#include <stdio.h> char str1[100]; char *fun(char str[]) { static int i = 0; if (*str) { fun(str+1); str1[i] = *str; i++; } return str1; } int main() { char str[] = "GATE CS 2015 Mock Test"; printf(" ... kcoM 5102 SC ETAG C)Nothing is printed on screen D)Segmentation Fault i think answer should be option C.But the answer given as B.please explation how.
#include <stdio.h char str1[100]; char *fun(char str[]) { static int i = 0; if (*str) { fun(str+1); str1[i] = *str; i++; } return str1; } int main() { char str[] = "GATE ...
sdpshaw
1.9k
views
sdpshaw
asked
Sep 27, 2015
Programming in C
programming
programming-in-c
+
–
3
votes
2
answers
838
ISRO2014-13
Which of the following is true with respect to Reference? A reference can never be NULL A reference needs an explicit dereferencing mechanism A reference can be reassigned after it is established A reference and pointer are synonymous
Which of the following is true with respect to Reference?A reference can never be NULLA reference needs an explicit dereferencing mechanismA reference can be reassigned a...
ajit
5.2k
views
ajit
asked
Sep 23, 2015
Programming in C
programming
isro2014
pointers
+
–
2
votes
3
answers
839
ISRO2014-51
Which of the following is NOT represented in a subroutine's activation record frame for a stack-based programming language? Values of local variables Return address Heap area Information needed to access non local variables
Which of the following is NOT represented in a subroutine's activation record frame for a stack-based programming language?Values of local variablesReturn addressHeap are...
ajit
3.8k
views
ajit
asked
Sep 20, 2015
Programming in C
isro2014
programming
activation-record
+
–
2
votes
3
answers
840
The minimum number of temporary variables needed to swap the contents of two variables?
The minimum number of temporary variables needed to swap the contents of two variables is: (a) 1 (b) 2 (c) 3 (d) 0
The minimum number of temporary variables needed to swap the contents of two variables is:(a) 1 (b) 2(c) 3 (d) 0
goku
17.0k
views
goku
asked
Sep 14, 2015
Programming in C
programming
+
–
Page:
« prev
1
...
23
24
25
26
27
28
29
30
31
32
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register