Looking for Course 31709 test answers and solutions? Browse our comprehensive collection of verified answers for Course 31709 at lms.aub.edu.lb.
Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!
What is the correct way to declare a constant pointer to an integer in C++?
How to release the memory allocated by a pointer in C++?
What does the following C++ code do?
#include<iostream>
using namespace std;
int main() {
int *ptr = NULL;
ptr = new int;
*ptr = 7;
cout << *ptr;
delete ptr;
return 0;
}
How do you dynamically allocate memory for an array in C++ using pointers?
What is the correct way to dynamically create an object in C++?
typedef struct Student
{
int rollno;
int total;
} Student;
Student s1;
struct Student s2;
Which statement is correct?
Consider the following three C functions:
[PI] int * g (void)
{
int x= 10;
return (&x);
}
[P2] int * g (void)
{
int * px;
*px= 10;
return px;
}
[P3] int *g (void)
{
int *px;
px = (int *) malloc (sizeof(int));
*px= 10;
return px;
}
Which of the above functions are likely to cause problems with pointers?
Consider the following program. Where are i, j and *k stored in memory?
int i;
int main()
{
int j;
int *k = (int *) malloc (sizeof(int));
}
int main() {
char p[]="geeksquiz";
char t;
int i,j;
for(i=0,j=strlen(p);i!=j;i++,j--)
{
t=p[i];
p[i]=p[j-i];
p[j-i]=t;
}
printf("%s",p);
return 0;
}
Output?
The most appropriate matching for the following pairs (GATE CS 2000)