Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

a. If you wanted to explicitly include a double-quotation-mark in your string wh

ID: 3848774 • Letter: A

Question

a. If you wanted to explicitly include a double-quotation-mark in your string what would you have to type? For example how would you output: I said "hello" fool! b. what is the value of 12%5? c. If y = -4, what value is x assigned by the statement int x = (y > 0) ? -1: 1: d. Given a string hello = "Test", what would be the value of hello [5] ? e. How about hello[1]? C ++ Math Write complete C++ statements for each of the following mathematical expressions you may assume proper libraries have been #include-ed and all variables have been declared as type double. Y = squareroot 10^x + x^r-3 r= t sin (4a)+ 2/3

Explanation / Answer


//First part

a) double quotation mark
   //in java
   String print = "I said "hello" fool";
   //in c++
   String print ="blah blah "trying to" blah blah";
   cout>>print;

b) modulo prints the reminder.
   hence 12%5 is 2

c) if y=-4
   int x=(y>0) ? -1 : 1;
   answer: codition returns true false.
           that means if (y>0) is true then value before : will be printed else value after : will be printed.
           (-4>0) its true hence output will be -1
          
d) string hello="test"
   indexing starts with 0. we have a 4 characters starting from 0.
   0-t
   1-e
   2-s
   3-t  
   hello(5) will print 'null';
e)   hello(1) will print 'e';

//second part

a) use "pow" and "sqrt" built in function.
   input:- base, exponsion.
   pow(base, exponsion);
  
   example: double base=20.0, exponsion=4.0;
       double result=pow(base,exponsion);
  
   and squart root
       sqrt(value);
   sample example double result=sqrt(25)
  
   example double result=sqrt(pow(10,x)+pow(x,r-3))---please provide x y and r values.

b) double sin (double x);
       float sin (float x);
       long double sin (long double x);
       example sin(value)*1/2;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote