Thursday, 25 August 2016
On 11:59:00 by Unknown No comments
1. What is the output of this C code?
void foo(const int *);
int main()
{
const int i = 10;
printf("%d ", i);
foo(&i);
printf("%d", i);
}
void foo(const int *i)
{
*i = 20;
}
void foo(const int *);
int main()
{
const int i = 10;
printf("%d ", i);
foo(&i);
printf("%d", i);
}
void foo(const int *i)
{
*i = 20;
}
- A. Compile time error
- B. 10 20
- C. Undefined value
- D. 10
- 2. Comment on the output of this C code?
int main()
{
const int i = 10;
int *ptr = &i;
*ptr = 20;
printf("%d\n", i);
return 0;
}- A. Compile time error
- B. Compile time warning and printf displays 20
- C. Undefined behaviour
- D. 10
- 3. What is the output of this C code?
int main()
{
j = 10;
printf("%d\n", j++);
return 0;
}4. Does this compile without error?
int main()
{
for (int k = 0; k < 10; k++);
return 0;
}5. Does this compile without error?
int main()
{
int k;
{
int k;
for (k = 0; k < 10; k++);
}
}- A. Yes
- B. No
- C. Depends on the compiler
- D. Depends on the C standard implemented by compilers
- 6. Which of the following declaration is not supported by C?
- A. String str;
- B. char *str;
- C. float str = 3e2;
- D. Both (a) and (c)
- 7. Which of the following format identifier can never be used for the variable var?
int main()
{
char *var = "Advanced Training in C by AllIndiaExams.com";
}- A. %f
- B. %d
- C. %c
- D. %s
- 8. Which of the following declaration is illegal?
- A. char *str = “Best C programming classes by AllIndiaExams”;
- B. char str[] = “Best C programming classes by AllIndiaExams”;
- C. char str[20] = “Best C programming classes by AllIndiaExams”;
- D. char[] str = “Best C programming classes by AllIndiaExams”;
- 9. Which keyword is used to prevent any changes in the variable within a C program?
Subscribe to:
Post Comments (Atom)
Search
About Me
Followers
Popular Posts
-
1. What is database? A database is a collection of information that is organized. So that it can easily be accessed, managed, and update...
-
1. Property which allows to produce different executable for different platforms in C is called? A. File inclusion B. Selective in...
-
1. What is the output of this C code? void foo(const int *); int main() { const int i = 10; printf( "%d " , i); foo(&i...
-
It makes sure that the product is designed to deliver all functionality to the customer. Verification is done at the starting of the deve...
-
1. What is the output of this C code? int main() { enum {ORANGE = 12, MANGO, BANANA = 11, APPLE}; printf( "APPLE = %d\n...
0 comments:
Post a Comment