SlideShare a Scribd company logo
1 of 1
Download to read offline
What will the contents of the a array after the following statements are executed?
# define N 10
int a[N] = {1,2,3,4,5,6,7,8,9,10};
int *p = &a[0], *q = &a[N-1], temp;
while (p
temp = *p;
*p++ = *q;
*q-- = temp; }
Solution
Program :
#include
# define N 10
using namespace std;
int main() {
int a[N] = {1,2,3,4,5,6,7,8,9,10};
int *p = &a[0], *q = &a[N-1], temp;
while(p)
{
temp = *p;
*p++ = *q;
*q-- = temp;
}
cout << "The content of array after execution of above statements is a[N] = " <

More Related Content

More from artcraft14

a) Why is there no EO input in the decimal-to-BCD encoderb) Name .pdf
a) Why is there no EO input in the decimal-to-BCD encoderb) Name .pdfa) Why is there no EO input in the decimal-to-BCD encoderb) Name .pdf
a) Why is there no EO input in the decimal-to-BCD encoderb) Name .pdfartcraft14
 
• Identify the distinguishing characteristics of member of Phylum Cn.pdf
• Identify the distinguishing characteristics of member of Phylum Cn.pdf• Identify the distinguishing characteristics of member of Phylum Cn.pdf
• Identify the distinguishing characteristics of member of Phylum Cn.pdfartcraft14
 
What are the main responsibilities of the Transport Layer What are .pdf
What are the main responsibilities of the Transport Layer What are .pdfWhat are the main responsibilities of the Transport Layer What are .pdf
What are the main responsibilities of the Transport Layer What are .pdfartcraft14
 
1. CS in tap water develops different potential from that of SS in s.pdf
1. CS in tap water develops different potential from that of SS in s.pdf1. CS in tap water develops different potential from that of SS in s.pdf
1. CS in tap water develops different potential from that of SS in s.pdfartcraft14
 
Which of the following describes the difference between meiosis and m.pdf
Which of the following describes the difference between meiosis and m.pdfWhich of the following describes the difference between meiosis and m.pdf
Which of the following describes the difference between meiosis and m.pdfartcraft14
 
What three addresses are needed to move data from one application to .pdf
What three addresses are needed to move data from one application to .pdfWhat three addresses are needed to move data from one application to .pdf
What three addresses are needed to move data from one application to .pdfartcraft14
 
What are some invasive species on the Hawaii islands. When and howw.pdf
What are some invasive species on the Hawaii islands. When and howw.pdfWhat are some invasive species on the Hawaii islands. When and howw.pdf
What are some invasive species on the Hawaii islands. When and howw.pdfartcraft14
 
What could cause those issuesWhat could those issues causeWhat.pdf
What could cause those issuesWhat could those issues causeWhat.pdfWhat could cause those issuesWhat could those issues causeWhat.pdf
What could cause those issuesWhat could those issues causeWhat.pdfartcraft14
 
Two students, Amy and Jeff, disagree about an analog system function .pdf
Two students, Amy and Jeff, disagree about an analog system function .pdfTwo students, Amy and Jeff, disagree about an analog system function .pdf
Two students, Amy and Jeff, disagree about an analog system function .pdfartcraft14
 
1) A computer converts raw data into information. True False Next Que.pdf
1) A computer converts raw data into information. True False Next Que.pdf1) A computer converts raw data into information. True False Next Que.pdf
1) A computer converts raw data into information. True False Next Que.pdfartcraft14
 
The final electron acceptor(s) associated with photosystem II isare.pdf
The final electron acceptor(s) associated with photosystem II isare.pdfThe final electron acceptor(s) associated with photosystem II isare.pdf
The final electron acceptor(s) associated with photosystem II isare.pdfartcraft14
 
State the principles of management as enumerated by Henry Fayol. Exp.pdf
State the principles of management as enumerated by Henry Fayol. Exp.pdfState the principles of management as enumerated by Henry Fayol. Exp.pdf
State the principles of management as enumerated by Henry Fayol. Exp.pdfartcraft14
 
Please write a general overview of the different ways that using phyl.pdf
Please write a general overview of the different ways that using phyl.pdfPlease write a general overview of the different ways that using phyl.pdf
Please write a general overview of the different ways that using phyl.pdfartcraft14
 
Maech the body regions in eelumn n with the locations in column B. Pl.pdf
Maech the body regions in eelumn n with the locations in column B. Pl.pdfMaech the body regions in eelumn n with the locations in column B. Pl.pdf
Maech the body regions in eelumn n with the locations in column B. Pl.pdfartcraft14
 

More from artcraft14 (14)

a) Why is there no EO input in the decimal-to-BCD encoderb) Name .pdf
a) Why is there no EO input in the decimal-to-BCD encoderb) Name .pdfa) Why is there no EO input in the decimal-to-BCD encoderb) Name .pdf
a) Why is there no EO input in the decimal-to-BCD encoderb) Name .pdf
 
