What is the value returned by the function f given below when n = 100 ?

int f(int n)

 { if (n==0) then return n;

 else

return n + f(n-2);

 }

(A) 2550 (B) 2556

(C) 5220 (D) 5520

1 Answer

Answer :

(A) 2550

Related questions

Description : Consider the following JAVA program: public class First { public static int CBSE (int x) { if (x < 100) x = CBSE (x +10); return (x - 1); } public static void main (String[] args){ System.out.print(First.CBSE(60)); } } What does this program print? (1) 59 (2) 95 (3) 69 (4) 99

Last Answer : (2) 95 

Description : Consider the following three SQL queries (Assume the data in the people table) : (a) Select Name from people where Age>21; (b) Select Name from people where Height>180; (c) Select Name from people where (Age>21) or (Height ... number of rows returned by the SQL query (c) ? (A) 3 (B) 7 (C) 10 (D) 21

Last Answer : (C) 10

Description : Which of the following has compilation error in C ? (A) int n = 32; (B) char ch = 65; (C) float f= (float) 3.2; (D) none of the above

Last Answer : D

Description : Consider f(N) = g(N) + h(N) Where function g is a measure of the cost of getting from the start node to the current node N and h is an estimate of additional cost of getting from the current ... ? (A) A* algorithm (B) AO* algorithm (C) Greedy best first search algorithm (D) Iterative A* algorithm

Last Answer : (C) Greedy best first search algorithm

Description : If m and n are int type variables, what will be the result of the expression m% n when m=5 and n=2 ? A) 0 B) 1 C) 2 D) None of the above

Last Answer : B) 1

Description : Suppose the function y and a fuzzy integer number around -4 for x are given as y=(x-3)2+2 Around -4={(2,0.3), (3,0.6), (4,1), (5,0.6), (6,0.3)} respectively. Then f(Around - 4) is given by: (A) {(2,0.6), (3,0.3), ... 6), (3,1), (6,0.6), (11,0.3)} (D) {(2,0.6), (3,0.3), (6,0.6), (11,0.3)}

Last Answer : (C) {(2,0.6), (3,1), (6,0.6), (11,0.3)}

Description : What does the following expression means ? char *(*(* a[N]) ( )) ( ); (A) a pointer to a function returning array of n pointers to function returning character pointers. (B) a ... to characters (D) an array of n pointers to function returning pointers to functions returning pointers to characters.

Last Answer : Answer: A,B,C,D

Description : A machine costs Rs. 20000 and its useful life is 8 years. The money is borrowed at 8% interest per annum. The capital recovery factor at 8% interest per annum for 8 years is 0.174. The annual equipment cost of the machine will be (A) Rs. 1740 (B) Rs. 3480 (C) Rs. 5220 (D) Rs. 6960

Last Answer : (B) Rs. 3480

Description : When the following code is executed what will be the value of x and y? int x = 1, y=0; y = x++; (A) 2, 1 (B) 2, 2 (C) 1, 1 (D) 1, 2

Last Answer : (A) 2, 1

Description : The correct way to round off a floating number x to an integer value is (A) y = (int)(x+0.5) (B) y = int(x+0.5) (C) y = (int)x+0.5 (D) y = (int)((int)x+0.5)

Last Answer : (A) y = (int)(x+0.5)

Description : What will be the values of x, m and n after execution of the following statements? Int x, m, n; m=10; n=15; x= ++m + n++; A) x=25, m=10, n=15 B) x=27, m=10, n=15 C) x=26, m=11, n=16 D) x=27, m=11, n=16

Last Answer : C) x=26, m=11, n=16

Description : Semi-join strategies are techniques for query processing in distributed database system. Which of the following is a semi-join technique? (A) Only the joining attributes are sent from one site to ... the attributes are sent from one site to another and then only the required rows are returned.

Last Answer : (C) Only the joining attributes are sent from one site to another and then only the required rows are returned.

Description : In C++, the keyword void was used ……….. A) To specify the return type of function when it is not returning any value. B) To indicate an empty argument list to a function. C) To declare the generic pointers. D) All of the above.

Last Answer : D) All of the above.

Description : where can I buy hydraulic steel tubing per ams5520 or AMS 5520. Or per the new updated spec?

Last Answer : Need Answer

Description : 1. An average Indian requires ____________ calories from his/her daily consumption of food. [2250/2550/2200]

Last Answer : Choose the correct option: 1. An average Indian requires ____________ calories from his/her daily consumption ... below poverty line. [21.2%/5%/20%]

