96) What happens if the following program is executed in C and C++?

#include <stdio.h> 

int main(void) 

const int j = 20; 

int *ptr = &j;

printf(“*ptr: %d\n”, *ptr); 

return 0; 

}

A. Error in both C and C++

B. Warning in both C and C++

C. Error in C but Warning in C++

D. Error in C++ but Warning in C

Answer : D

97) What happens if the following line is executed in C and C++?

int *p = malloc(10);

A. Error in both C and C++

B. Warning in both C and C++

C. Error in C++ and successful execution in C

D. Error in C and successful execution in C++

Answer : C

98) What happens if the following line is executed in C and C++?

const int a;

A. Error in both C and C++

B. Warning in both C and C++

C. Error in C and successful execution in C++

D. Error in C++ and successful execution in C

Answer : D

99) What happens if the following program is executed in C and C++?

#include <stdio.h> 

int main(void) 

int new = 5;

printf(“%d”, new); 

A. Error in both C and C++

B. A successful run in both C and C++

C. Error in C and successful execution in C++

D. Error in C++ and successful execution in C

Answer : D

100) What happens if the following program is executed in C and C++?

#include <stdio.h> 

void main() 

printf(“Hello World”); 

}

A. Error in both C and C++

B. Successful run in both C and C++

C. Error in C and successful execution in C++

D. Error in C++ and successful execution in C

Answer : D

error: Content is protected !!