• Identify the distinguishing characteristics of member of Phylum Cn.pdf
• Identify the distinguishing characteristics of member of Phylum Cn.pdf• Identify the distinguishing characteristics of member of Phylum Cn.pdf
• Identify the distinguishing characteristics of member of Phylum Cn.pdf
 
What are the main responsibilities of the Transport Layer What are .pdf
What are the main responsibilities of the Transport Layer What are .pdfWhat are the main responsibilities of the Transport Layer What are .pdf
What are the main responsibilities of the Transport Layer What are .pdf
 
1. CS in tap water develops different potential from that of SS in s.pdf
1. CS in tap water develops different potential from that of SS in s.pdf1. CS in tap water develops different potential from that of SS in s.pdf
1. CS in tap water develops different potential from that of SS in s.pdf
 
Which of the following describes the difference between meiosis and m.pdf
Which of the following describes the difference between meiosis and m.pdfWhich of the following describes the difference between meiosis and m.pdf
Which of the following describes the difference between meiosis and m.pdf
 
What three addresses are needed to move data from one application to .pdf
What three addresses are needed to move data from one application to .pdfWhat three addresses are needed to move data from one application to .pdf
What three addresses are needed to move data from one application to .pdf
 
What are some invasive species on the Hawaii islands. When and howw.pdf
What are some invasive species on the Hawaii islands. When and howw.pdfWhat are some invasive species on the Hawaii islands. When and howw.pdf
What are some invasive species on the Hawaii islands. When and howw.pdf
 
What could cause those issuesWhat could those issues causeWhat.pdf
What could cause those issuesWhat could those issues causeWhat.pdfWhat could cause those issuesWhat could those issues causeWhat.pdf
What could cause those issuesWhat could those issues causeWhat.pdf
 
Two students, Amy and Jeff, disagree about an analog system function .pdf
Two students, Amy and Jeff, disagree about an analog system function .pdfTwo students, Amy and Jeff, disagree about an analog system function .pdf
Two students, Amy and Jeff, disagree about an analog system function .pdf
 
1) A computer converts raw data into information. True False Next Que.pdf
1) A computer converts raw data into information. True False Next Que.pdf1) A computer converts raw data into information. True False Next Que.pdf
1) A computer converts raw data into information. True False Next Que.pdf
 
The final electron acceptor(s) associated with photosystem II isare.pdf
The final electron acceptor(s) associated with photosystem II isare.pdfThe final electron acceptor(s) associated with photosystem II isare.pdf
The final electron acceptor(s) associated with photosystem II isare.pdf
 
State the principles of management as enumerated by Henry Fayol. Exp.pdf
State the principles of management as enumerated by Henry Fayol. Exp.pdfState the principles of management as enumerated by Henry Fayol. Exp.pdf
State the principles of management as enumerated by Henry Fayol. Exp.pdf
 
Please write a general overview of the different ways that using phyl.pdf
Please write a general overview of the different ways that using phyl.pdfPlease write a general overview of the different ways that using phyl.pdf
Please write a general overview of the different ways that using phyl.pdf
 
Maech the body regions in eelumn n with the locations in column B. Pl.pdf
Maech the body regions in eelumn n with the locations in column B. Pl.pdfMaech the body regions in eelumn n with the locations in column B. Pl.pdf
Maech the body regions in eelumn n with the locations in column B. Pl.pdf
 

Recently uploaded

Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...MysoreMuleSoftMeetup
 
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lessonQUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lessonhttgc7rh9c
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfPondicherry University
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsNbelano25
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
Introduction to TechSoup’s Digital Marketing Services and Use Cases
Introduction to TechSoup’s Digital Marketing  Services and Use CasesIntroduction to TechSoup’s Digital Marketing  Services and Use Cases
Introduction to TechSoup’s Digital Marketing Services and Use CasesTechSoup
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...EADTU
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaEADTU
 
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...Gary Wood
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....Ritu480198
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptNishitharanjan Rout
 
Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Celine George
 

Recently uploaded (20)

Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
 
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lessonQUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf arts
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Introduction to TechSoup’s Digital Marketing Services and Use Cases
Introduction to TechSoup’s Digital Marketing  Services and Use CasesIntroduction to TechSoup’s Digital Marketing  Services and Use Cases
Introduction to TechSoup’s Digital Marketing Services and Use Cases
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
 
OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
 
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....
 
Including Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdfIncluding Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdf
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 
Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17
 

What will the contents of the a array after the following statements.pdf

  • 1. What will the contents of the a array after the following statements are executed? # define N 10 int a[N] = {1,2,3,4,5,6,7,8,9,10}; int *p = &a[0], *q = &a[N-1], temp; while (p temp = *p; *p++ = *q; *q-- = temp; } Solution Program : #include # define N 10 using namespace std; int main() { int a[N] = {1,2,3,4,5,6,7,8,9,10}; int *p = &a[0], *q = &a[N-1], temp; while(p) { temp = *p; *p++ = *q; *q-- = temp; } cout << "The content of array after execution of above statements is a[N] = " <