-->

q36)Wap to display those records which have price >340. Records are with fields name,price and edition.

//Wap to display those records which have price >340. Records are with fields name,price and edition.
#include<stdio.h>
include<conio.h>
void main()
{
FILE *k;                                                                    //  pointer for file declaration
char book_name[30],author_name[40];                   //identifier declaration
int book_edition;                                                         //       "             "
k=fopen("book.dat","r");

while((fscanf(k,"%d %s %d",&book_price,book_name,&book_edition)!=EOF))//reading data from data file
{
 if(book_price>340)                                                   // condition validating
{
printf("book name=%s ,book edition=%d and price=%d",book_name,book edition,book_price); //displaying data
}
}
fclose(k);                                                                                   //closing data file
getch();
}

NEB35:WAP top read all records stored in a file book.dat. Fields are name,price and author's name.

//WAP top read all records stored in a file book.dat. Fields are name,price and author's name.
#include<stdio.h>
include<conio.h>
void main()
{
FILE *k;                                                                    //  pointer for file declaration
char book_name[30],author_name[40];                   //identifier declaration
int book_price;                                                         //       "             "
k=fopen("book.dat","r");

while((fscanf(k,"%d %s %s",&book_price,book_name,author_name)!=EOF))//reading data from data file
{
printf("book name=%s ,author name=%s and price=%d",book_name,author_name,book_price); //displaying data
}
fclose(k);                                                                                   //closing data file
getch();
}

NEB34:WAP to store details about book(any 'n') having fields name,price,edition.

//WAP to store details about book(any 'n') having fields name,price,edition.
#include<stdio.h>
include<conio.h>
void main()
{
FILE *k;                                                                    //  pointer for file declaration
char book_name[30],choice;                                                    //identifier declaration
int book_price,edition;                                             //       "             "
k=fopen("book.dat","w");
do
{
printf("enter book's name\n");                                       // getting inuts
gets(book_name);
printf("enter edition\n");
scanf("%d",&edition);
printf("enter book's price\n");
scanf("%d",&book_price);
fprintf(k,"%s %d %d",book_name,edition,book_price);   //writing data to data file
printf("want to continue y/n\n");
choice=getche();                                                        //getting a character from user  
}while(choice!='n');                                                      // validating the input
printf("writing process completed successfully\n");
fclose(k);                                                                                   //closing data file
getch();
}

NEB33":WAP to store book's name,price and author's name in a file namd 'book.dat'.

//WAP to store book's name,price and author's name in a file named 'book.dat'.
#include<stdio.h>
include<conio.h>
void main()
{
FILE *k;                                                                    //  pointer for file declaration
char book_name[30],author_name[40];                   //identifier declaration
int book_price;                                                         //       "             "
k=fopen("book.dat","w");
printf("enter book's name and author's name\n");   // getting inuts
gets(book_name);
printf("enter author's name\n");
gets(author_name);
printf("enter book's price\n");
scanf("%d",&book_price);
fprintf(k,"%s %s %d",book_name,author_name,book_price);   //writing data to data file
printf("writing process completed successflly\n");
fclose(k);                                                                                   //closing data file
getch();
}




NEB32:three data file handling functions with examples.

Explain any three data file handling functions with examples.
ans:-
There are many data file functions which we use while programming. Following are some functions used to handle data stored in data file.

1) fopen(): It is used to open the file in particular mode. Its syntax is
                FILE *fopen(const char *filename, const char *mode); 
or 
FILE pointer= fopen("file name","mode");

Example
FILE *k;
k=fopen("data.txt","w");
This statement opens the file named data.txt in writing mode(w). Here ,writing mode means, we are going to store data in data file .

2)fclose(): It is used to close the opened file.As we have finished working with data file,it needs to be closed; so, at last we close it using fclose().

syntax
fclose(FILE name);
or fclose(FILE stream);

example
FILE *k;

k=fopen("data.txt","w");

..................

fclose(k);
Here we have closed data file using fclose() function.

3) fprintf(): It is used to write data/records in an opened data file i.e it writes data in an opened data file.

 syntax
int fprintf(FILE *stream,constant char *format);

example;
FILE *k;

k=fopen("data.txt","w");

fprintf(k,"%s %s  %s","hello","world", "of c");

this writes data (mentioned above) in an opened file data.txt.
4) fscan(): It is used to read data/records from opened data file. 
 syntax
int fscanf(FILE *stream,constant char *format,...);

example;
FILE *k;

k=fopen("data.txt","r");
char string[100];fscanf(k,"%s %s  %s",string,string,string);

this reads data (mentioned above) from opened file data.txt.


NEB31:What is pointer?explain it. With the help of program, explain about 'call by value' and 'call by reference'.

ans:
first part:-
                A pointer is a variable which points to the address and not its value. with the help of pointer, we can
                       ->we can allocate memory dynamically
                       ->better memory management
                        ->passing of array and string to the functions more efficiently
                        ->it helps us to return more values etc.
example:
   int *k;
here , k is a pointer and will store address of a variable.

second part:-
call by value:-
                         We can pass argments/parameters either by value or address.
 passing by value means we are going to copy the value directly to the formal arguments from real arguments. the change is formal arguments have no effect in real argument.Example is here.
// call by value
#include <stdio.h>

void callbyvalue(int, int);                            /* function Prototype i.e. function declaration */

