Monday 3 May 2021

Solved : IT Tools and Business Systems (Jan 2020)

 Solved : IT Tools and Business Systems (Jan 2020)

Part One

1. : Each question below gives a multiple choice of answers. Choose the most appropriate one and enter in the "OMR" answer sheet supplied with the question paper, following instructions therein.
(1x10=10)


1.1 : Which Decimal equivalent of the binary number 11100011is:
(A) 227 (B) 226
(C) 224 (D) 228

Friday 30 April 2021

Implicit and Explicit type conversion | C Language

 Implicit and Explicit type conversion | C Language

Converting one data type into another data type is known as type conversion or typecasting. For example, converting character to number type integer. A waterfall model has been used for type conversion, which guaranteed that no loss of data while conversion.  If you convert the higher data type to a lower data type then data loss will occur, for example, conversion of long to an integer.

Implicit and Explicit type conversion | C Language




Implicit Typecasting

Implicit type casting means conversion of data types without losing its original meaning. This type of typecasting is essential when you want to change data types without changing the significance of the values stored inside the variable.

 

Tuesday 27 April 2021

Advantage of Pointer | C Language

Advantage of Pointer

  • It provides dynamic programming environment.
  • Physical location of memory can be direct access through pointer.
  • It allow to call by reference to function which help to achieved many dynamic operation.
  • Dynamic memory allocation is achieved through array.
  • Fire read write operations are achieved through pointer.
  • Management of structures which are allocated memory dynamically is efficiently achieved by pointer.

Sunday 25 April 2021

File read write function | C Language

1. ftell()

Returns the current file pointer position in numeric form. 

 Declarationlong ftell(FILE *stream);

 

 Remarks:

ftell returns the current file pointer for stream.If the file is binary, the offset is measured in bytes from the beginning of

the file The value returned by ftell can be used in a subsequent call to fseek.

 

 Return Value:

   On success, returns the current file pointer position.

   On error, returns -1L and sets errno to a positive value.

 

Example

 

    #include <stdio.h>

 

int main(void)

{

   FILE *stream;

 

   stream = fopen("MYFILE.TXT", "w+");

   fprintf(stream, "This is a test");

   printf("The file pointer is at byte %ld\n", ftell(stream));

   fclose(stream);

   return 0;

}

2. rewind()

Repositions file pointer to stream's beginning

 

 Syntax:

  void rewind(FILE *stream);

 

 Remarks:

rewind(stream) is equivalent to   fseek(stream, 0L, SEEK_SET) 

except that rewind clears the end-of-file and error indicators, while fseek

only clears the end-of-file indicator. 

After rewind, the next operation on an update file can be either input or

output.

 

Example

 

 #include <stdio.h>

 #include <dir.h>

 

 int main(void)

 {

    FILE *fp;

    char *fname = "TXXXXXX", *newname, first;

 

    newname = mktemp(fname);

    fp = fopen(newname,"w+");

    fprintf(fp,"abcdefghijklmnopqrstuvwxyz");

    rewind(fp);

    fscanf(fp,"%c",&first);

    printf("The first character is: %c\n",first);

    fclose(fp);

    remove(newname);

 

    return 0;

}

 

Next Topic