# Exercise: Questions on C Quiz 8

Questions on C Quiz 8 : Question 1 :
In the below statement, ptr1 and ptr2 are uninitialized pointers to int i.e. they are pointing to some random address that may or may not be valid address.
```int* ptr1, ptr2;
```

 TRUE FALSE  Correct
Questions on C Quiz 8 : Question 2 :
Anyone of the followings can be used to declare a node for a singly linked list. If we use the first declaration, “struct node * nodePtr;” would be used to declare pointer to a node. If we use the second declaration, “NODEPTR nodePtr;” can be used to declare pointer to a node.
```/* First declaration */
struct node {
int data;
struct node * nextPtr;
};

/* Second declaration */
typedef struct node{
int data;
NODEPTR nextPtr;
} * NODEPTR;
```

 TRUE FALSE  Correct
Questions on C Quiz 8 : Question 3 :
Anyone of the following can be used to declare a node for a singly linked list and âNODEPTR nodePtr;â can be used to declare pointer to a node using any of the following
```/* First declaration */
typedef struct node
{
int data;
struct node *nextPtr;
}* NODEPTR;

/* Second declaration */
struct node
{
int data;
struct node * nextPtr;
};
typedef struct node * NODEPTR;
```

 TRUE  Correct FALSE
Questions on C Quiz 8 : Question 4 :
Both of the following declarations for function pointers are equivalent. Second one (i.e. with typedef) looks cleaner.
```/* First Declaration */
int (*funPtr1)(int), (*funPtr2)(int);

/* Second Declaration*/
typedef int (*funPtr)(int);
funPtr funPtr1, funPtr2;
```

 TRUE  Correct FALSE
Questions on C Quiz 8 : Question 5 :
In a C file (say sourcefile1.c), an array is defined as follows. Here, we donât need to mention arrary arr size explicitly in [] because the size would be determined by the number of elements used in the initialization.
```int arr[] = {1,2,3,4,5};
```
In another C file (say sourcefile2.c), the same array is declared for usage as follows:
```extern int arr[];
```
In sourcefile2.c, we can use sizeof() on arr to find out the actual size of arr.

 TRUE FALSE  Correct
Questions on C Quiz 8 : Question 6 :
Choose the correct option to fill the ?1 and ?2 so that the program prints an input string in reverse order. Assume that the input string is terminated by a new line character.
```#include <stdio.h>
void wrt_it (void);
int main (void)
{
printf("Enter Text");
printf ("\n");
wrt_ it();
printf ("\n");
return 0;
}
void wrt_it (void)
{
int c;
if (?1)
wrt_it();
?2
}
```

 ?1 is  getchar() ! = '\n' ?2 is  getchar(c); ?1 is  (c = getchar()); ! = '\n' ?2 is  getchar(c); ?1 is  c! = '\n' ?2 is  putchar(c); ?1 is (c = getchar()) ! = '\n' ?2 is putchar(c);  Correct