C Programming -Initialization of Pointer Arrays
Question 1
|
To declare a 3 dimension array using pointers, which of the following is the correct syntax:
char *a[][];
| |
char **a[];
| |
char ***a;
| |
All of the mentioned
|
Question 2
|
Comment on the output of this C code?
Output will be program
| |
Output will be p
| |
No output
| |
Compile-time error
|
Question 3
|
An array of strings can be initialized by:
char *a[] = {“Hello”, “World”};
| |
char *a[] = {“Hello”, “Worlds”};
| |
char *b = “Hello”; char *c = “World”; char *a[] = {b, c};
| |
All of the mentioned.
|
Question 4
|
What is the output of this C code?
Segmentation fault
| |
hi hello how followed by 7 null values
| |
10 null values
| |
depends on compiler
|
Question 5
|
What is the output of this C code?
hi hello how Segmentation fault
| |
hi hello how followed by 7 null values
| |
hey hello how Segmentation fault
| |
Depends on compiler
|
Question 6
|
What is the output of this C code?
10
| |
13
| |
Run time error
| |
40
|
Question 7
|
What is the output of this C code?
6
| |
4
| |
5
| |
3
|
Question 8
|
What is the output of this C code?
hi hello how Segmentation fault
| |
hi hello how null
| |
hey hello how Segmentation fault
| |
hi hello how followed by 7 nulls
|
Question 9
|
What is the output of this C code?
Compile time error
| |
Undefined behaviour
| |
hello
| |
None of the mentioned
|
Question 10
|
What is the output of this C code?
Compile time error
| |
Undefined behaviour
| |
hello
| |
Address of hello
|
Question 11
|
What is the output of this C code?
Compile time error
| |
Undefined behaviour
| |
0
| |
Some garbage value
|
Question 12
|
What is the output of this C code?
Compile time error
| |
Undefined behaviour
| |
0
| |
Some garbage value
|
Question 13
|
What is the output of this C code?
Compile time error
| |
Undefined behaviour
| |
1
| |
Some garbage value
|
Question 14
|
Which of the following are generated from char pointer?
char *string = “Hello.”;
| |
char *string; scanf(“%s”, string);
| |
char string[] = “Hello.”;
| |
Both (a) and (c).
|
Question 15
|
Which of the following declaration are illegal?
int a[][] = {{1, 2, 3}, {2, 3, 4, 5}};
| |
int *a[] = {{1, 2, 3}, {2, 3, 4, 5}};
| |
int a[4][4] = {{1, 2, 3}, {2, 3, 4, 5}};
| |
Both (a) and (b).
|
Check Your Answers:
1. A
2. A
3. D
4. A
5. C
6. D
7. B
8. D
9. C
10. B
11. C
12. C
13. D
14. A
15. A
0 comments:
Post a Comment