void main()                                                 /* Main function */
{
  int x = 10, y= 20;                                 // variables declaration

                                                                    /* actual arguments will be as it is */
  callbyalue(x, y);                             // passing value of x and y
  printf("x= %d, y= %d\n", x, y);    // displaying the values
}

void callbyvalue(int m, int n)             // passing values to formal parameter m and n
{
  int t;
  t = m;
m = n;
 n = t;                              // swapping takes place
}

out put is: x=10,y=20
Here, the values of x and y are no affected by  values of m and n. so there will be no swapping.

call by reference:- We have now second method to pass our arguments/paramenter.In this, we use pointer to pass addressof parametersto the functions. in this way the values are copied to formalparameter and process continues there.example is given here.


// call by value reference
#include <stdio.h>
void callbyref(int*, int*);                                                          /* function Prototype */

void main()                                                                                   /* Main function */
{
  int x = 10, y = 20;                                                               //variable declaration

                                                                                                  /* actual arguments will be altered */
  callbyref(&x, &y);                                                               // passing addresss
  printf("x: %d, y: %d\n", x, y);                                            //displaying value after altering
}

void callbyref(int *m, int *n)
{
  int t;
  t = *m; *m = *n; *n = t;                                                     /swapping being done
}


output: x=20,y=10
In above example we have passed address of identifier x and y to the function.while passing address,its vale is copied to formal parameter and then swapping takes place. It means by passing address we can alter the value in real parameter which was not possible in call by value,



class 11 project details

--------------------------------------------------------------------------------------------------------------------------
Detail about project work:-

Project work: -

At the end of session students will be asked to prepare a project work on ‘web technology’. In this Project work students have to make a simple website using HTML and CSS. Students may choose a topic of their own interest.

Project work assessment is the internal assessment of reports and presentation of their project works either individually or group basis. In case of group presentation, every member of the group should submit a short reflection on the presented report in their own language.

1.1             Project work writing format:

Students have to follow same format as given by college.          

Formatting Guidelines
Project Work
         

Title page

Title of the project, name of the author(s), class, ID number, registration numbers, email, school name and address 

Title

Capitalize each word. / Be clear, informative & concise. / Avoid abbreviations,

Spacing

Double-space

Fonts

Times New Roman or Arial (Title – 14-point bold font / Body text – 12-point font)

Page Numbering

Bottom of the page, centre

Report structure

Divide body text into different sections with appropriate headings. Use standard headings as far as possible such as:

·        Introduction: Background, literature review, objectives & limitation

·        Materials & Methods: Equipment used & data collection procedure

·        Results or Findings: Presentation, analysis and interpretation of data / Give important details in tables and figures.

·        Conclusions: Highlight key findings

·        Acknowledgements

·        References 

Headings

Bold font on a separate line / No numbering for headings & subheadings

Paper

A4 size, white, one-sided printing

Page margins

Left 1.25”, Right 1”, Top 1”, Bottom 1”,Alignment-justify

Page Binding

Spiral

Webpage range

10-15 pages (total number of web pages to be in the project work)

Project work writing order (what to write and in what order):

1.cover page

2.project title page

3.Declaration page

4.Letter of approval page

5.Table of contents with page number

6.

6.1              Introduction: Background, literature review, objectives & limitation

Write theory of HTML and CSS ------maximum 4 pages

6.2              Materials & Methods: Equipment used & data collection procedure

What softwares/editors were used with what computer configurations?

List them out. Talk about processor, RAM, etc.

6.3              Results or Findings: Presentation, analysis and interpretation of data / Give important details in tables and figures/graphs.

->Put all source codes of HTML here. --------any 5 pages'

-> Screenshot of web page/site------------------any 5 pages

6.4              Conclusions: Highlight key findings

6.5              Acknowledgements

Acknowledgements enable you to thank all those who have helped in carrying out the research/work. Careful thought needs to be given concerning those whose help should be acknowledged and in what order. The general advice is to express your appreciation in a concise manner and to avoid strong emotive language.

Note that personal pronouns such as 'I, my, me …' are nearly always used in the acknowledgements while in the rest of the project such personal pronouns are generally avoided.

The following list includes those people who are often acknowledged.

Note however that every project is different and you need to tailor your acknowledgements to suit your particular situation.

Main supervisor

Second supervisor

Other academic staff in your department

Technical or support staff in your department

Academic staff from other departments

Other institutions, organizations or companies

Past students

Family
Friends

 

References / Bibliography
-----------------------------------------

       
            

Notes:-
                  1. Use passive voice while writing
                  2. Use third person (do not use I or we; instead use “it was done”)
                  3. Use proper formatting (justify)
                  4. If you need then you can use header and footer properly
          
                 5. Do not mix/use colors. Make it as simple as it has to be.
                 6.The topic for website should be chosen by student themselves.



1. You have to make the same format as given there
2. no copying or direct printing
3. On your exam day, bring all the works done (project work)in pen drive as well as in hardcopy. We may ask you to show softcopy.

---------------------------------
Useful links:
For
A.
   1.cover page

2.project title page

3.Declaration page

4.Letter of approval page

B.project sample

click here

-----------------------------------------------------------------

If any further questions still left in mind then mail me at:
                krishnaamallik@gmail.com
  
                                You will be responded!