Question

In C++:

Examine the code segment. What will be printed?

If there are any errors indicate the nature of each error.

int a[7] = {31, 12, 32, 14, 25, 16, 27};

int *ptr;

ptr = & a[2];

for ( i=1; i<=5; i=i+2)

cout << *(ptr +i);

cout << a[0] << *ptr << *ptr - 2 << *(ptr -1)) << endl;

Expert Answer

1 Rating

Want to see the step-by-step answer?

Check out a sample Q&A here.

Want to see this answer and more?

Experts are waiting 24/7 to provide step-by-step solutions in as fast as 30 minutes!*

*Response times may vary by subject and question complexity. Median response time is 34 minutes for paid subscribers and may be longer for promotional offers.
Tagged in
Engineering
Computer Science

Object Oriented Programming

Related Computer Science Q&A

Find answers to questions asked by students like you.

Q: Im trying to write code for java where the random array that I have genreated are used and then list...

A: Following is the source code with modifications in it. Comments have been added wherever the modific...

Q: what is a router?

A: Router:A router is a physical or virtual tool for receiving, processing and transferring incoming pa...

Q: Translate the following instructions from Pep/9 machine language: (Describe what each instruction do...

A: Given instructions -D1 FC 15 F1 00 21 90 00 20 F1 00 21 F1 FC 16 00 zzSize of main memory is 216 byt...

Q: in python 3.2 Selling a new vehicle pays a salesperson $1500. Selling a used vehicle pays a commissi...

A: Import local function to use currency formatting in the program.prompt user to enter the type of veh...

Q: Compare and contrast cache and virtual memory and give an example scenario where each can be applied...

A: Cache memory:-It is the memory, which is very nearest to the CPU, all recent instruction is stored i...

Q: What trade-offs are involved in building highly distributed data environments?

A: Trade-offs that are involved in building highly distributed data environments: 1) Availability,  2) ...

Q: (check all that apply) Which of the following is true about constraint names?A) it can be used for D...

A: A) it can be used for DBA to identify a constraint easily:Yes. Constraints are the rules that are ap...

Q: This program is written in pseudocode."Design a program that asks the user to enter a store's sales ...

A: Program code #1:

Q: A matrix named mach contains three columns of data concerning the energy output of several machines....

A: JAVA programClass name is Matrix. It contains function named Transfer.Create a matrix named mach of ...

Q: What is the typical size of the security staff in a small organization? A medium-sized organization?...

A: Answer:Size of security staff in a small organization:The size of the security staff in a small-size...

Q: A domain controller clone is a replica of an existing DC. Group of answer choices True False

A: Domain Controller:Domain controller is a server computer on Microsoft servers.The purpose of domain ...

Q: 8. Write a C++ program to find the sum of all odd integers from 1 to 99, and the sum of their cubes.

A: To solve this question following variables and loop should be required:Variables: total, num, and cu...

Q: In Python Use the Design Recipe to write a function has_duplicates, which consumes a list and return...

A: This program returns true when a list has duplicate value, if the list has not any duplicate value t...

Q: Write a Java program that prompts the user for the page size used in a virtual memory system; this w...

A: A Java program that accepts a valid system page size and virtual address and calculates the page num...

Q: Create a GUI interface for a currency converter - Dollar-to-Euro. It should look something like the ...

A: To create a GUI converter that converts the currency from dollar to euro below is the approach and j...

Q: Python 3.7.4 Store four file objects corresponding to the files winter2003.txt , spring2003.txt, sum...

