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)

1 Answer

Answer :

(A) y = (int)(x+0.5)

Related questions

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 : Bresenham line drawing algorithm is attractive because it uses (A) Real arithmetic only (B) Integer arithmetic only (C) Floating point arithmetic (D) Real and integer arithmetic

Last Answer : (B) Integer arithmetic only

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 : 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 : 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 : 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 : 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 : 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 : A computer program selects an integer in the set {k : 1 ≤ k ≤ 10,00,000} at random and prints out the result. This process is repeated 1 million times. What is the probability that the value k = 1 appears in the printout atleast once ? (A) 0.5 (B) 0.704 (C) 0.632121 (D) 0.68

Last Answer : (C) 0.632121

Description : NULL is (A) the same as 0 for integer (B) the same as blank for character (C) the same as 0 for integer and blank for character (D) not a value

Last Answer : (D) not a value

Description : In a relational database model, NULL values can be used for all but which one of the following? (A) To allow duplicate tuples in the table by filling the primary key column(s) with NULL. (B) To ... D) To fill a column in a tuple when that column does not really exist for that particular tuple.

Last Answer : (A) To allow duplicate tuples in the table by filling the primary key column(s) with NULL.

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 a variable is declared final, it must include ...................... value. A) integer B) no C) initial D) float

Last Answer : C) initial

Description : 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

Last Answer : (A) 2550

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 : Consider the following database table : Create table test( one integer, two integer, primary key(one), unique(two), check(one≥1 and ≤10), check(two≥1 and ≤5) ); How many data records/tuples atmost can this table contain ?  (A) 5 (B) 10 (C) 15 (D) 50

Last Answer : (A) 5 

Description : Which is not the main feature of DEC Alpha: a. 64 Bit RISC processor b. Designed to replace 32 VAX(CISC) c. Seven stage split integer/floating point pipeline d. Variable Instruction length

Last Answer : d. Variable Instruction length

Description : Why do you write ‘Integer.parseInt(br.readLine())’?

Last Answer : A: The inputs in a java program comes in the form of String objects which are read using the br.readLine() function. Now if we want the input in integer form, we have to convert it into integer using the parseInt() function of the Integer wrapper class.

Description : Which of the following control expressions are valid for an if statement? A) An integer expression B) A Boolean expression C) Either A or B D) Neither A nor B

Last Answer : B) A Boolean expression

Description : Which of the following control expressions are valid for an if statement? A) An integer expression B) A Boolean expression C) Either A or B D) Neither A nor B

Last Answer : B) A Boolean expression

Description : Which of the following control expressions are valid for an if statement? A) an integer expression B) a Boolean expression C) either A or B D) Neither A nor B

Last Answer : B) a Boolean expression

Description : An integer constant in C must have A) At least one digit B) At least one decimal point C) A comma along with digits D) Digits separated by commas

Last Answer : A) At least one digit

Description : What is the data type of (1)? a) Tuple b) Integer c) List d) Both tuple and integer

Last Answer : b) Integer

Description : If there are n integers to sort, each integer has d digits and each digit is in the set {1,2, ..., k}, radix sort can sort the numbers in: (A) O(d n k) (B) O(d nk) (C) O((d+n)k) (D) O(d(n+k))

Last Answer : (D) O(d(n+k))

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 : Rewrite the following code using switch case: int day=Integer.parseInt(jTextField1.getText()); -Technology

Last Answer : int day=Integer.parseInt(jTextField1.getText());switch(day){case 1:case 2:case 3:case 4:case 5:jOptionPane1.showMessageDialog(this, 'Working Day'); break;case 6:case 7:jOptionPane1.showMessageDialog(this, 'Off Day'); break;default:jOptionPane1.showMessageDialog(this, 'Invalid Entry');}

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 : 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 : 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 : A structure brings together a group of A) items of the same data type B) related data items and variables C) integers with user defined names D) floating points with user defined names

Last Answer : B) related data items and variables

Description : The IEEE-754 double-precision format to represent floating point numbers, has a length of ........... bits. (A) 16 (B) 32 (C) 48 (D) 64

Last Answer : (D) 64

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 : A Boolean operator Ө is defined as follows: 1Ө1=1, 1Ө0=0, 0Ө1=0 and 0Ө0=1 What will be the truth value of the expression (xӨy)Өz = xӨ(yӨz)? (A) Always false (B) Always true (C) Sometimes true (D) True when x, y, z are all true

Last Answer : (B) Always true

Description : The end points of a given line are (0, 0) and (6, 18). Compute each value of y as x steps from 0 to 3, by using equation of straight line : (A) For x=0, y=0; x=1, y=3; x=2, y=6; x=3, y=9 (B) For x=0, y=1; x=1, y=3; x=2, ... x=1, y=3; x=2, y=6; x=3, y=9 (D) For x=0, y=0; x=1, y=3; x=2, y=4; x=3, y=6

Last Answer : Answer: A

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 : 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 : 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 : 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 : 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 : Python : round up an integer to the next tens or hundreds -Web-Development

Last Answer : answer:

Description : If Ram knows that y is an integer greater than 2 and less than 7 and Hari knows that y is an integer greater than 5 and less than 10, then they may correctly conclude that (A) y can be exactly ... two values (C) y may be any of three values (D) there is no value of y satisfying these conditions

Last Answer : (A) y can be exactly determined

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 : Consider a window bounded by the lines : x = 0; y= 0; x = 5 and y = 3. The line segment joining (–1, 0) and (4, 5), if clipped against this window will connect the points (A) (0, 1) and (2, 3) (B) (0, 1) and (3, 3) (C) (0, 1) and (4, 3) (D) (0, 1) and (3, 2)

Last Answer : (A) (0, 1) and (2, 3)

Description : Now matter what, I come to you round, Floating up, floating down, A single pop, I'm on the ground, Then comes your unpleasant frown. What am I? -Riddles

Last Answer : I am a bubble. Bubbles always come out round no matter how you blow it. Bubbles also pop when they touch the ground. Usually bubbles go up and then down. Most of the time you and I will frown when a bubble pops. Therefore, the answer is a bubble.

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 : Line caps are used for adjusting the shape of the line ends to give them a better appearance. Various kinds of line caps used are (A) Butt cap and sharp cap (B) Butt cap and round cap (C) Butt cap, sharp cap and round cap (D) Butt cap, round cap and projecting square cap

Last Answer : (D) Butt cap, round cap and projecting square cap

Description : A scheduling Algorithm assigns priority proportional to the waiting time of a process. Every process starts with priority zero (lowest priority). The scheduler re-evaluates the process priority for every 'T' time ... (A) Priority scheduling (B) Round Robin Scheduling (C) Shortest Job First (D) FCFS

Last Answer : (B) Round Robin Scheduling