When C++ is working with an operator, it strives to convert operands to the same type. This is known as A) type correction
B) type conversion
C) demotion
D) promotion
E) None of these

Answers

Answer 1
Answer:

Answer:

The answer is "Option B"

Explanation:

Conversion of type is a way of changing an entity from one data type to another. It is used to make the variable process properly by a function in computer coding.  

In the C++ language, the result of the multitype value added or any other option is the result between those variables as a large type at that time, that's why choice b is correct.


Related Questions

Describe the components of Computer-based informationsystems.
9 Which of these words is used to begin a conditional statement? ​
A device that protects electronic equipment from an increase in power, but not a decrease or outage is a ___.a. Battery backupb. Surge suppressorc. CRTd. UPS
Which of the following statements is NOT true regarding the Security Configuration and Analysis (SCA) tool?a. It evaluates the current security state of computers in accordance with Microsoft security recommendations.b. It allows an administrator to analyze a computer and compare its configuration settings with a baseline.c. It can apply a baseline to force current computer settings to match the settings defined in the baseline.d. It uses security templates to store the settings that make up baselines.
Object-oriented programming allows you to derive new classes from existing classes. This is calledcomposition.interfaces.inheritancepolymorphism

A web page that allows interaction from the user​

Answers

Answer:

Its A Dynamic Web Page

Explanation:

Write a c++ program to find; (I). the perimeter of rectangle.
(ii). the circumference of a circle.

Note:
(1). all the programs must allow the user to make his input .
(2).both programs must have both comment using the single line comment or the multiple line comment to give description to both programs.​

Answers

Answer:

Perimeter:

{ \tt{perimeter = 2(l + w)}}

Circumference:

{ \tt{circumference = 2\pi \: r}}

Justinputthecodesinthenotepad

. In Stack we can access elements from both ends

o True

o False

Answers

Answer:

False

Explanation:

The answer is False. In Stacks, we can access only the top element present in the stack. Stack is the collection of elements which follow LIFO ( Last In First Out ) which means the last element inserted in the stack is the first element to  out. Stack has restriction that only the element which is present at the top called as top element is only accessible. That means only the top element can be inserted and deleted.

Describe a strategy for avoiding nested conditionals. Give your own example of a nested conditional that can be modified to become a single conditional, and show the equivalent single conditional.

Answers

Answer:

One of the strategies to avoid nested conditional is to use logical expressions such as the use of AND & operator.

One strategy is to use an  interface class with a method. That method can be created to be used for a common functionality or purpose. This is also called strategy design pattern. You can move the chunk of conditional statement to that method. Then each class can implement that interface class and use that shared method according to their own required task by creating objects of sub classes and call that common method for any such object. This is called polymorphism.

Explanation:

Nested conditionals refers to the use of if or else if statement inside another if or else if statement or you can simply say a condition inside another condition. For example:

if( condition1) {  

//executes when condition1 evaluates to true

  if(condition2) {

//executes when condition1  and condition2 evaluate to true

  }  else if(condition3) {

 //when condition1 is true and condition3 is true

} else {

 //condition1  is true but neither condition2 nor conditions3 are true

}  }

The deeply nested conditionals make the program difficult to understand or read if the nested conditionals are not indented properly. Also the debugging gets difficult when the program has a lot of nested conditionals.

So in order to avoid nested conditionals some strategies are used such as using a switch statement.

Here i will give an example of the strategies i have mentioned in the answer.

Using Logical Expressions:

A strategy to avoid nested conditionals is to use logical expressions with logical operators such as AND operator. The above described example of nested conditionals can be written as:

if(condition1 && condition2){  //this executes only when both condition1 and condition2 are true

} else if(condition1 && condition3) {

this executes only when both condition1 and condition3 are true

} else if(condition1 ){

//condition1  is true but neither condtion2 nor condtion3 are true  }

This can further be modified to one conditional as:

if(!condition3){

// when  condition1 and condition2 are true

}

else

// condition3 is true

Now lets take a simple example of deciding to go to school or not based on some conditions.

if (temperature< 40)

{

   if (busArrived=="yes")

   {

       if (!sick)

       {

           if (homework=="done")

           {

               printf("Go to school.");

           }

       }                    

   }

}

This uses nested conditionals. This can be changed to a single conditional using AND logical operator.

if ((temperature <40) && (busArrived=="yes") &&

(!sick) && (homework=="done"))

{    cout<<"Eligible for promotion."; }

The second strategy is to use an interface. For example you can

abstract class Shape{

//declare a method common to all sub classes

  abstract public int area();

// same method that varies by formula of area for different shapes

}

class Triangle extends Shape{

  public int area() {

     // version of area code for Triangle

return (width * height / 2);

  }

}

class Rectangle extends Shape{

  public int area() {

     // version of area code for Rectangle

    return (width * height)

  }

}

// Now simply create Rectangle or Triangle objects and call area() for any such object and the relevant version will be executed.

Which of the following statements is true of recombinant batteries? A. They recombine oxygen.
B. They're able to produce a higher voltage.
C. They're vented to release gassing.
D. They recombine sulfuric acid.

Answers

I’d go for (A) as the right choice.

The basic principles of Oxygen-recombination chemistry hasbeen combined to traditional lead batteries technology to produceValve-regulated lead-acid battery (VRLA), also called recombinant batteries. The applicationof oxygen cycle to VRLA, at first, is much more difficult. However, if correctprinciples are followed, it becomes easy.

Suppose you are given a stack of n pancakes of different sizes. You want to sort the pancakes so that smaller pancakes are on top of larger pancakes. The only operation you can perform is a flip—insert a spatula under the top k pancakes, for some integer k between 1 and n, and flip them all over. Describe an algorithm to sort an arbitrary stack of n pancakes using O(n) flips. [Hint: This problem sounds a bit like the "Tower of Hanoi" probem that you may have encountered in other classes. But don’t be fooled! The solution looks very different.]

Answers

Answer:

We will use the following approach to solve the problem:

Explanation:

1. We will identify the largest pancake in the given stack of pancakes, then insert the spatula below that pancake and flip the entire stack consisting of that largest identified pancake and all other pancakes on the top of it. Now the largest pancake will be on the top of the stack. Now insert the spatula at the bottom of stack and flip. In this way the largest pancake will become the bottommost pancake.

Now identify the next second largest pancake and repeat above process, keep on relating that until all are sorted.

This requires almost 2n-3 flips in worst case. ( For n pancakes). So the time complexity is O(n)

2n because one flip is required to bring pancake at top, then in 2nd flip it goes to bottom.

-3 because, the stack becomes sorted once the 2nd last pancake comes to the top. So next three steps are never required.

B) we want to find stack of n pancakes, that take omega (n) steps.

For that to happen, in worst case ( 2n-3 )>= cn , taking c=1

2n-3 >= n , => n >=3

So for n greater than or equal to 3 the condition holds.