A: Python statements for creating file objects: winter=open("winter2003.txt", "r")spring=open("spring20...

Q: Python 3.7.4: (Introductory Level) Write a program that requests a word (in lowercase letters) as in...

A: This problem must be answered in Python 3 of the version 3.7.4. According the question its clearly a...

Q: In MS Access, which kind of values will be accepted by the databasethrough input mask&gt;L0L0L0;0;#A...

A: An input mask in MS-Access contain 3 fields.These fields are separated by semi-colonFirst field spec...

Q: Suppose you have two tables: EMPLOYEE and EMPLOYEE_1. The EMPLOYEE table contains the records for th...

A: Two tables are given named as EMPLOYEE and EMPLOYEE1. Each table has its records. EMPLOYEE table has...

Q: The truth table for a Boolean expression is shown below. Write the Boolean expression in sum-of-prod...

A: Answer:Sum of Product (SOP) form:If the input is 1, then write an AND term for each input combinatio...

Q: Write a loop that sets newScores to oldScores shifted once left, with element 0 copied to the end. E...

A: oldScores is an integer type array that stores 4 value.newScores is an integer type array that copy ...

Q: I have written a C++ class called 'Birthday' and I want to write a method that can compare with anot...

A: Programming instructions:First, create the constructor to initialize the variables with the initial ...

Q: consider the udp header 12 03 00 0F 00 1E A3 10.What is the total length of the udp

A: The UPD header basically has 4 parts, each part is of 2 bytes. That means following interpretation o...

Q: in python 2.2Write a program that prompts the user for two inputs: the unit cost of an item and the ...

A: round() function is used to round the number.Syntax of round function:round(number [, ndigit])number...

Q: 3prep Write a Python program for an online MoonBucks coffee order. Coffee is sold by the pound, and ...

A: Program AlgorithmDeclare the required variables and take the input from the user for the pound’s use...

Q: I need some help arranging these countries in a C++ program : China: 1,433,783,686 India: 1,366,417,...

A: Program AlgorithmDeclare two arrays named country and population of size 14.Using for loop enter the...

Q: WHAT ARE THE ADVANTAGES DUE TO PRATICAL USES OF CRYPTOCURRENCY?

A: In the last couple of years, cryptocurrency has grown tremendously as people are using this alternat...

Q: What is the RAND Report? Why was it developed? What was published in the RAND Report R-609?Why was i...

A: RAND Report:RAND reports consist of findings from the profound research and objective analysis which...

Q: What is a disaster recovery plan, and why is it important for the organization? How to evaluate the ...

A: Disaster recovery plan is a formal documentation that includes detailed instructions and structural ...

Q: Translate the following pseudocode for finding the minimum value from a set of inputs into a Java pr...

A: Java program to find the minimum valueimport java.util.Scanner; public class Program{     Public sta...

Q: Write an expression using membership operators that prints "Special number" if special_num is one of...

A: Python Program:#Declare and initialize the variablespecial_list = [-99, 0, 44]#Prompt the user to gi...

Q: Design a reasonably efficient algorithm for solving each of the following problems and determine its...

A: Algorithm to find who failed to pay telephone billFor finding who failed to pay telephone bill, firs...

Q: Write a C++ program: you are now working for an accounting firm. Your employer is interested in dete...

A: This program accepts the number of hours and pay rate of an employee as input.For 40 regular hours a...

Q: Create an array of 100 integers using a random generator How do I create this using java.util.Random...

A: Program InstructionsDeclare the required packages.Define the class as Random_Array and create the ob...

Q: What are the four components of php application and explain why these are so important?

A: Four components of a PHP application are the following:DatabaseHTMLSessions/Authentication/ CookiesU...

Q: Use the Design Recipe to write a function called running_average that repeatedly asks the user to in...

A: DESIGN RECIPE:Based on the given problem use meaningful variable and function name. And perform the ...

Q: Use the Design Recipe to write a function weighted_total(number_list,weights) that consumes a list o...

A: The given list of numbers is [1, 2, 3].The given weights are [0.1, 0.5, 0.4].weighted_total(number_l...

Q: In MS Access, to ensure that a promised date valued entered must a future point in time, whichvalida...

A: Now() function:The Now() function in Microsoft Access is used to return current date and time based ...

Q: PLEASE EXPLAIN ALL STEPSDevelop a k-map to simplify the equation (truth table included)

A:  Given boolean expression = xz + (xy + ~z)Now by using given truth table, draw a K-map of 8 cells by...

Q: In C++ how would i write a program that extracts a all of the lines if the payrate is less than what...

A: Program DescriptionDesign a function to split a string into a vector or words / tokensUse the functi...

Q: Write a loop that reads positive integers from standard input and that terminates when it reads an i...

A: To check the condition that the number is positive and print the sum, count of even and odd integers...

Q: What are the benefits of using a vector over an array?

A: Vector - It is a data structure used to store data.Vectors can be implemented as dynamic arrays with...

Q: Find the truth table that describes the following circuit:

A: The gates involved in the given circuits are:AND gate between Y and X.XNOR gate between Y and ~Z whi...

Q: I have written a code following the instructions below, but the choice 2, convert Fahrenheit to Cels...

A: Reason for not asking the user to enter another value:In the code given in the question, if the choi...

Q: What are the mantissa and exponent of 6.75 in 8-bit floating point binary system?

A: The given number is 6.75First, convert it in binary form.Binary form of 6 is 110Binary form of 0.75 ...

Q: in python   Write a program that prompts the user for three keyboard inputs and stores them in appro...

A: Following is the python program which takes three inputs from the user i.e. first name, last name an...

Q: Siobhan’s laptop has 8GB of RAM. Her operating system takes up 2GB, and her application programs use...

A: Random Access Memory (RAM):RAM is a memory device used for storage purposes.The data stored in the m...

Q: EXPLAIN ALL STEPS: Convert the following machine language instructions into assembly language, assum...

A: a.82B7DEConvert the above machine language into binary format1000 0010 1011 0111 1101 11101000 raaaT...

Q: Hi, I have to display the first 20 Fibonacci numbers to the console. The first two numbers are given...

A: The following is the source code that will generate the first 20 Fibonacci numbers and prints the su...

Q: Siobhan’s laptop has 8GB of RAM. Her operating system takes up 2GB, andher application programs use ...

A: It also depends that whether the graphic card is installed or not otherwise an 8 Gb of RAM itself is...