Pointer

Name: _____________________

Date: _____________________

Instructions: Answer all questions. Write your answers clearly in the space provided.

Question 1:

In linux, argv[0] by command-line argument can be occupied by . . . . . . . .

A. ./a.out
B. ./test
C. ./fun.out.out
D. all of the mentioned
Answer: _________
Question 2:

An array of similar data types which themselves are a collection of dissimilar data type are . . . . . . . .

A. Linked Lists
B. Trees
C. Array of Structure
D. All of the mentioned
Answer: _________
Question 3:

In C, what is a pointer primarily used for?

A. Decision making
B. Code organization
C. Variable declaration
D. Storing values
Answer: _________
Question 4:

What is the result of the expression sizeof(int*) in C, assuming an int pointer on a typical system?

A. 4
B. 8
C. 2
D. 1
Answer: _________
Question 5:

What is the purpose of the '->' operator in C when used with pointers?

A. Arithmetic operation
B. Indirection operator
C. Member access operator
D. Bitwise operation
Answer: _________
Question 6:

In C, what is the value of a pointer variable if it hasn't been assigned any address?

A. 0
B. Null
C. Undefined
D. 1
Answer: _________
Question 7:

What is the result of the expression *ptr in C, where ptr is a pointer to an int?

A. Address of ptr
B. Value pointed to by ptr
C. Size of ptr
D. Type of ptr
Answer: _________
Question 8:

In C, what is the purpose of the 'void' pointer type (void*)?

A. To store any data type's address
B. To declare a pointer as uninitialized
C. To make a pointer point to null
D. To create a generic function
Answer: _________
Question 9:

What is the result of the expression ptr++ in C, where ptr is a pointer?

A. Increase the value of ptr by 1
B. Decrease the value of ptr by 1
C. Move ptr to the next memory location
D. It's not a valid operation
Answer: _________
Question 10:

In C, what is the purpose of the 'const' keyword when used with a pointer declaration?

A. To declare a constant pointer
B. To make the pointer point to a constant value
C. To make the pointer constant
D. To prevent pointer declaration
Answer: _________
Question 11:

Which of the following statements are true? P. Pointer to Array
Q. Multi-dimensional array

A. P are static, Q are static
B. P are static, Q are dynamic
C. P are dynamic, Q are static
D. P are dynamic, Q are dynamic
Answer: _________
Question 12:

Which of the following is not possible statically in C?

A. Jagged Array
B. Rectangular Array
C. Cuboidal Array
D. Multidimensional Array
Answer: _________
Question 13:

Which of the following can never be sent by call-by-value?

A. Variable
B. Array
C. Structures
D. Both Array and Structures
Answer: _________
Question 14:

A program that has no command line arguments will have argc . . . . . . . .

A. Zero
B. Negative
C. One
D. Two
Answer: _________
Question 15:

What is argv[0] in command line arguments?

A. The name by which the program was invoked
B. The name of the files which are passed to the program
C. Count of the arguments in argv[] vector
D. None of the mentioned
Answer: _________
Question 16:

Which is an indirection operator among the following?

A. &
B. *
C. ->
D. .
Answer: _________
Question 17:

One of the uses for function pointers in C is . . . . . . . .

A. Nothing
B. There are no function pointers in c
C. To invoke a function
D. To call a function defined at run-time
Answer: _________
Question 18:

What is the index of the last argument in command line arguments?

A. argc - 2
B. argc + 1
C. argc
D. argc - 1
Answer: _________
Question 19:

What is the maximum number of arguments that can be passed in a single function?

A. 127
B. 253
C. 361
D. No limits in number of arguments
Answer: _________
Question 20:

Arguments that take input by user before running a program are called?

A. Main function arguments
B. Main arguments
C. Command-Line arguments
D. Parameterized arguments
Answer: _________
Question 21:

What is the advantage of a multidimensional array over pointer array?

A. Predefined size
B. Input can be taken from user
C. Faster Access
D. All of the mentioned
Answer: _________
Question 22:

What is the base data type of a pointer variable by which the memory would be allocated to it?

A. int
B. float
C. No data type
D. Depends upon the type of the variable to which it is pointing.
Answer: _________
Question 23:

What is the result of the expression ptr-- in C, where ptr is a pointer?

A. Decrease the value of ptr by 1
B. Increase the value of ptr by 1
C. Move ptr to the previous memory location
D. It's not a valid operation
Answer: _________
Question 24:

In C, what is a function pointer?

A. A pointer that points to a function
B. A pointer returned by a function
C. A pointer to a variable
D. A constant pointer
Answer: _________
Question 25:

What is the result of the expression &array[0] in C, where array is an integer array?

A. Address of the first element in the array
B. Value of the first element in the array
C. Size of the array
D. Type of the array
Answer: _________
Question 26:

In C, what is a null pointer (NULL or 0)?

A. A pointer that points to the address 0
B. A pointer that points to a null value
C. A pointer with an undefined value
D. A pointer to a null object
Answer: _________
Question 27:

What is the result of the expression ptr += 2 in C, where ptr is a pointer?

A. Increase ptr by 2
B. Decrease ptr by 2
C. Move ptr two memory locations forward
D. It's not a valid operation
Answer: _________
Question 28:

In C, what is the purpose of the 'calloc' function?

A. Allocate memory on the stack
B. Allocate memory on the heap
C. Allocate memory for a function
D. Allocate memory for an array of variables
Answer: _________
Question 29:

What is the result of the expression *ptr = 42 in C, where ptr is a pointer to an int?

A. Set the value pointed to by ptr to 42
B. Set the address pointed to by ptr to 42
C. Set the size of ptr to 42
D. Set ptr to a null value
Answer: _________
Question 30:

What is the result of the expression *ptr = NULL in C, where ptr is a pointer?

A. Initialize ptr to 0
B. Delete the pointer ptr
C. Set the value pointed to by ptr to NULL
D. It's not a valid operation
Answer: _________
Question 31:

In C, what is a pointer to a constant pointer (int* const)?

A. A pointer that cannot be modified
B. A pointer that points to a constant pointer
C. A constant pointer to a constant integer
D. A pointer to a constant integer
Answer: _________
Question 32:

How to call a function without using the function name to send parameters?

A. typedefs
B. Function pointer
C. Both typedefs and Function pointer
D. None of the mentioned
Answer: _________
Question 33:

Comment on an array of the void data type.

A. It can store any data-type
B. It only stores element of similar data type to first element
C. It acquires the data type with the highest precision in it
D. You cannot have an array of void data type
Answer: _________
Question 34:

What is the syntax for constant pointer to address (i.e., fixed pointer address)?

A. const <type> * <name>
B. <type> * const <name>
C. <type> const * <name>
D. none of the mentioned
Answer: _________
Question 35:

Which of the following is not possible in C?

A. Array of function pointer
B. Returning a function pointer
C. Comparison of function pointer
D. None of the mentioned
Answer: _________
Question 36:

How many number of pointer (*) does C have against a pointer variable declaration?

A. 7
B. 127
C. 255
D. No limits
Answer: _________
Question 37:

Which type of variables can have the same name in a different function?

A. Global variables
B. Static variables
C. Function arguments
D. Both static variables and Function arguments
Answer: _________
Question 38:

What does argc and argv indicate in command-line arguments? (Assuming: int main(int argc, char *argv[]) )

A. argument count, argument variable
B. argument count, argument vector
C. argument control, argument variable
D. argument control, argument vector
Answer: _________
Question 39:

What are the applications of a multidimensional array?

A. Matrix-Multiplication
B. Minimum Spanning Tree
C. Finding connectivity between nodes
D. All of the mentioned
Answer: _________
Question 40:

Choose the best answer. Prior to using a pointer variable

A. It should be declared.
B. It should be initialized.
C. It should be both declared and initialized.
D. None of these.
Answer: _________
Question 41:

The address operator & , cannot act on

A. R-values
B. Arithmetic expressions
C. Both of the above
D. Local variables
Answer: _________
Question 42:

The operator > and < are meaningful when used with pointers, if

A. The pointers point to data of similar type.
B. The pointers point to structure of similar data type.
C. The pointers point to elements of the same array.
D. None of these.
Answer: _________
Question 43:

What is the result of the expression &variable in C, where variable is a variable of type int?

A. Address of variable
B. Value of variable
C. Size of variable
D. Type of variable
Answer: _________
Question 44:

In C, what is a double pointer (int**)?

A. A pointer to an integer
B. A pointer that can store two addresses
C. A pointer to a pointer
D. A pointer to a double data type
Answer: _________
Question 45:

What is the result of the expression ptr = NULL in C, where ptr is a pointer?

A. Initialize ptr to 0
B. Delete the pointer ptr
C. Set ptr to a random address
D. It's not a valid operation
Answer: _________
Question 46:

In C, what is the purpose of the 'malloc' function?

A. Allocate memory on the stack
B. Allocate memory on the heap
C. Allocate memory for a function
D. Allocate memory for a variable
Answer: _________
Question 47:

What is the result of the expression *NULL in C?

A. Error
B. Null pointer dereference
C. 0
D. Undefined
Answer: _________
Question 48:

In C, what is the purpose of the 'memcpy' function?

A. Copy the contents of one pointer to another
B. Copy the contents of one memory location to another
C. Create a new pointer
D. Swap two pointers
Answer: _________
Question 49:

What is the result of the expression sizeof(char*) in C, assuming a char pointer on a typical system?

A. 4
B. 8
C. 2
D. 1
Answer: _________
Question 50:

In C, what is a pointer to a constant value (const int*)?

A. A pointer that cannot be modified
B. A pointer that points to a constant value
C. A constant pointer
D. A pointer to a constant value
Answer: _________
Question 51:

What type of array is generally generated in Command-line argument?

