Write one difference between / and % operator.

1 Answer

Answer :

Ans. / is division operator while % is modulus operator which gives the remainder on dividing two numbers.

Related questions

Description : Write a difference between Unary and Binary Operator

Last Answer : Ans. Operators that acts on one operand are referred to as Unary Operators while Binary Operators acts upon two operand Unary + or Unary – , increment/decrement are the example of Unary operator While binary operator +,-,*,/ and % are the example of binary operators , (+) adds values of its operands

Description : Write the output for the following: System.out.println(“Incredible” + “\n” + “world”);

Last Answer : Incredible world

Description : If int y = 10 then find int z = (++y * (y++ + 5));

Last Answer : Ans. Increment operator has the highest precedence. So, ++y and y++ will be evaluated starting from left. In ++y, the value of y will be incremented to 11 and then 11 will be used in the expression. When y++ is evaluated, the current ... int z = (++y * (y++ + 5)); = 11 * (11 + 5 ) = 11 * 16 = 176

Description : What are the types of casting shown by the following examples: (i) char c = (char)120; (ii) int x = ‘t’;

Last Answer : Ans. (i) Explicit casting (ii) Implicit casting

Description : Name any two library packages.

Last Answer : Ans. java.util, java.io

Description : Name the operators listed below i) < ii) ++ iii) && iv) ?:

Last Answer : Ans. i) Less than comparison operator ii) Increment operator iii) And logical operator iv) Ternary operator

Description : System.out.print(“BEST “); System.out.println(“OF LUCK”); Choose the correct option for the output of the above statements: (i) BEST OF LUCK (ii) BEST OF LUCK

Last Answer : Ans. (i) is the correct output. System.out.print() does not add a new line at the end because of which ‘OF LUCK’ gets printed on the same line as ‘BEST’.

Description : int res = ‘A’; What is the value of res?

Last Answer : Ans. res will hold the ASCII value of ‘A’ which is 65.

Description : Classify the following as primitive or non-primitive data types: (i) char (ii) arrays (iii) int (iv) classes

Last Answer : Ans. (i) char – Primitive (ii) arrays – Non primitive (iii) int – Primitive (iv) Classes – Non primitive

Description : What is meant by a package.Give an example

Last Answer : Ans. Package in Java is a mechanism to encapsulate a group of classes, sub packages and interfaces., examples : lang , io , util etc..

Description : If the value of basic = 1500, what will be the value of tax after the following statement is executed tax = basic > 1200 ? 200 : 100

Last Answer : Ans. 200

Description : Personnel who design, program, operates and maintains computer equipment refers to A) Console-operator B) Programmer C) Peopleware D) System Analyst

Last Answer : Answer : C

Description : What is the name of the display feature that highlights are of the screen which requires operator attention? A) Pixel B) Reverse video C) Touch screen D) Cursor

Last Answer : Answer : B

Description : The work done by a computer operator is displayed in which part of computer? A. CPU B. VDU C. ALU D. None of the Above

Last Answer : B. VDU

Description : What does the && operator do in a program code?

Last Answer : The && is also referred to as AND operator. When using this operator, all conditions specified must be TRUE before the next action can be performed. If you have 10 conditions and all but 1 fails to evaluate as TRUE, the entire condition statement is already evaluated as FALSE.

Description : What is the modulus operator?

Last Answer : The modulus operator outputs the remainder of a division. It makes use of the percentage (%) symbol. For example: 10 % 3 = 1, meaning when you divide 10 by 3, the remainder is 1.

Description : The basic operation performed by a computer are: a) Arithmatic Operator b) Logical c) Storation d) All of above e) None of These

Last Answer : d) All of above

Description : BIOS stands for _______: a)Basic Integrated Output System b) Basic Integrated Operator System c) Basic Input Output Software d) Basic Input Output System e) None of The Above

Last Answer : d) Basic Input Output System

Description : The unit of hardware, which an operator uses to monitor computer processing, is the 1) Card Reader 2) CPU 3) Line Printer 4) Console

Last Answer : 4) Console

Description : The individual within the operations group who ordinarily uses a variety of keyboard devices, is the 1) Data Clerk 2) Keypunch Operator 3) Data Entry Clerk 4) Computer Operator

Last Answer : 3) Data Entry Clerk

Description : What is a scope resolution operator?

Last Answer : A scope resolution operator (::), can be used to define the member functions of a class outside the class.

Description : What is function overloading and operator overloading?