Description : Compute the value of adding the following two fuzzy integers: A = {(0.3,1), (0.6,2), (1,3), (0.7,4), (0.2,5)} B = {(0.5,11), (1,12), (0.5,13)} Where fuzzy addition is defined as μA+B(z) = maxx+y=z (min(μA(x), μB( ... ,18)} (D) {(0.3,12), (0.5,13), (0.6,14), (1,15), (0.7,16), (0.5,17), (0.2,18)}

Last Answer : (D) {(0.3,12), (0.5,13), (0.6,14), (1,15), (0.7,16), (0.5,17), (0.2,18)} 

Description : The number of function points of a proposed system is calculated as 500. Suppose that the system is planned to be developed in Java and the LOC/FP ratio of Java is 50. Estimate the effort (E) required to ... ) 25 person months (B) 75 person months (C) 62.5 person months (D) 72.5 person months

Last Answer : (C) 62.5 person months 

Description : Assume that variable x resides at memory location 1234, y at 1111 and p at 2222. Int x=1, y=2, *p; p=&x; y=*p; What will be the value of y after execution of above code? A) 2 B) 1 C) 1234 D) 1111

Last Answer : C) 1234

Description : int[ ] ={5,6,7,8,9} What is the value of a[3]? A) 9 B) 8 C) 7 D) 6

Last Answer : B) 8

Description : main() { Int a=3, b=2, c*d*e; d=&a; e=&b; c=*d+*e; } Which one of the given answers is correct? A) a=4, c-6 B) a=3, c=5 C) a=3, c=6 D) a=3, c=8

Last Answer : B) a=3, c=5

Description : Below are the few steps given for scan-converting a circle using Bresenham's Algorithm. Which of the given steps is not correct? (1) Compute d = 3 – 2r (where r is radius) (2) Stop if x> y (3) If d

Last Answer : If d≥0,then d=4 *(x-y)+10, x=x+1 and y=y+1

Description : If a is an integer variable, a=7/3; will return a value A) 2.5 B) 3 C) 0 D) 2

Last Answer : D) 2

Description : Given that x=7.5, j=-1.0, n=1.0, m=2.0 the value of --x+j == x>n>=m is: (A) 0 (B) 1 (C) 2 (D) 3

Last Answer : (A) 0 

Description : The sum of products expansion for the function F(x, y, z) = (x + y)z’ is given as (A) x’y’z + xyz’ + x’yz’ (B) xyz + xyz’ + xy’z’ (C) xy’z’ + x’y’z’ + xyz’ (D) xyz’ + xy’z’ + x’yz’

Last Answer : (D) xyz’ + xy’z’ + x’yz’ Explanation: Use Boolean identities to expand the product and simplify. F(x, y, z)=(x + y)z’  =xz’+yz’ Distributive law  =x1z’+1yz’ Identity law  =x(y+y’)z’+(x+x’)yz’ Unit property =xyz’+xy’z’+xyz’+x’yz’ Distributive law  =xyz’+xy’z’+x’yz’ Idempotent law 

Description : A three dimensional array in C' is declared as int A[x][y][z]. Here, the address of an item at the location A[p][q][r] can be computed as follows (where w is the word length of an integer): (A) &A[0][0][0]+w(y*z*q+z*p+r) (B) &A ... *q+r) (C) &A[0][0][0]+w(x*y*p+z*q+r) (D) &A[0][0][0]+w(x*y*q+z*p+r)

Last Answer : Answer: B

Description : If X is a binary number which is power of 2, then the value of X&(X-1) is: (1) 11....11 (2) 00.....00 (3) 100.....0 (4) 000.....1

Last Answer : Answer: 2

Description : Let f and g be the functions from the set of integers to the set integers defined by f(x) = 2x + 3 and g(x) = 3x + 2 Then the composition of f and g and g and f is given as (A) 6x + 7, 6x + 11 (B) 6x + 11, 6x + 7 (C) 5x + 5, 5x + 5 (D) None of the above

Last Answer : (A) 6x + 7, 6x + 11 Explanation: fog(x)=f(g(x))=f(3x+2)=2(3x+2)+3=6x+7 gof(x)=g(f(x))=g(2x+3)=3(2x+3)+2=6x+11

Description : There is road besides a river. Two friends started from a place P, moved to a shopping mall situated at another place Q and then returned to P again. One of them moves on a cycle at a speed of 12 km/ ... which of the two friends will return to place P? A. Both B. Boater C. Cyclist D. None of these 

Last Answer : Answer-C Explanation: The cyclist moves both ways at a speed of 12khr so average speed fo the cyclist - 12 km/hr boat sailor moves downstream at 10+4 = 14km/hr and upstream 10- 4 = 6km/hr ... 8.4km/hr The average speed of cyclist is greater .so,cyclist comes first and return to place P.

