प्रश्न और उत्तर का अभ्यास करें
8प्र: How would you eliminate the warning generated on complaining the following program? main() { char far *scr; scr = 0xB8000000; *scr = 'A'; } 876 05b5cc7dde4d2b419777515dc
5b5cc7dde4d2b419777515dc- उत्तर देखेंउत्तर छिपाएं
- Workspace
- SingleChoice
उत्तर :
व्याख्या :
Use the typecast scr = (char far *) 0xB8000000;
प्र: How would you obtain segment and offset addresses from a far address of a memory location? 2242 05b5cc7dde4d2b419777515db
5b5cc7dde4d2b419777515db- उत्तर देखेंउत्तर छिपाएं
- Workspace
- SingleChoice
उत्तर :
व्याख्या :
#include "dos.h" main() { Char far *scr = ( char far *) 0xB8000000; Char *seg, *off; Seg = (char *) FP_SEG ( scr ); Off = ( char *) FP_OFF ( scr ); }
प्र: What would be the output of the following program? main() { char a[] = "Visual C++"; char *b = "Visual C++"; printf ("\n%d %d", sizeof (a), sizeof (b)); printf ("\n%d %d", sizeof (*a), sizeof (*b)); } 1553 05b5cc7dde4d2b419777515da
5b5cc7dde4d2b419777515da- उत्तर देखेंउत्तर छिपाएं
- Workspace
- SingleChoice
उत्तर :
व्याख्या :
11 2 1 1
प्र: What would be the output of the following program, if the array beigns at address 65486? main() { int arr[] = {12,14,15,23,45}; printf ("%u %u", arr, &arr); } 1061 05b5cc7dde4d2b419777515d9
5b5cc7dde4d2b419777515d9- उत्तर देखेंउत्तर छिपाएं
- Workspace
- SingleChoice
उत्तर :
व्याख्या :
65486 65486
प्र: What would be the output of the following program? main() { char ch ='A'; printf ("%d%d", sizeof (ch), sizeof ('A')); } 830 05b5cc7dde4d2b419777515d8
5b5cc7dde4d2b419777515d8- उत्तर देखेंउत्तर छिपाएं
- Workspace
- SingleChoice
उत्तर :
व्याख्या :
1 2
प्र: How would you find the length of each string in the following Program? main() { char *str[] = { "Frogs", "Do", "Not" , "Die" , "They" , "Croak!"}; printf ("%d%d", sizeof (str), sizeof (str[0])); } 1765 05b5cc7dde4d2b419777515d7
5b5cc7dde4d2b419777515d7- उत्तर देखेंउत्तर छिपाएं
- Workspace
- SingleChoice
उत्तर :
व्याख्या :
main() { char *str[] = { "Frogs", "Do", "Not", "Die." , "They", "Croak!" }; int i; for ( i = 0;i<=5;i++) printf ("\n%s%d", str[i], strlen( str[i])); }
प्र: Point out the error, ifany, in the followingb code? typedef struct { int data; NODEPTR link; } *NODEPTR; 1688 05b5cc7dde4d2b419777515d6
5b5cc7dde4d2b419777515d6- उत्तर देखेंउत्तर छिपाएं
- Workspace
- SingleChoice
उत्तर :
व्याख्या :
A typedef defines a new name for a type, and in simpler cases like the one shown below you can define a new structure type and a typedef for it at the same time. typedef struct { char name[20]; int age; } emp; However, in the structure defined in this question, there is an error because a typedef declaration cannot be used until it is defined. In the given code fragment the typedef declaration is not yet defined at he point where the link field is declared.
प्र: If the following structure is written to a file using fwrite(), can fread() read it back successfully? struct emp { char *n; int age; }; struct emp e = { "Sujay",15}; FILE *fp; fwrite (&e, sizeof (e), 1, fp); 988 05b5cc7dde4d2b419777515d5
5b5cc7dde4d2b419777515d5- उत्तर देखेंउत्तर छिपाएं
- Workspace
- SingleChoice
उत्तर :
व्याख्या :
No, since the structure contains a char pointer while writing the structure to the disk using fwrite() only the value stored in the pointer n would get written. When this structure is read back the address would be read back but it is quite unlikely that the desired string would be present at this address in memory

