Q1- Determine the value of m and n after the execution of code given below.
int m = 44;
int* p = &m;
int& r = m;
int n = (*p)++;
int* q = p - 1;
++*q;
Assume that integers occupy 4 bytes and that m is stored in memory. (5 MARKS)
Q2- Write a program which defines two strings "Hello" and "Pakistan", merges both the strings using string manipulation function and displays on the screen. (5)
Q3- How the function strcpy() is different from the function strncpy() in terms of their working?
Q4- Determine the output of the given code segment.
#include <iostream.h>
main()
{
char *name[] = {"Ali", "Ahmad", "Riaz"};
int x;
int y;
x = sizeof(name);
y = sizeof(*name);
cout<<x<<endl<<y;
return 0;
}
Q5- We know that random method for accessing the files increases the performance but there are certain constrainsts on it. Mention those constraints
Q6- Write the code to access the element at third row and second column of a 2D array uses pointer named arrayptr.
0 comments
Post a Comment