C Programming :: Const / Volatile Qualifier

1 / 10

 What is the output of the following 'C' program?

include
void main ()
{
const int x = get();
printf("%d", x);
}
get()
{
return (20);
}

Answer: Option A

Explanation:

Here is no explanation for this answer

Workspace


Tags:  No Tags on this question yet!

2 / 10

 What is the output of the following 'C' program ?

#include
void main ()
{
int y = 128;
const int x = y;
printf("%d", x);
}

Answer: Option A

Explanation:

Here is no explanation for this answer

Workspace


Tags:  No Tags on this question yet!

3 / 10

 What is the output of the following 'C' program?

#include
void main ()
{
const int x = 5;
int *ptrx;
ptrx = &x;
*ptrx = 10;
printf ("%d", x);
}

Answer: Option B

Explanation:

Here is no explanation for this answer

Workspace


Tags:  No Tags on this question yet!

4 / 10

 What is the output of the following 'C' program ?

#include
void main ()
{
const int x = 5;
const int *ptrx;
ptrx = &x;
*ptrx = 10;
printf("%d", x);
}

Answer: Option B

Explanation:

Here is no explanation for this answer

Workspace


Tags:  Capgemini

5 / 10

 What is the output of the following 'C' program ?

#include
#define SIZE 3
void fun(int *ptr)
{
*ptr = *ptr + 1;
}
int main()
{
int oldval;
const int newval = 0;
static int temp = 99;
int i;
for (i=0;i< SIZE;i++)
{
oldval = newval;
newval = i;
fun(&temp);
}
printf("%d %d %d",oldval,newval,temp);
}

Answer: Option A

Explanation:

Here is no explanation for this answer

Workspace


Tags:  No Tags on this question yet!

6 / 10

 What is the output of the following 'C' program ?

#include
void fun1(void)
{
static int dummy = 5;
dummy = dummy + 10;
printf("%d",dummy);
}
void fun2(char *c)
{
*c = *c + 2;
printf("%d",dummy);
printf("%c", *c);
}
int main()
{
char ch = 'A';
fun1();
fun2(&ch);
printf("%c", ch);
}

Answer: Option D

Explanation:

Here is no explanation for this answer

Workspace


Tags:  No Tags on this question yet!

Answer: Option C

Explanation:

Here is no explanation for this answer

Workspace


Tags:  No Tags on this question yet!

Answer: Option D

Explanation:

Here is no explanation for this answer

Workspace


Tags:  No Tags on this question yet!

9 / 10

 What is output or the error in the program?

#include

void main () {
const char* cptr = "Hello";
printf ("%c", (*++cptr)++);
}

Answer: Option A

Explanation:

Here is no explanation for this answer

Workspace


Tags:  Commvault

10 / 10

 What will be output of the following "c" code?

#include
void main()
{
int const *p=5;
printf("%d", ++(p));
}

Answer: Option A

Explanation:

Here is no explanation for this answer

Workspace


Tags:  No Tags on this question yet!