Last Answer : Function overloading: C++ enables several functions of the same name to be defined, as long as these functions have different sets of parameters (at least as far as their types are ... add anything fundamental to the language (but they can improve understandability and reduce maintenance costs).

Description : Which of the following is not a logical operator ? (1) ADD (2) AND (3) NOT (4) OR

Last Answer : ADD

Description : Write some code to overload an operator. 

Last Answer : class TempleCompare { public int templeCompareID; public int templeValue; public static bool operator == (TempleCompare x, TempleCompare y) { return (x.templeValue == y.templeValue); } ... templeValue); } public override int GetHashCode() { return templeCompareID; } }

Description : Write a C++ program to overload binary operator ‘+’ to concatenate two strings.

Last Answer : #include<iostream.h> #include<conio.h> #include<string.h> class opov  { char str1[10]; public: void getdata() { cout<<"\nEnter a strings"; cin>>str1; } ... ,o2; clrscr(); o1.getdata(); o2.getdata();  o1+o2; getch();  }

Description : Write a program for overloading of ++unary operator for inch to feet conversion. 12 inch = 1 feet.

Last Answer : #include #include class abc { int i,f; public: abc(int f1,int i1) { f=f1; i=i1; } void operator ++() {  while(i>11)  {  f++;  i=i-12;  }  cout

Description : Write a program to overload ‘+’ operator to concatenate two strings.

Last Answer : #include #include #include class string1 { char str[20]; public: void getdata() { coutstr; } void display() { cout

Description : Write a C++ program to overload = = operator to check equality of two strings.

Last Answer : #include<iostream.h> #include<conio.h> #include<string.h> class string { char str1[20]; public: void get() { cout<<"Enter string:"; cin>>str1; } void operator = =( ... ; string s,s1; s.get(); s1.get(); s==s1; getch(); }

Description : Write a program to overload the ‘—’ unary operator to negate the values.

Last Answer : #include<iostream.h> #include<conio.h> #include<string.h> class Number { int x,y; public: Number (int a, int b) { a =x; b =y; } void display() { cout<< ... ; -N1; cout<<"\n After negation:"; N1. display (); getch (); }

Description : What symbol is present on the number key '7' on the keyboard: a) % b) & c) $ d) None of These

Last Answer : b) &

Description : E-mail addresses separate the user name from the ISP using the .... symbol. 1) & 2) @ 3) % 4) *

Last Answer : 2) @

Description : In C language, the formatting character should be preceded by the symbol: (1) + (2) / (3) % (4) –

Last Answer : %

Description : What is the difference between the new operator and modifier?

Last Answer : The new operator creates an instance of a class whereas the new modifier is used to declare a method with the same name as a method in one of the parent classes.

Description : Write the formula for weight % and mole %.

Last Answer : Formulas for: 1. weight %  Let a mixture contains components A,B & C of weights WA, WB & WC Weight % of A =( Weight of A/ Total weight of mixture) * 100  = WA/(WA+WB+WC)*100 2. mole % Let the moles of the components be nA,nB & nC Mol% of A = (moles of A/total moles)*100  = (nA/nA+nB+nC) *100

Description : What is difference between % ROWTYPE and TYPE RECORD ?

Last Answer : % ROWTYPE is to be used whenever query returns a entire row of a table or view. TYPE rec RECORD is to be used whenever query returns columns of different table or views and variables. E.g. ... emp ename %type ); e_rec emp% ROWTYPE cursor c1 is select empno,deptno from emp; e_rec c1 %ROWTYPE.

Description : X, Y, Z started a business by a share of 8:6:9. The time for which they invested was 6:7:8. The difference in the profit of X and Z is what % of difference in the profit of Zand Y? A) 65  B) 80 C) 55 D) 75

Last Answer : Answer: B)  Ratio of investment =8:6:9  Ratio of time =6:7:8  Ratio of X,Y,Z=48:42:72  =8:7:12  (X-Z)/(Z-Y) = 4/5 *100 =80%

Description : Murugan, Anwar, Joseph started a business by a share of 7:8:9. The time for which they invested was 4:2:3. The difference in the profit of Murugan and Joseph is what % of Anwar? A) 7.5 B) 8.2 C) 6.4 D) 6.25

Last Answer : Answer: D)  Ratio of investment =7:8:9  Ratio of time=4:2:3  Ratio of profit =28:16:27 = (Joseph - Murugan)/ Anwar =(28-27)/16*100  =6.25%