Description : The simplified function in product of sums of Boolean function F(W, X, Y, Z) = Σ(0, 1, 2, 5, 8, 9, 10) is (A) (W' + X') (Y' + Z') (X' + Z) (B) (W' + X') (Y' + Z') (X' + Z') (C) (W' + X') (Y' + Z) (X' + Z) (D) (W' + X') (Y + Z') (X' + Z)

Last Answer : (A) (W' + X') (Y' + Z') (X' + Z)

Description : Can there be multiple return statements in a function?

Last Answer : A: Yes, but only one of them is executed.

Description : Let f(n) and g(n) be asymptotically non-negative functions. Which of the following is correct? (A) θ(f(n) * g(n)) = min(f(n), g(n)) (B) θ(f(n) * g(n)) = max(f(n), g(n)) (C) θ(f(n) + g(n)) = min(f(n), g(n)) (D) θ(f(n) + g(n)) = max(f(n), g(n))

Last Answer : (D) θ(f(n) + g(n)) = max(f(n), g(n))

Description : A recursive function h, is defined as follows: h(m)=k, if m=0  = 1, if m=1 = 2h(m-1) + 4h(m-2), if m≥2 If the value of h(4) is 88 then the value of k is: (1) 0 (2) 1 (3) 2 (4) -1

Last Answer : (3) 2 

Description : Methods can be overloaded with a difference only in the type of the return value .. A) Not supported B) False C) True D) None of the above

Last Answer : B) False

Description : State True or False. i) While overloading operators new operator can be overloaded. ii) The binary operator such as +, -, * and must explicitly return a value. A) True, True B) True, False C) False, True D) False, False

Last Answer : C) False, True

Description : State True or False i) A destructor never takes any argument nor does it return any value. ii) It releases memory space for future use. A) True, True B) True, False C) False, True D) False, False

Last Answer : A) True, True

Description : A method name myMethod( ) that needs two integer arguments is declared as A) public void myMethod( ); B) public void myMethod(int a, int b); C) public void myMethod(int a, b); D) public int myMethod(a, b);

Last Answer : B) public void myMethod(int a, int

Description : How many times does the following code segment execute int x=1, y=10, z=1; do{y--; x++; y-=2; y=z; z++} while (y>1 && z

Last Answer : A) 1

Description : If an integer occupies 4 bytes and a character occupies 1 byte of memory, each element of the following structure would occupy how many bytes ? struct name { int age; char name[30]; }; A) 30 B) 32 C) 34 D) 36

Last Answer : C) 34

Description : Trace the error: void main( ) { int *b, &a; *b = 20 printf(“%d, %d”, a, *b) } (A) No error (B) Logical error (C) Syntax error (D) Semantic error

Last Answer : (C) Syntax error

Description : What will be the output of the following segment of the program? main( ) { char *s = “hello world”; int i = 7; printf(“%, *s”, i, s); } (A) Syntax error (B) hello w (C) hello (D) o world

Last Answer : Answer: Marks given to all

Description : What does the following declaration mean ? int (*ptr) [10]; (A) ptr is an array of pointers of 10 integers. (B) ptr is a pointer to an array of 10 integers. (C) ptr is an array of 10 integers. (D) none of the above.

Last Answer : (B) ptr is a pointer to an array of 10 integers.

Description : What will be the output of the following ‘C’ code ? main ( ) { int x = 128; printf (“\n%d”, 1 + x++); } (A) 128 (B) 129 (C) 130 (D) 131

Last Answer :  (B) 129

Description : The Servlet Response interface enables a servlet to formulate a response for a client using the method ............... (A) void log(Exception e, String s) (B) void destroy() (C) int getServerPort() (D) void setContextType(String Type)

Last Answer : (D) void setContextType(String Type)

Description : 10) i) \( A=\{a, b, c\} \) and \( B=\{x, 4\} \). Write \( A \times B \)ii) Graph of the function \( f: R \rightarrow R \) is given below.a) Write the value of \( f(x) \)b) Write the range of \( f(x) \)c) Identify The function and choose the correct answer.

Last Answer : 10) i) \( A=\{a, b, c\} \) and \( B=\{x, 4\} \). Write \( A \times B \) ii) ... of \( f(x) \) c) Identify The function and choose the correct answer.

Description : Consider a fuzzy set old as defined below Old = {(20, 0.1), (30, 0.2), (40, 0.4), (50, 0.6), (60, 0.8), (70, 1), (80, 1)} Then the alpha-cut for alpha = 0.4 for the set old will be (A) {(40, 0.4)} (B) {50, 60, ... , (30, 0.2)} (D) {(20, 0), (30, 0), (40, 1), (50, 1), (60, 1), (70, 1), (80, 1)}

Last Answer : (D) {(20, 0), (30, 0), (40, 1), (50, 1), (60, 1), (70, 1), (80, 1)}

Description : Consider a hash table of size m=100 and the hash function h(k) = floor(m(kA mod 1)) for A = (√5 − 1)/2 = 0.618033. Compute the location to which the key k = 123456 is placed in hash table. (A) 77 (B) 82 (C) 88 (D) 89

Last Answer : (C) 88

Description : Big - O estimate for f(x) = (x + 1) log(x2 + 1) + 3x2 is given as (A) O(xlogx) (B) O(x2) (C) O(x3) (D) O(x2logx)

Last Answer : (B) O(x2)