A. Single dimension array
B. 2-Dimensional Square Array
C. Jagged Array
D. 2-Dimensional Rectangular Array
Answer: _________
Question 52:

Which of the following is a correct syntax to pass a Function Pointer as an argument?

A. void pass(int (*fptr)(int, float, char)){}
B. void pass(*fptr(int, float, char)){}
C. void pass(int (*fptr)){}
D. void pass(*fptr){}
Answer: _________
Question 53:

Calling a function f with a an array variable a[3] where a is an array, is equivalent to . . . . . . . .

A. f(a[3])
B. f(*(a + 3))
C. f(3[a])
D. all of the mentioned
Answer: _________
Question 54:

In C, how do you declare an array of pointers to integers?

A. int* arr[]
B. arr int*[]
C. int arr*[]
D. int[]* arr
Answer: _________
Question 55:

What is the purpose of the 'free' function in C when used with pointers?

A. Allocate memory
B. Deallocate memory
C. Create a new pointer
D. Modify the pointer's value
Answer: _________
Question 56:

What will be the output of the following C code? #include <stdio.h>
int main()
{
char *str = "hello, world
"

str[5] = '.'

printf("%s
", str)

return 0

}

A. hello. world
B. hello, world
C. Compile error
D. Segmentation fault
Answer: _________
Question 57:

Is the below declaration legal? int* ((*x)())[2]

A. True
B. False
C. Undefined behaviour
D. Depends on the standard
Answer: _________
Question 58:

What will be the output of the following C code? #include <stdio.h>
void main()
{
int a[2][3] = {1, 2, 3, , 4, 5}

int i = 0, j = 0

for (i = 0

i < 2

i++)
for (j = 0

j < 3

j++)
printf("%d", a[i][j])

}

A. 1 2 3 junk 4 5
B. Compile time error
C. 1 2 3 0 4 5
D. 1 2 3 3 4 5
Answer: _________
Question 59:

What will be the output of the following C code (run without any command line arguments)? #include <stdio.h>
int main(int argc, char *argv[])
{
while (*argv++ != NULL)
printf("%s
", *argv)

return 0

}

A. Segmentation fault/code crash
B. Executable file name
C. Depends on the platform
D. Depends on the compiler
Answer: _________
Question 60:

What will be the output of the following C code? #include <stdio.h>
void main()
{
char s[] = "hello"

s++

printf("%c
", *s)

}

A. Compile time error
B. h
C. e
D. o
Answer: _________
Question 61:

What will be the output of the following C code? #include <stdio.h>
int main()
{
int i = 11

int *p = &i
foo(&p)

printf("%d ", *p)

}
void foo(int *const *p)
{
int j = 10

*p = &j
printf("%d ", **p)

}

A. Compile time error
B. 10 10
C. Undefined behaviour
D. 10 11
Answer: _________
Question 62:

What will be the output of the following C code? #include <stdio.h>
void main()
{
int k = 5

int *p = &k
int **m = &p
printf("%d%d%d
", k, *p, **p)

}

A. 5 5 5
B. 5 5 junk value
C. 5 junk junk
D. Compile time error
Answer: _________
Question 63:

What will be the output of the following C code? #include <stdio.h>
void main()
{
int x = 0

int *ptr = &5

printf("%p
", ptr)

}

A. 5
B. Address of 5
C. Nothing
D. Compile time error
Answer: _________
Question 64:

What will be the output of the following C code? #include <stdio.h>
int main()
{
char *str = "hello, world
"

char *strc = "good morning
"

strcpy(strc, str)

printf("%s
", strc)

return 0

}

A. hello, world
B. Crash/segmentation fault
C. Undefined behaviour
D. Run time error
Answer: _________
Question 65:

What will be the output of the following C code? #include <stdio.h>
void main()
{
char *s = "hello"

char *p = s

printf("%c %c", *p, s[1])

}

A. e h
B. Compile time error
C. h h
D. h e
Answer: _________
Question 66:

What is the correct way to declare and assign a function pointer? (Assuming the function to be assigned is "int multi(int, int)

")

A. int (*fn_ptr)(int, int) = multi
B. int *fn_ptr(int, int) = multi
C. int *fn_ptr(int, int) = &multi
D. none of the mentioned
Answer: _________
Question 67:

What will be the output of the following C code? #include <stdio.h>
struct student
{
int no = 5

char name[20]

}

void main()
{
struct student s

s.no = 8

printf("hello")

}

A. Nothing
B. Compile time error
C. hello
D. Varies
Answer: _________
Question 68:

What will be the output of the following C code? #include <stdio.h>
void f(int (*x)(int))

int myfoo(int i)

int (*foo)(int) = myfoo

int main()
{
f(foo(10))

}
void f(int (*i)(int))
{
i(11)

}
int myfoo(int i)
{
printf("%d
", i)

return i

}

A. Compile time error
B. Undefined behaviour
C. 10 11
D. 10 Segmentation fault
Answer: _________
Question 69:

What will be the output of the following C code? #include <stdio.h>
void fun(char *k)
{
printf("%s", k)

}
void main()
{
char s[] = "hello"

fun(s)

}

A. hello
B. Run time error
C. Nothing
D. h
Answer: _________
Question 70:

What will be the output of the following C code? #include <stdio.h>
int main()
{
int i = 0, j = 1

int *a[] = {&i, &j}

printf("%d", *a[0])

return 0

}

A. Compile time error
B. Undefined behaviour
C. 0
D. Some garbage value
Answer: _________
Question 71:

What will be the output of the following C code? #include <stdio.h>
int main()
{
int *ptr, a = 10

ptr = &a
*ptr += 1

printf("%d,%d/n", *ptr, a)

}

A. 10,10
B. 10,11
C. 11,10
D. 11,11
Answer: _________
Question 72:

What will be the output of the following C code? #include <stdio.h>
int *f()

int main()
{
int *p = f()

printf("%d
", *p)

}
int *f()
{
int *j = (int*)malloc(sizeof(int))

*j = 10

return j

}

A. 10
B. Compile time error
C. Segmentation fault/runtime crash since pointer to local variable is returned
D. Undefined behaviour
Answer: _________
Question 73:

Comment on the following two operations. int *a[] = {{1, 2, 3}, {1, 2, 3, 4}}

//- 1
int b[][] = {{1, 2, 3}, {1, 2, 3, 4}}

//- 2

A. 1 works, 2 doesn't
B. 2 works, 1 doesn't
C. Both of them work
D. Neither of them work
Answer: _________
Question 74:

What will be the output of the following C code? #include <stdio.h>
void main()
{
char *s = "hello"

char *p = s

printf("%c %c", *(p + 1), s[1])

}

A. h e
B. e l
C. h h
D. e e
Answer: _________
Question 75:

Which of the following does not initialize ptr to null (assuming variable declaration of a as int a=0

)?

A. int *ptr = &a
B. int *ptr = &a - &a
C. int *ptr = a - a
D. All of the mentioned
Answer: _________
Question 76:

What will be the output of the following C code? #include <stdio.h>
int main()
{
double *ptr = (double *)100

ptr = ptr + 2

printf("%u", ptr)

}

A. 102
B. 104
C. 108
D. 116
Answer: _________
Question 77:

What type of initialization is needed for the segment "ptr[3] = '3'

" to work?

A. char *ptr = "Hello!"
B. char ptr[] = "Hello!"
C. both char *ptr = "Hello!" and char ptr[] = "Hello!"
D. none of the mentioned
Answer: _________
Question 78:

What will be the output of the following C code? #include <stdio.h>
void main()
{
int k = 5

int *p = &k
int **m = &p
printf("%d%d%d
", k, *p, **m)

}

A. 5 5 5
B. 5 5 junk value
C. 5 junk junk
D. Run time error
Answer: _________
Question 79:

What will be the output of the following C code? #include <stdio.h>
void main()
{
struct student
{
int no

char name[20]

}

struct student s

s.no = 8

printf("%s", s.name)

}

A. Nothing
B. Compile time error
C. Junk
D. 8
Answer: _________
Question 80:

What will be the output of the following C code? #include <stdio.h>
int main()
{
int ary[4] = {1, 2, 3, 4}

int *p = ary + 3

printf("%d %d
", p[-2], ary[*p])

}

A. 2 3
B. Compile time error
C. 2 4
D. 2 somegarbagevalue
Answer: _________
Question 81:

What will be the output of the following C code? #include <stdio.h>
void m(int p, int q)
{
printf("%d %d
", p, q)

}
void main()
{
int a = 6, b = 5

m(a)

}

A. 6
B. 6 5
C. 6 junk value
D. Compile time error
Answer: _________
Question 82:

What will be the output of the following C code? #include <stdio.h>
void f(int (*x)(int))

int myfoo(int)

int (*fooptr)(int)

int ((*foo(int)))(int)

int main()
{
fooptr = foo(0)

fooptr(10)

}
int ((*foo(int i)))(int)
{
return myfoo

}
int myfoo(int i)
{
printf("%d
", i + 1)

}

A. 10
B. 11
C. Compile time error
D. Undefined behaviour
Answer: _________
Question 83:

In C, what is a pointer to a function that takes no arguments and returns an integer?

A. int (*ptr)()
B. ptr int()
C. int ptr()
D. ptr() int
Answer: _________
Question 84:

What will be the output of the following C code? #include <stdio.h>
int main()
{
int i = 10
void *p = &i
printf("%d
", (int)*p)
return 0
}

A. Compile time error
B. Segmentation fault/runtime crash
C. 10
D. Undefined behaviour
Answer: _________
Question 85:

What will be the output of the following C code? #include <stdio.h>
void main()
{
char *a[10] = {"hi", "hello", "how"}
int i = 0
for (i = 0
i < 10
i++)
printf("%s", *(a[i]))
}

A. segmentation fault
B. hi hello how followed by 7 null values
C. 10 null values
D. depends on compiler
Answer: _________
Question 86:

What will be the output of the following C code? #include <stdio.h>
int main()
{
const int ary[4] = {1, 2, 3, 4}
int *p
p = ary + 3
*p = 5
printf("%d
", ary[3])
}

A. 4
B. 5
C. Compile time error
D. 3
Answer: _________
Question 87:

What will be the output of the following C code? #include <stdio.h>
void foo( int[] )
int main()
{
int ary[4] = {1, 2, 3, 4}
foo(ary)
printf("%d ", ary[0])
}
void foo(int p[4])
{
int i = 10
p = &i
printf("%d ", p[0])
}

A. 10 10
B. Compile time error
C. 10 1
D. Undefined behaviour
Answer: _________
Question 88:

What will be the output of the following C code? #include <stdio.h>
void main()
{
int a[3] = {1, 2, 3}
int *p = a
printf("%p %p", p, a)
}

A. Same address is printed
B. Different address is printed
C. Compile time error
D. Nothing
Answer: _________
Question 89:

What will be the output of the following C code (run without any command line arguments)? #include <stdio.h>
int main(int argc, char *argv[])
{
while (*argv != NULL)
printf("%s
", *(argv++))
return 0
}

A. Segmentation fault/code crash
B. Executable file name
C. Depends on the platform
D. Depends on the compiler
Answer: _________
Question 90:

What will be the output of the following C code? #include <stdio.h>
void m(int *p)
{
int i = 0
for(i = 0
i < 5
i++)
printf("%d ", p[i])
}
void main()
{
int a[5] = {6, 5, 3}
m(&a)
}

A. 0 0 0 0 0
B. 6 5 3 0 0
C. Run time error
D. 6 5 3 junk junk
Answer: _________
Question 91:

What will be the output of the following C code (if run with no options or arguments)? #include <stdio.h>
int main(int argc, char *argv[])
{
printf("%d
", argc)
return 0
}

A. 0
B. 1
C. Depends on the platform
D. Depends on the compiler
Answer: _________
Question 92:

Comment on the following C statement. const int *ptr

A. You cannot change the value pointed by ptr
B. You cannot change the pointer ptr itself
C. You May or may not change the value pointed by ptr
D. You can change the pointer as well as the value pointed by it
Answer: _________
Question 93:

What will be the output of the following C code? #include <stdio.h>
void main()
{
char a[10][5] = {"hi", "hello", "fellows"}
printf("%p
", a)
printf("%p", a[0])
}

A. same address is printed
B. different address is printed
C. hello
D. hi hello fello
Answer: _________
Question 94:

What will be the output of the following C code on a 32-bit system? #include <stdio.h>
void main()
{
char *a[10] = {"hi", "hello", "how"}
printf("%d
", sizeof(a[1]))
}

A. 6
B. 4
C. 5
D. 3
Answer: _________
Question 95:

What will be the output of the following C code? #include <stdio.h>
void f(int a[2][])
{
a[0][1] = 3
int i = 0, j = 0
for (i = 0
i < 2
i++)
for (j = 0
j < 3
j++)
printf("%d", a[i][j])
}
void main()
{
int a[2][3] = {0}
f(a)
}

A. 0 3 0 0 0 0
B. Junk 3 junk junk junk junk
C. Compile time error
D. All junk values
Answer: _________
Question 96:

What will be the output of the following C code? #include <stdio.h>
int mul(int a, int b, int c)
{
return a * b * c
}
void main()
{
int *function_pointer
function_pointer = mul
printf("The product of three numbers is:%d",
function_pointer(2, 3, 4))
}

A. The product of three numbers is:24
B. Compile time error
C. Nothing
D. Varies
Answer: _________
Question 97:

What will be the output of the following C code? #include <stdio.h>
int main()
{
int ary[4] = {1, 2, 3, 4}
int *p = ary + 3
printf("%d
", p[-2])
}

A. 1
B. 2
C. Compile time error
D. Some garbage value
Answer: _________
Question 98:

What will be the output of the following C code? #include <stdio.h>
int x = 0
void main()
{
int *ptr = &x
printf("%p
", ptr)
x++
printf("%p
", ptr)
}

A. Same address
B. Different address
C. Compile time error
D. Varies
Answer: _________
Question 99:

What will be the output of the following C code? #include <stdio.h>
struct student
{
int no = 5
char name[20]
}
void main()
{
struct student s
s.no = 8
printf("hello")
}

A. Nothing
B. Compile time error
C. hello
D. Varies
Answer: _________
Question 100:

Which is true for a, if a is defined as "int a[10][20]
"?

A. a is true two-dimensional array
B. 200 int-sized locations have been set aside
C. The conventional rectangular subscript calculation 20 * row + col is used to find the element a[row, col].
D. All of the mentioned
Answer: _________
Question 101:

Which of the following expression is true for the following C statement? ptr is array with 3 elements of pointer to function returning pointer of int

A. int **ptr[3]()
B. int *(*ptr[3])()
C. int (*(*ptr[3])())
D. None of the mentioned
Answer: _________
Question 102:

What will be the output of the following C code? #include <stdio.h>
int main()
{
char a[2][6] = {"hello", "hi"}
printf("%d", sizeof(a))
return 0
}

A. 9
B. 12
C. 8
D. 10
Answer: _________
Question 103:

What will be the output of the following C code? #include <stdio.h>
int main()
{
int a[4] = {1, 2, 3, 4}
void *p = &a[1]
void *ptr = &a[2]
int n = 1
n = ptr - p
printf("%d
", n)
}

A. 1
B. 4
C. Compile time error
D. Depends on the compiler
Answer: _________
Question 104:

What will be the output of the following C code? #include <stdio.h>
void main()
{
int x = 0
int *ptr = &x
printf("%p
", ptr)
ptr++
printf("%p
", ptr)
}

A. 0xbfd605e8 0xbfd605ec
B. 0xbfd605e8 0cbfd60520
C. 0xbfd605e8 0xbfd605e9
D. Run time error
Answer: _________
Question 105:

What is the second argument in command line arguments?

A. The number of command-line arguments the program was invoked with
B. A pointer to an array of character strings that contain the arguments, one per string
C. Nothing
D. None of the mentioned
Answer: _________
Question 106:

Determine Output: void main()
{
char far *farther, *farthest
printf("%d..%d", sizeof(farther), sizeof(farthest))
}

A. 4..2
B. 2..2
C. 4..4
D. 2..4
Answer: _________
Question 107:

Determine Output: main()
{
char *str1 = "abcd"
char str2[] = "abcd"
printf("%d %d %d", sizeof(str1), sizeof(str2), sizeof("abcd"))
}

A. 2 5 5
B. 2 4 4
C. 8 5 5
D. 2 4 5
Answer: _________
Question 108:

Comment on the following pointer declaration? int * ptr, p

A. ptr is a pointer to integer, p is not.
B. ptr and p, both are pointers to integer.
C. ptr is pointer to integer, p may or may not be.
D. ptr and p both are not pointers to integer.
Answer: _________
Question 109:

What will be the output? main()
{
char *p
p = "Hello"
printf("%cn",*&*p)
}

A. Hello
B. H
C. Some address will be printed
D. None of these.
Answer: _________
Question 110:

Determine output: #include <stdio.h>
void main()
{
char *p = NULL
char *q = 0
if(p)
printf(" p ")
else
printf("nullp")
if(q)
printf("q")
else
printf(" nullq")
}

A. p q
B. Depends on the compiler
C. x nullq where x can be p or nullp depending on the value of NULL
D. nullp nullq
Answer: _________
Question 111:

The statement int ** a

A. is illegal
B. is legal but meaningless
C. is syntactically and semantically correct
D. None of these.
Answer: _________
Question 112:

What will be the output of the following program? #include<stdio.h>
void main()
{
int i = 10
void *p = &i
printf("%d
", (int)*p)
}

A. Compiler time error
B. Segmentation fault/runtime crash
C. 10
D. Undefined behavior
Answer: _________
Question 113:

What will be the output of the following program code? #include<stdio.h>
void main()
{
int i = 10
void *p = &i
printf("%f", *(float *)p)
}

A. Error
B. 10
C. 0.000000
D. None of these.
Answer: _________
Question 114:

The declaration int (* p ) [ 5 ]
means

A. p is one dimensional array of size 5, of pointers to integers.
B. p is a pointer to a 5 elements integer array.
C. The same as (*p) [5]
D. None of these.
Answer: _________
Question 115:

Comment on the following? const int * ptr

A. We cannot change the value pointed by ptr .
B. We cannot change the pointer ptr itself.
C. Both of the above
D. We can change the pointer as well as the value pointed by it.
Answer: _________
Question 116:

Determine Output: #include<stdio.h>
void main()
{
int *ptr, a=10
ptr = &a
*ptr += 1
printf("%d, %d", *ptr, a)
}

A. 10, 10
B. 10, 11
C. 11, 10
D. 11, 11
Answer: _________
Question 117:

A function 'p' that accepts a pointer to a character as argument and returns a pointer to an array of integer can be declared as

A. int(*p(char *))[]
B. int *p(char *)[]
C. int (*p) (char *)[]
D. None of these.
Answer: _________
Question 118:

What will be printed after compiling and running the following code? main()
{
char *p
printf("%d %d",sizeof(*p), sizeof(p))
}

A. 1 1
B. 1 2
C. 2 1
D. 2 2
Answer: _________
Question 119:

What will be the output of the following program code? #include <stdio.h>
void main()
{
int i=3, *j, **k
j = &i
k = &j
printf("%d%d%d", *j, **k, *(*k))
}

A. 444
B. 000
C. 333
D. 433
Answer: _________
Question 120:

Which of the following is the correct way of declaring a float pointer:

A. float ptr
B. float * ptr
C. * float ptr
D. None of the above
Answer: _________
Question 121:

Find the output of the following program. void main()
{
char *msg = "hi"
printf(msg)
}

A. hi
B. h
C. hi followed by garbage value
D. Error
Answer: _________
Question 122:

Find the output of the following program. void main()
{
int array[10]
int *i = &array[2], *j = &array[5]
int diff = j-i
printf("%d", diff)
}

A. 3
B. 6
C. Garbage value
D. Error
Answer: _________
Question 123:

What makes the following declaration denote? int **ptr

A. ptr is a function pointer that returns pointer to int type
B. ptr is a pointer to an int pointer
C. ptr is a pointer to pointer to type int
D. none of the mentioned
Answer: _________
Question 124:

What will be the output of the following C code? #include <stdio.h>
int main()
{
foo(ary)
}
void foo(int **ary)
{
int i = 10, k = 20, j = 30
int *ary[2]
ary[0] = &i
ary[1] = &j
printf("%d
", ary[0][1])
}

A. 10
B. 20
C. Compile time error
D. Undefined behaviour
Answer: _________
Question 125:

What will be the output of the following C code? #include <stdio.h>
int main()
{
char str[] = "hello, world"
str[5] = '.'
printf("%s
", str)
return 0
}

A. hello. world
B. hello, world
C. Compile error
D. Segmentation fault
Answer: _________
Question 126:

What will be the output of the following C code? #include <stdio.h>
int main()
{
int i = 10
int *const p = &i
foo(&p)
printf("%d
", *p)
}
void foo(int **p)
{
int j = 11
*p = &j
printf("%d
", **p)
}

A. 11 11
B. Undefined behaviour
C. Compile time error
D. Segmentation fault/code-crash
Answer: _________
Question 127:

Which of the following arithmetic operation can be applied to pointers a and b? (Assuming initialization as int *a = (int *)2
int *b = (int *)3
)

A. a + b
B. a - b
C. a * b
D. a / b
Answer: _________
Question 128:

What will be the output of the following C code? #include <stdio.h>
void main()
{
char a[10][5] = {"hi", "hello", "fellows"}
printf("%d", sizeof(a[1]))
}

A. 2
B. 4
C. 5
D. 10
Answer: _________
Question 129:

Comment on the following two operations. int *a[] = {{1, 2, 3}, {1, 2, 3, 4}}
//- 1
int b[4][4] = {{1, 2, 3}, {1, 2, 3, 4}}
//- 2

A. 1 will work, 2 will not
B. 1 and 2, both will work
C. 1 won't work, 2 will work
D. Neither of them will work
Answer: _________
Question 130:

Which function is not called in the following C program? #include <stdio.h>
void first()
{
printf("first")
}
void second()
{
first()
}
void third()
{
second()
}
void main()
{
void (*ptr)()
ptr = third
ptr()
}

A. Function first
B. Function second
C. Function third
D. None of the mentioned
Answer: _________
Question 131:

Which of the following syntax is correct for command-line arguments?

A. int main(int var, char *varg[])
B. int main(char *argv[], int argc)
C. int main(){int argv, char *argc[] }
D. none of the mentioned
Answer: _________
Question 132:

What will be the output of the following C code? #include <stdio.h>
void f(char *k)
{
k++
k[2] = 'm'
printf("%c
", *k)
}
void main()
{
char s[] = "hello"
f(s)
}

A. l
B. e
C. h
D. o
Answer: _________
Question 133:

What will be the output of the following C code? #include <stdio.h>
void f(int)
void (*foo)(float) = f
int main()
{
foo(10)
}
void f(int i)
{
printf("%d
", i)
}

A. Compile time error
B. 10
C. 10.000000
D. Undefined behaviour
Answer: _________
Question 134:

Which of the following is the correct syntax to declare a 3 dimensional array using pointers?

A. char *a[][]
B. char **a[]
C. char ***a
D. all of the mentioned
Answer: _________
Question 135:

What will be the output of the following C code? #include <stdio.h>
void main()
{
char *s = "hello"
char *n = "cjn"
char *p = s + n
printf("%c %c", *p, s[1])
}

A. h e
B. Compile time error
C. c o
D. h n
Answer: _________
Question 136:

What will be the output of the following C code? #include <stdio.h>
int mul(int a, int b, int c)
{
return a * b * c
}
void main()
{
int (*function_pointer)(int, int, int)
function_pointer = mul
printf("The product of three numbers is:%d",
function_pointer(2, 3, 4))
}

A. The product of three numbers is:24
B. Run time error
C. Nothing
D. Varies
Answer: _________
Question 137:

Comment on the output of the following C code. #include <stdio.h>
int main()
{
char *str = "This" //Line 1
char *ptr = "Program
"
//Line 2
str = ptr
//Line 3
printf("%s, %s
", str, ptr)
//Line 4
}

A. Memory holding "this" is cleared at line 3
B. Memory holding "this" loses its reference at line 3
C. You cannot assign pointer like in Line 3
D. Output will be This, Program
Answer: _________
Question 138:

What will be the output of the following C code? #include <stdio.h>
int main()
{
char *a = {"p", "r", "o", "g", "r", "a", "m"}
printf("%s", a)
}

A. Output will be program
B. Output will be p
C. No output
D. Compile-time error
Answer: _________
Question 139:

What will be the output of the following C code (run without any command line arguments)? #include <stdio.h>
int main(int argc, char *argv[])
{
while (argv != NULL)
printf("%s
", *(argv++))
return 0
}

A. Segmentation fault/code crash
B. Executable file name
C. Depends on the platform
D. Depends on the compiler
Answer: _________
Question 140:

Read the following expression? void (*ptr)(int)

A. ptr is pointer to int that converts its type to void
B. ptr is pointer to function passing int returning void
C. ptr is pointer to void that converts its type to int
D. ptr is pointer to function passing void returning int
Answer: _________
Question 141:

What will be the output of the following C code? #include <stdio.h>
void main()
{
int a[3] = {1, 2, 3}
int *p = a
int **r = &p
printf("%p %p", *r, a)
}

A. Different address is printed
B. 1 2
C. Same address is printed
D. 1 1
E. Different address is printed
F. 1 2
G. Same address is printed
H. 1 1
Answer: _________
Question 142:

What is the first argument in command line arguments?

A. The number of command-line arguments the program was invoked with
B. A pointer to an array of character strings that contain the arguments
C. Nothing
D. None of the mentioned
Answer: _________
Question 143:

What will be the output of the following C code? #include <stdio.h>
int main()
{
int i = 0, j = 1
int *a[] = {&i, &j}
printf("%d", (*a)[1])
return 0
}

A. Compile time error
B. Undefined behaviour
C. 1
D. Some garbage value
Answer: _________
Question 144:

Which of the following is the correct syntax to send an array as a parameter to function?

A. func(&array)
B. func(#array)
C. func(*array)
D. func(array[size])
Answer: _________
Question 145:

Which is true for b, if b is defined as "int *b[10]
"?

A. The definition only allocates 10 pointers and does not initialize them
B. Initialization must be done explicitly
C. The definition only allocates 10 pointers and does not initialize them & Initialization must be done explicitly
D. Error
Answer: _________
Question 146:

Comment on the output of the following C code. #include <stdio.h>
int main()
{
int a = 10
int **c -= &&a
}

A. You cannot apply any arithmetic operand to a pointer
B. We don't have address of an address operator
C. We have address of an address operator
D. None of the mentioned
Answer: _________
Question 147:

What will be the output of the following C code? #include <stdio.h>
int main()
{
int ary[2][3]
ary[][] = {{1, 2, 3}, {4, 5, 6}}
printf("%d
", ary[1][0])
}

A. Compile time error
B. 4
C. 1
D. 2
Answer: _________
Question 148:

What makes the following declaration denote? char *str[5]

A. str is an array of 5 element pointer to type char
B. str is a pointer to an array of 5 elements
C. str is a function pointer of 5 elements returning char
D. none of the mentioned
Answer: _________
Question 149:

What will be the output of the following C code? #include <stdio.h>
void foo(int *ary[])
int main()
{
int ary[2][3]
foo(ary)
}
void foo(int *ary[])
{
int i = 10, j = 2, k
ary[0] = &i
ary[1] = &j
*ary[0] = 2
for (k = 0
k < 2
k++)
printf("%d
", *ary[k])
}

A. 2 2
B. Compile time error
C. Undefined behaviour
D. 10 2
Answer: _________
Question 150:

What will be the output of the following C code? #include <stdio.h>
void main()
{
int a[3] = {1, 2, 3}
int *p = a
int *r = &p
printf("%d", (**r))
}

A. 1
B. Compile time error
C. Address of a
D. Junk value
E. 1
F. Compile time error
G. Address of a
H. Junk value
Answer: _________
Question 151:

What will be the output of the following C code? #include <stdio.h>
struct student
{
int no
char name[20]
}
void main()
{
struct student s
s.no = 8
printf("hello")
}

A. Run time error
B. Nothing
C. hello
D. Varies
E. Compile time error
F. Nothing
G. hello
H. Varies
Answer: _________
Question 152:

Which of the following declaration is illegal?

A. int a = 0, b = 1, c = 2 int array[3] = {a, b, c}
B. int size = 3 int array[size]
C. int size = 3 int array[size] = {1, 2, 3}
D. All of the mentioned
Answer: _________
Question 153:

What will be the output of the following C code? #include <stdio.h>
int mul(int a, int b, int c)
{
return a * b * c
}
void main()
{
int (function_pointer)(int, int, int)
function_pointer = mul
printf("The product of three numbers is:%d",
function_pointer(2, 3, 4))
}

A. The product of three numbers is:24
B. Compile time error
C. Nothing
D. Varies
Answer: _________
Question 154:

What will be the output of the following C code? #include <stdio.h>
void main()
{
int x = 0
int *ptr = &x
printf("%d
", *ptr)
}

A. Address of x
B. Junk value
C. 0
D. Run time error
Answer: _________
Question 155:

What will be the output of the following C code? #include <stdio.h>
int main()
{
int ary[4] = {1, 2, 3, 4}
int p[4]
p = ary
printf("%d
", p[1])
}

A. 1
B. Compile time error
C. Undefined behaviour
D. 2
Answer: _________
Question 156:

What will be the output of the following C code? #include <stdio.h>
int main()
{
int *((*x)())[2]
x()
printf("after x
")
}
int *((*x)())[2]
{
int **str
str = (int*)malloc(sizeof(int)* 2)
return str
}

A. Compile time error
B. Undefined behaviour
C. After x
D. None of the mentioned
Answer: _________
Question 157:

What will be the output of the following C code? #include <stdio.h>
void main()
{
int k = 5
int *p = &k
int **m = &p
**m = 6
printf("%d
", k)
}

A. 5
B. Run time error
C. 6
D. Junk
E. 5
F. Compile time error
G. 6
H. Junk
Answer: _________
Question 158:

What will be the output of the following C code? #include <stdio.h>
int *f()
int main()
{
int *p = f()
printf("%d
", *p)
}
int *f()
{
int j = 10
return &j
}

A. 10
B. Compile time error
C. Segmentation fault/runtime crash
D. Undefined behaviour
Answer: _________
Question 159:

What will be the output of the following C code? #include <stdio.h>
struct student
{
int no
char name[20]
}
void main()
{
student s
s.name = "hello"
printf("hello")
}

A. Nothing
B. hello
C. Compile time error
D. Varies
Answer: _________
Question 160:

Which of the following are generated from char pointer?

A. char *string = "Hello."
B. char *string scanf("%s", string)
C. char string[] = "Hello."
D. char *string = "Hello." and char string[] = "Hello."
Answer: _________
Question 161:

Which of the following declaration will result in run-time error?

A. int **c = &c
B. int **c = &*c
C. int **c = **c
D. none of the mentioned
Answer: _________
Question 162:

What will be the output of the following C code? #include <stdio.h>
int main()
{
char *a[2] = {"hello", "hi"}
printf("%s", *(a + 1))
return 0
}

A. hello
B. ello
C. hi
D. ello hi
Answer: _________
Question 163:

What will be the output of the following C code? #include <stdio.h>
int main()
{
char *p = NULL
char *q = 0
if (p)
printf(" p ")
else
printf("nullp")
if (q)
printf("q
")
else
printf(" nullq
")
}

A. nullp nullq
B. Depends on the compiler
C. x nullq where x can be p or nullp depending on the value of NULL
D. p q
Answer: _________
Question 164:

What will be the output of the following C code? #include <stdio.h>
int main()
{
int i = 97, *p = &i
foo(&i)
printf("%d ", *p)
}
void foo(int *p)
{
int j = 2
p = &j
printf("%d ", *p)
}

A. 2 97
B. 2 2
C. Compile time error
D. Segmentation fault/code crash
Answer: _________
Question 165:

What will be the output of the following C code? #include <stdio.h>
int main()
{
int ary[2][3][4], j = 20
ary[0][0] = &j
printf("%d
", *ary[0][0])
}

A. Compile time error
B. 20
C. Address of j
D. Undefined behaviour
Answer: _________
Question 166:

What will be the output of the following C code? #include <stdio.h>
void m(int *p, int *q)
{
int temp = *p
*p = *q
*q = temp
}
void main()
{
int a = 6, b = 5
m(&a, &b)
printf("%d %d
", a, b)
}

A. 5 6
B. 6 5
C. 5 5
D. 6 6
Answer: _________
Question 167:

What will be the output of the following C code? #include <stdio.h>
int main()
{
int i = 97, *p = &i
foo(&p)
printf("%d ", *p)
return 0
}
void foo(int **p)
{
int j = 2
*p = &j
printf("%d ", **p)
}

A. 2 2
B. 2 97
C. Undefined behaviour
D. Segmentation fault/code crash
Answer: _________
Question 168:

What will be the output of the following C code? #include <stdio.h>
int main()
{
void *p
int a[4] = {1, 2, 3, 8}
p = &a[3]
int *ptr = &a[2]
int n = p - ptr
printf("%d
", n)
}

A. 1
B. Compile time error
C. Segmentation fault
D. 4
Answer: _________
Question 169:

What will be the output of the following C code? #include <stdio.h>
void main()
{
char *s= "hello"
char *p = s
printf("%c %c", 1[p], s[1])
}

A. h h
B. Run time error
C. l l
D. e e
Answer: _________
Question 170:

What will be the output of the following C code? #include <stdio.h>
void main()
{
int a[2][3] = {1, 2, 3, 4, 5}
int i = 0, j = 0
for (i = 0
i < 2
i++)
for (j = 0
j < 3
j++)
printf("%d", a[i][j])
}

A. 1 2 3 4 5 0
B. 1 2 3 4 5 junk
C. 1 2 3 4 5 5
D. Run time error
Answer: _________
Question 171:

What will be the output of the following C statement? (assuming the input is "cool brother in city") printf(“%s
”, argv[argc])

A. (null)
B. City
C. In
D. Segmentation Fault
Answer: _________
Question 172:

What will be the output of the following C code? #include <stdio.h>
int main()
{
char a[2][6] = {"hello", "hi"}
printf("%s", *a + 1)
return 0
}

A. hello
B. hi
C. ello
D. ello hi
Answer: _________
Question 173:

What will be the output of the following C code? #include <stdio.h>
int main()
{
char *str = "hello world"
char strc[] = "good morning india
"
strcpy(strc, str)
printf("%s
", strc)
return 0
}

A. hello world
B. hello worldg india
C. Compile time error
D. Undefined behaviour
Answer: _________
Question 174:

What will be the output of the following C code? #include <stdio.h>
void m(int p)
{
printf("%d
", p)
}
void main()
{
int a = 6, b = 5
m(a, b)
printf("%d %d
", a, b)
}

A. 6
B. 6 5
C. 6 junk value
D. Compile time error
Answer: _________
Question 175:

What will be the output of the following C code on a 32-bit system? #include <stdio.h>
void main()
{
char *a[10] = {"hi", "hello", "how"}
printf("%d
", sizeof(a))
}

A. 10
B. 13
C. Run time error
D. 40
Answer: _________
Question 176:

What will be the output of the following C code? #include <stdio.h>
int sub(int a, int b, int c)
{
return a - b - c
}
void main()
{
int (*function_pointer)(int, int, int)
function_pointer = ⊂
printf("The difference of three numbers is:%d",
(*function_pointer)(2, 3, 4))
}

A. The difference of three numbers is:1
B. Run time error
C. The difference of three numbers is:-5
D. Varies
Answer: _________
Question 177:

Find the output of the following program. void main()
{
printf("%d, %d", sizeof(int *), sizeof(int **))
}

A. 2, 0
B. 0, 2
C. 2, 2
D. 2, 4
Answer: _________
Question 178:

Find the output of the following program. void main()
{
int i=10
/* assume address of i is 0x1234ABCD */
int *ip=&i
int **ipp=&&i
printf("%x,%x,%x", &i, ip, *ipp)
}

A. 0x1234ABCD, 0x1234ABCD, 10
B. 0x1234ABCD, 0x1234ABCD, 0x1234ABCD
C. 0x1234ABCD, 10, 10
D. Syntax error
Answer: _________
Question 179:

Which of the following statements are true after execution of the program. void main()
{
int a[10], i, *p
a[0] = 1
a[1] = 2
p = a
(*p)++
}

A. a[1] = 3
B. a[0] = 2
C. a[1] = 1
D. a[0] = 3
Answer: _________
Question 180:

What would be the output for the following Turbo C code? #include<stdio.h>
void main()
{
int a[]={ 1, 2, 3, 4, 5 }, *p
p=a
++*p
printf("%d ", *p)
p += 2
printf("%d", *p)
}

A. 2 4
B. 3 4
C. 2 2
D. 2 3
Answer: _________
Question 181:

char* myfunc(char *ptr)
{
ptr+=3
return(ptr)
}
void main()
{
char *x, *y
x = "EXAMVEDA"
y = myfunc(x)
printf("y=%s", y)
} What will be printed when the sample code above is executed?

A. y=EXAMVEDA
B. y=AMVEDA
C. y=MVEDA
D. y=VEDA
Answer: _________
Question 182:

char *ptr
char myString[] = "abcdefg"
ptr = myString
ptr += 5
what string does ptr point to in the sample code above?

A. fg
B. efg
C. defg
D. cdefg
Answer: _________
Question 183:

What will be the output of the following C code? #include <stdio.h>
int main()
{
int i = 10
int *p = &i
foo(&p)
printf("%d ", *p)
printf("%d ", *p)
}
void foo(int **const p)
{
int j = 11
*p = &j
printf("%d ", **p)
}

A. 11 11 11
B. 11 11 Undefined-value
C. Compile time error
D. Segmentation fault/code-crash
Answer: _________
Question 184:

What will be the output of the following C code? #include <stdio.h>
void main()
{
char *s= "hello"
char *p = s
printf("%c %c", *(p + 3), s[1])
}

A. h e
B. l l
C. l o
D. l e
Answer: _________
Question 185:

What will be the output of the following C code? #include <stdio.h>
void main()
{
char *s = "hello"
char *p = s * 3
printf("%c %c", *p, s[1])
}

A. h e
B. l e
C. Compile time error
D. l h
Answer: _________
Question 186:

Which of the following operation is possible using a pointer char? (Assuming the declaration is char *a
)

A. Input via %s
B. Generation of the multidimensional array
C. Changing address to point at another location
D. All of the mentioned
Answer: _________
Question 187:

Comment on the following C statement. int (*a)[7]

A. An array "a" of pointers
B. A pointer "a" to an array
C. A ragged array
D. None of the mentioned
Answer: _________
Question 188:

What will be the output of the following C code? #include <stdio.h>
int main()
{
int *p = (int *)2
int *q = (int *)3
printf("%d", p + q)
}

A. 2
B. 3
C. 5
D. Compile time error
Answer: _________
Question 189:

What will be the output of the following C code? #include <stdio.h>
void main()
{
char *s= "hello"
char *p = s
printf("%c %c", p[0], s[1])
}

A. Run time error
B. h h
C. h e
D. h l
Answer: _________
Question 190:

What will be the output of the following C code (run without any command line arguments)? #include <stdio.h>
int main(int argc, char *argv[])
{
while (argc--)
printf("%s
", argv[argc])
return 0
}

A. Compile time error
B. Executablefilename
C. Segmentation fault
D. Undefined
Answer: _________
Question 191:

What will be the output of the following C code? #include <stdio.h>
int main()
{
int a[4] = {1, 2, 3, 4}
int *p = &a[1]
int *ptr = &a[2]
ptr = ptr * 1
printf("%d
", *ptr)
}

A. 2
B. 1
C. Compile time error
D. Undefined behaviour
Answer: _________
Question 192:

What will be the output of the following C code? #include <stdio.h>
void f(char *k)
{
k++
k[2] = 'm'
}
void main()
{
char s[] = "hello"
f(s)
printf("%c
", *s)
}

A. h
B. e
C. m
D. o
Answer: _________
Question 193:

What will be the output of the following C code? #include <stdio.h>
void first()
{
printf("Hello World")
}
void main()
{
void *ptr() = first
ptr++
ptr()
}

A. Illegal application of ++ to void data type
B. pointer function initialized like a variable
C. Illegal application of ++ to void data type & pointer function initialized like a variable
D. None of the mentioned
Answer: _________
Question 194:

An array of strings can be initialized by . . . . . . . .

A. char *a[] = {"Hello", "World"}
B. char *a[] = {"Hello", "Worlds"}
C. char *b = "Hello" char *c = "World" char *a[] = {b, c}
D. all of the mentioned
Answer: _________
Question 195:

What will be the output of the following C code? #include <stdio.h>
int main()
{
char a[1][5] = {"hello"}
printf("%s", a[0])
return 0
}

A. Compile time error
B. hello
C. Undefined behaviour
D. hellon
Answer: _________
Question 196:

What will be the output of the following C code? #include <stdio.h>
void main()
{
char *s = "hello"
char *p = s
printf("%p %p", p, s)
}

A. Different address is printed
B. Same address is printed
C. Run time error
D. Nothing
Answer: _________
Question 197:

What will be the output of the following C code? #include <stdio.h>
int main()
{
char *str = "hello world"
char strary[] = "hello world"
printf("%d %d
", strlen(str), strlen(strary))
return 0
}

A. 11 11
B. 12 11
C. 11 12
D. x 11 where x can be any positive integer.
Answer: _________
Question 198:

What will be the output of the following C code? #include <stdio.h>
int main()
{
char *str = "hello, world!!
"
char strc[] = "good morning
"
strcpy(strc, str)
printf("%s
", strc)
return 0
}

A. hello, world!!
B. Compile time error
C. Undefined behaviour
D. Segmenation fault
Answer: _________
Question 199:

What will be the output of the following C code? #include <stdio.h>
int main()
{
void *p
int a[4] = {1, 2, 3, 4}
p = &a[3]
int *ptr = &a[2]
int n = (int*)p - ptr
printf("%d
", n)
}

A. 1
B. Compile time error
C. Segmentation fault
D. 4
Answer: _________
Question 200:

What is the correct syntax to send a 3-dimensional array as a parameter? (Assuming declaration int a[5][4][3]
)

A. func(a)
B. func(&a)
C. func(*a)
D. func(**a)
Answer: _________
Question 201:

What will be the output of the following C code? #include <stdio.h>
void f(int a[][])
{
a[0][1] = 3
int i = 0, j = 0
for (i = 0
i < 2
i++)
for (j = 0
j < 3
j++)
printf("%d", a[i][j])
}
void main()
{
int a[2][3] = {0}
f(a)
}

A. 0 3 0 0 0 0
B. Junk 3 junk junk junk junk
C. Compile time error
D. All junk values
Answer: _________
Question 202:

Which of following logical operation can be applied to pointers? (Assuming initialization int *a = 2
int *b = 3
)

A. a | b
B. a ^ b
C. a & b
D. None of the mentioned
Answer: _________
Question 203:

What will be the output of the following C code? #include <stdio.h>
void main()
{
int k = 5
int *p = &k
int **m = &p
printf("%d%d%d
", k, *p, **m)
}

A. 5 5 5
B. 5 5 junk value
C. 5 junk junk
D. Compile time error
Answer: _________
Question 204:

What are the different ways to initialize an array with all elements as zero?

A. int array[5] = {}
B. int array[5] = {0}
C. int a = 0, b = 0, c = 0 int array[5] = {a, b, c}
D. All of the mentioned
Answer: _________
Question 205:

What will be the output of the following C code? #include <stdio.h>
int main()
{
int a[4] = {1, 2, 3, 4}
int *ptr = &a[2]
float n = 1
ptr = ptr + n
printf("%d
", *ptr)
}

A. 4
B. 3
C. Compile time error
D. Undefined behaviour
Answer: _________
Question 206:

What is the size of *ptr in a 32-bit machine (Assuming initialization as int *ptr = 10
)?

A. 1
B. 2
C. 4
D. 8
Answer: _________
Question 207:

What will be the output of the following C code? #include <stdio.h>
void f(int (*x)(int))
int myfoo(int)
int (*foo)() = myfoo
int main()
{
f(foo)
}
void f(int(*i)(int ))
{
i(11)
}
int myfoo(int i)
{
printf("%d
", i)
return i
}

A. 10 11
B. 11
C. 10
D. Undefined behaviour
Answer: _________
Question 208:

Comment on the following 2 arrays with respect to P and Q. int *a1[8]
int *(a2[8])
P. Array of pointers
Q. Pointer to an array

A. a1 is P, a2 is Q
B. a1 is P, a2 is P
C. a1 is Q, a2 is P
D. a1 is Q, a2 is Q
Answer: _________
Question 209:

What will be the output of the following C code? #include <stdio.h>
int main()
{
int i = 10
void *p = &i
printf("%f
", *(float*)p)
return 0
}

A. Compile time error
B. Undefined behaviour
C. 10
D. 0.000000
Answer: _________
Question 210:

What will be the output of the following C code? #include <stdio.h>
void main()
{
struct student
{
int no
char name[20]
}
struct student s
no = 8
printf("%d", no)
}

A. Nothing
B. Compile time error
C. Junk
D. 8
Answer: _________
Question 211:

What will be the output of the following C code? #include <stdio.h>
void main()
{
char *a[10] = {"hi", "hello", "how"}
int i = 0
for (i = 0
i < 10
i++)
printf("%s", a[i])
}

A. hi hello how Segmentation fault
B. hi hello how null
C. hey hello how Segmentation fault
D. hi hello how followed by 7 nulls
Answer: _________
Question 212:

What will be the output of the following C code? #include <stdio.h>
void main()
{
char *s= "hello"
char *p = s + 2
printf("%c %c", *p, s[1])
}

A. l e
B. h e
C. l l
D. h l
Answer: _________
Question 213:

What will be the output of the following C code? #include <stdio.h>
void main()
{
int k = 5
int *p = &k
int **m = &p
printf("%d%d%d
", k, *p, **p)
}

A. 5 5 5
B. 5 5 junk value
C. 5 junk junk
D. Compile time error
Answer: _________
Question 214:

What will be the output of the following C code? #include <stdio.h>
void foo(int (*ary)[3])
int main()
{
int ary[2][3]
foo(ary)
}
void foo(int (*ary)[3])
{
int i = 10, j = 2, k
ary[0] = &i
ary[1] = &j
for (k = 0
k < 2
k++)
printf("%d
", *ary[k])
}

A. Compile time error
B. 10 2
C. Undefined behaviour
D. segmentation fault/code crash
Answer: _________
Question 215:

What will be the output of the following C code? #include <stdio.h>
int main()
{
char *a[1] = {"hello"}
printf("%s", a[0])
return 0
}

A. Compile time error
B. hello
C. Undefined behaviour
D. hellon
Answer: _________
Question 216:

What does this declaration say? int (*(*y)())[2]

A. y is pointer to the function which returns pointer to integer array
B. y is pointer to the function which returns array of pointers
C. y is function which returns function pointer which in turn returns pointer to integer array
D. y is function which returns array of integers
Answer: _________
Question 217:

What will be the output of the following C code? #include <stdio.h>
int x = 0
void main()
{
int *const ptr = &x
printf("%p
", ptr)
ptr++
printf("%p
", ptr)
}

A. 0 1
B. Compile time error
C. 0xbfd605e8 0xbfd605ec
D. 0xbfd605e8 0xbfd605e8
Answer: _________
Question 218:

Comment on the following declaration. int (*ptr)()
// i)
char *ptr[]
// ii)

A. Both i) and ii) and cannot exist due to same name
B. i) is legal, ii) is illegal
C. i) is illegal, ii) is legal
D. Both i) and ii) will work legal and flawlessly
Answer: _________
Question 219:

What will be the output of the following C code (run without any command line arguments)? #include <stdio.h>
int main(int argc, char *argv[])
{
printf("%s
", argv[argc])
return 0
}

A. Segmentation fault/code crash
B. Executable file name
C. Depends on the platform
D. Depends on the compiler
Answer: _________
Question 220:

What will be the output of the following C code? #include <stdio.h>
void f(int)
void (*foo)(void) = f
int main(int argc, char *argv[])
{
foo(10)
return 0
}
void f(int i)
{
printf("%d
", i)
}

A. Compile time error
B. 10
C. Undefined behaviour
D. None of the mentioned
Answer: _________
Question 221:

What will be the output of the following C code? #include <stdio.h>
void m(int p, int q)
{
int temp = p
p = q
q = temp
}
void main()
{
int a = 6, b = 5
m(a, b)
printf("%d %d
", a, b)
}

A. 5 6
B. 5 5
C. 6 5
D. 6 6
Answer: _________
Question 222:

Comment on the following pointer declaration. int *ptr, p

A. ptr is a pointer to integer, p is not
B. ptr and p, both are pointers to integer
C. ptr is a pointer to integer, p may or may not be
D. ptr and p both are not pointers to integer
Answer: _________
Question 223:

What will be the output of the following C code? #include <stdio.h>
void f(int)
void (*foo)() = f
int main(int argc, char *argv[])
{
foo(10)
return 0
}
void f(int i)
{
printf("%d
", i)
}

A. Compile time error
B. 10
C. Undefined behaviour
D. None of the mentioned
Answer: _________
Question 224:

What will be the output of the following C code? #include <stdio.h>
void foo(int*)
int main()
{
int i = 10, *p = &i
foo(p++)
}
void foo(int *p)
{
printf("%d
", *p)
}

A. 10
B. Some garbage value
C. Compile time error
D. Segmentation fault
Answer: _________
Question 225:

What will be the output of the following C code? #include <stdio.h>
void (*(f)())(int, float)
typedef void (*(*x)())(int, float)
void foo(int i, float f)
int main()
{
x p = f
p()
}
void (*(f)())(int, float)
{
return foo
}
void foo(int i, float f)
{
printf("%d %f
", i, f)
}

A. Compile time error
B. Undefined behaviour
C. 1 2.000000
D. Nothing
Answer: _________
Question 226:

What will be the output of the following C code? #include <stdio.h>
void main()
{
struct student
{
int no
char name[20]
}
struct student s
s.no = 8
printf("%d", s.no)
}

A. Nothing
B. Compile time error
C. Junk
D. 8
Answer: _________
Question 227:

What are the elements present in the array of the following C code? int array[5] = {5}

A. 5, 5, 5, 5, 5
B. 5, 0, 0, 0, 0
C. 5, (garbage), (garbage), (garbage), (garbage)
D. (garbage), (garbage), (garbage), (garbage), 5
Answer: _________
Question 228:

What will be the output of the following C code? #include <stdio.h>
struct student
{
int no
char name[20]
}
void main()
{
student s
s.no = 8
printf("hello")
}

A. Nothing
B. hello
C. Compile time error
D. Varies
Answer: _________
Question 229:

What will be the output of the following C code? #include <stdio.h>
void foo(float *)
int main()
{
int i = 10, *p = &i
foo(&i)
}
void foo(float *p)
{
printf("%f
", *p)
}

A. 10.000000
B. 0.000000
C. Compile time error
D. Undefined behaviour
Answer: _________
Question 230:

What will be the output of the following C code? #include <stdio.h>
void main()
{
char *a[10] = {"hi", "hello", "how"}
int i = 0, j = 0
a[0] = "hey"
for (i = 0
i < 10
i++)
printf("%s
", a[i])
}

A. hi hello how Segmentation fault
B. hi hello how followed by 7 null values
C. hey hello how Segmentation fault
D. depends on compiler
Answer: _________
Question 231:

What will be the output of the following C code? #include <stdio.h>
int main()
{
char **p = {"hello", "hi", "bye"}
printf("%s", (p)[0])
return 0
}

A. Compile time error
B. Undefined behaviour
C. hello
D. Address of hello
Answer: _________
Question 232:

What will be the output of the following C code? #include <stdio.h>
struct student
{
int no
char name[20]
}
struct student s
void main()
{
s.no = 8
printf("%s", s.name)
}

A. Nothing
B. Compile time error
C. Junk
D. 8
Answer: _________
Question 233:

What will be the output of the following C code? #include <stdio.h>
int main()
{
int i = 0, j = 1
int *a[] = {&i, &j}
printf("%d", (*a)[0])
return 0
}

A. Compile time error
B. Undefined behaviour
C. 0
D. Some garbage value
Answer: _________
Question 234:

What will be the output of the following C code? #include <stdio.h>
int add(int a, int b)
{
return a + b
}
int main()
{
int (*fn_ptr)(int, int)
fn_ptr = add
printf("The sum of two numbers is: %d", (int)fn_ptr(2, 3))
}

A. Compile time error, declaration of a function inside main
B. Compile time error, no definition of function fn_ptr
C. Compile time error, illegal application of statement fn_ptr = add
D. No Run time error, output is 5
Answer: _________
Question 235:

What will be the output of the following C code? #include <stdio.h>
void (*(f)())(int, float)
void (*(*x)())(int, float) = f
void ((*y)(int, float))
void foo(int i, float f)
int main()
{
y = x()
y(1, 2)
}
void (*(f)())(int, float)
{
return foo
}
void foo(int i, float f)
{
printf("%d %f
", i, f)
}

A. 1 2.000000
B. 1 2
C. Compile time error
D. Segmentation fault/code crash
Answer: _________
Question 236:

What substitution should be made to //-Ref such that ptr1 points to variable c in the following C code? #include <stdio.h>
int main()
{
int a = 1, b = 2, c = 3
int *ptr1 = &a
int **sptr = &ptr1
//-Ref
}

A. *sptr = &c
B. **sptr = &c
C. *ptr1 = &c
D. none of the mentioned
Answer: _________
Question 237:

What will be the output of the following C code? #include <stdio.h>
void foo(int*)
int main()
{
int i = 10
foo((&i)++)
}
void foo(int *p)
{
printf("%d
", *p)
}

A. 10
B. Some garbage value
C. Compile time error
D. Segmentation fault/code crash
Answer: _________
Question 238:

Which of the following declaration are illegal?

A. int a[][] = {{1, 2, 3}, {2, 3, 4, 5}}
B. int *a[] = {{1, 2, 3}, {2, 3, 4, 5}}
C. int a[4][4] = {{1, 2, 3}, {2, 3, 4, 5}}
D. none of the mentioned
Answer: _________
Question 239:

What will be the output of the following C code? #include <stdio.h>
int main()
{
int ary[4] = {1, 2, 3, 4}
printf("%d
", *ary)
}

A. 1
B. Compile time error
C. Some garbage value
D. Undefined variable
Answer: _________
Question 240:

What will be the output of the following C code? #include <stdio.h>
int main()
{
int a = 1, b = 2, c = 3
int *ptr1 = &a, *ptr2 = &b, *ptr3 = &c
int **sptr = &ptr1 //-Ref
*sptr = ptr2
}

A. ptr1 points to a
B. ptr1 points to b
C. sptr points to ptr2
D. none of the mentioned
Answer: _________
Question 241:

What will be the output of the following C code? #include <stdio.h>
void main()
{
char a[10][5] = {"hi", "hello", "fellows"}
printf("%s", a[2])
}

A. fellows
B. fellow
C. fello
D. fell
Answer: _________
Question 242:

What will be the output of the following C code (considering sizeof char is 1 and pointer is 4)? #include <stdio.h>
int main()
{
char *a[2] = {"hello", "hi"}
printf("%d", sizeof(a))
return 0
}

A. 9
B. 4
C. 8
D. 10
Answer: _________
Question 243:

What will be the output of the following C code? #include <stdio.h>
int main()
{
char *p[1] = {"hello"}
printf("%s", (p)[0])
return 0
}

A. Compile time error
B. Undefined behaviour
C. hello
D. None of the mentioned
Answer: _________
Question 244:

What will be the output of the following C code? #include <stdio.h>
int main()
{
char *str = "hello world"
char strary[] = "hello world"
printf("%d %d
", sizeof(str), sizeof(strary))
return 0
}

A. 11 11
B. 12 12
C. 4 12
D. 4 11
Answer: _________
Question 245:

What will be the output of the following C code? #include <stdio.h>
int main()
{
int a[4] = {1, 2, 3, 4}
int b[4] = {1, 2, 3, 4}
int n = &b[3] - &a[2]
printf("%d
", n)
}

A. -3
B. 5
C. 4
D. Compile time error
Answer: _________
Question 246:

What will be the output of the following C code? #include <stdio.h>
void f(int a[][3])
{
a[0][1] = 3
int i = 0, j = 0
for (i = 0
i < 2
i++)
for (j = 0
j < 3
j++)
printf("%d", a[i][j])
}
void main()
{
int a[2][3] = {0}
f(a)
}

A. 0 3 0 0 0 0
B. Junk 3 junk junk junk junk
C. Compile time error
D. All junk values
Answer: _________
Question 247:

What will be the output of the following C code? #include <stdio.h>
void (*(f)())(int, float)
typedef void (*(*x)())(int, float)
void foo(int i, float f)
int main()
{
x = f
x()
}
void (*(f)())(int, float)
{
return foo
}
void foo(int i, float f)
{
printf("%d %f
", i, f)
}

A. Compile time error
B. Undefined behaviour
C. 1 2.000000
D. Nothing
Answer: _________
Question 248:

In C, how do you declare a pointer variable that can store the address of an integer?

A. int *ptr
B. ptr int
C. int ptr
D. ptr *int
Answer: _________
Question 249:

How do you declare a pointer to a function that takes two integers and returns an integer in C?

A. int (*ptr)(int, int)
B. ptr(int, int) int
C. function int (*ptr)(int, int)
D. ptr function(int, int) int
Answer: _________

Answer Key

1: D
2: C
3: C
4: A
5: C
6: C
7: B
8: A
9: C
10: B
11: C
12: A
13: B
14: C
15: A
16: B
17: D
18: D
19: B
20: C
21: D
22: N/A
23: C
24: A
25: A
26: A
27: C
28: D
29: A
30: C
31: B
32: B
33: D
34: B
35: D
36: D
37: D
38: B
39: D
40: C
Solution: Using a pointer variable, without initializing it, will be disastrous, as it will have a garbage value.
41: C
42: C
43: A
44: C
45: A
46: B
47: A
48: B
49: A
50: D
51: C
52: A
53: D
54: A
55: B
Solution: The 'free' function in C is used to deallocate memory that was previously allocated using functions like malloc , calloc , or realloc . When memory is allocated dynamically , it resides in the heap, and it is the programmer's responsibility to release that memory when it is no longer needed. Using 'free' helps prevent memory leaks by returning the allocated memory back to the system. Option A is incorrect because allocating memory is done using malloc , calloc , or realloc . Option C is incorrect because 'free' does not create new pointers. Option D is incorrect because 'free' does not modify the value of the pointer

it only releases the memory the pointer points to. Therefore, the correct answer is Option B: Deallocate memory .
56: D
57: B
58: B
59: A
Solution: When the program is executed without any command line arguments, the argv array will contain only one element, which is the name of the executable file itself. In the while loop, *argv++ will first dereference argv , which points to the string containing the name of the executable file, and then increment argv to point to the next memory location, which would be NULL as there are no more command line arguments. However, the loop does not check for the NULL pointer before dereferencing argv . Therefore, when argv is dereferenced after reaching the end of the argv array (i.e., when it points to NULL ), it will cause a segmentation fault or code crash because it is attempting to access memory that is not valid. Hence, the correct answer is Option A: Segmentation fault/code crash.
60: A
61: A
62: D
63: D
64: B
65: D
66: A
67: B
68: D
69: A
70: C
71: D
72: A
73: D
74: D
75: A
76: D
77: B
78: A
79: C
80: D
81: D
82: B
83: A
84: A
85: A
86: B
87: C
88: A
89: B
90: B
91: B
92: A
93: A
94: B
95: C
96: B
97: B
98: A
99: B
100: D
101: B
102: B
103: B
104: A
105: B
106: C
Solution: In the given C program code snippet: void main()
{
char far *farther, *farthest
printf("%d..%d", sizeof(farther), sizeof(farthest))
} The sizeof operator is used to determine the size, in bytes, of a variable or data type. 1. ** farther ** and ** farthest ** are both pointers of type **char***. In C, the size of a pointer is typically **4 bytes** on a 32-bit system or **8 bytes** on a 64-bit system. Assuming a standard 32-bit architecture, the size of both pointers would be **4 bytes**.
2. Therefore, the output of the printf function will be:
- sizeof(farther) = 4
- sizeof(farthest) = 4 The printf statement prints these two sizes, resulting in the output **"4..4"**. Hence, the correct answer is **Option C: 4..4**.
107: C
Solution: In first sizeof, str1 is a character pointer so it gives you the size of the pointer variable. In second sizeof the name str2 indicates the name of the array whose size is 5 (including the 'null' termination character). The third sizeof is similar to the second one.
108: A
Solution: int *ptr, p
ptr is declared as a pointer to an integer because of the `*` symbol next to it. This means that `ptr` can hold the address of an integer variable. p is declared as a regular integer variable, not a pointer. The absence of the `*` symbol means that `p` will hold an integer value directly, not an address. Key Points: - ptr : Pointer to integer, can store addresses of integer variables. - p : Regular integer variable, cannot store addresses.
109: B
Solution: * is a dereference operator & is a reference operator. They can be applied any number of times provided it is meaningful. Here p points to the first character in the string " Hello ". * p dereferences it and so its value is H . Again & references it to an address and * dereferences it to the value H .
110: D
Solution: char * p = NULL is same as char * q = 0. In both declarations p and q are initialized to null.
111: C
112: A
Solution: p is pointer of type void.
113: C
114: B
115: A
Solution: int * : pointer to int int const * : pointer to const int int * const : const pointer to int int const * const : const pointer to const int Now the first const can be on either side of the type so: const int * == int const * const int * const == int const * const So the above declaration is pointer to const int. Which means, we cannot change the value pointed by ptr .
116: D
Solution: Address of variable a is assigned to the integer pointer ptr . Due to the statement
*ptr += 1
value at address pointing by ptr incremented by 1. As the value at address is changed so variable a also get the updated value.
117: A
Solution: OPTION 'A' AS CORRECT... THERE ARE SEVERAL DIFFERENT USES OF POINTERS IN C...THEY ARE (1) int *p
// p is a pointer to an integer quantity (2) int *p[10]
// p is a 10-element array of pointers to integer quantities (3) int (*p)[10]
// p is a pointer to a 10-element integer array (4) int *p(void)
// p is a function that returns a pointer to an integer quantity (5) int p(char *a)
// p is a function that accepts an argument which is a pointer to a character returns an integer quantity (6) int *p(char *a)
// p is a function that accepts an argument which is a pointer to a character returns a pointer to an integer quantity. (7) int (*p)(char *a)
// p is pointer to a function that accepts an argument which is a pointer to a character returns an integer quantity. (8) int (*p(char *a))[10]
// p is a function that accepts an argument which is a pointer to a character returns a pointer to a 10-element integer array. (9) int p(char (*a)[])
// p is a function that accepts an argument which is a pointer to a character array returns an integer quantity. (10) int p(char *a[])
// p is a function that accepts an argument which is a array of pointers to characters returns an integer quantity (11) int *p(char a[])
// p is a function that accepts an argument which is a character array returns a pointer to an integer quantity (12) int *p(char (*a)[])
// p is a function that accepts an argument which is a pointer to a character array returns a pointer to an integer quantity (13) int *p(char *a[])
// p is a function that accepts an argument which is an array of pointers to characters // returns a pointer to an integer quantity (14) int (*p)(char (*a)[])
// p is pointer to a function that accepts an argument which is a pointer to a character array returns an integer quantity (15) int *(*p)(char (*a)[])
// p is pointer to a function that accepts an argument which is a pointer to a character array returns a pointer to an integer quantity (16) int *(*p)(char *a[])
// p is pointer to a function that accepts an argument which is a array of pointers to characters returns a pointer to an integer quantity (17) int (*p[10])(void)
// p is 10-element array of pointers to functions
each function returns an integer quantity (18) int (*p[10])(char a)
// p is 10-element array of pointers to functions
each function accepts an argument which is a character and returns an integer quantity (19) int *(*p[10])(char a)
// p is 10-element array of pointers to functions
each function accepts an argument which is a character and returns a pointer to an integer quantity (20) int *(*p[10])(char *a)
// p is 10-element array of pointers to functions
each function accepts an argument which is a pointer to a character and returns a pointer to an integer
118: B
Solution: The sizeof () operator gives the number of bytes taken by its operand. p is a character pointer, which needs one byte for storing its value (a character). Hence sizeof (* p ) gives a value of 1. Since it needs two bytes to store the address of the character pointer sizeof ( p ) gives 2.
119: C
120: B
121: A
122: A
Solution: When subtracting pointers you get the number of elements between those addresses, not the number of bytes.
123: B
124: D
125: A
126: A
127: B
128: C
129: C
130: D
131: A
132: B
133: D
134: A
135: B
136: A
137: B
138: B
139: A
140: B
141: C, G
142: A
143: D
144: A
145: C
146: B
147: A
148: A
149: A
150: B, F
151: C, E
152: C
153: B
154: C
155: B
156: A
157: C, G
158: A
159: C
160: A
161: D
162: C
163: A
164: A
165: A
166: A
167: A
168: B
169: D
170: A
171: A
172: C
173: A
174: D
175: D
176: C
177: C
Solution: Every pointer regardless of its type whereas single pointer or pointer to pointer, needs only 2 bytes. Size of pointer and int is 2 bytes in Turbo C compiler on windows 32 bit machine . So size of pointer is compiler specific. But generally most of the compilers are implemented to support 4 byte pointer variable in 32 bit and 8 byte pointer variable in 64 bit machine.
178: D
Solution: && is logical AND operator and this operator requires two operands.
179: B
Solution: After the execution of the program, the value of the first element of the array 'a' will be modified. Let's break down the code step by step: a[0] = 1
: Sets the first element of the array 'a' to 1. a[1] = 2
: Sets the second element of the array 'a' to 2. p = a
: Assigns the address of the first element of the array 'a' to the pointer 'p'. (*p)++
: Increments the value at the memory location pointed to by 'p'. Since 'p' points to the first element of 'a', it increments the value of 'a[0]' . After the execution of the program, the value of a[0] will be 2. Therefore, the correct statement is Option B: a[0] = 2 .
180: D
181: C
182: A
183: B
184: D
185: C
186: C
187: B
188: D
189: C
190: B
191: C
192: A
193: C
194: D
195: C
196: B
197: A
198: C
199: A
200: A
201: C
202: D
203: A
204: D
205: C
206: C
207: B
208: B
209: D
210: B
211: D
212: A
213: D
214: A
215: B
216: A
217: B
218: D
219: A
220: A
221: C
222: A
223: B
224: A
225: D
226: D
227: B
228: C
229: B
230: C
231: B
232: A
233: C
234: D
235: A
236: A
237: C
238: A
239: A
240: B
241: C
242: C
243: C
244: C
245: A
246: A
247: A
248: A
249: A