Give syntax and use of fclose ( ) function.

1 Answer

Answer :

Syntax: 

int fclose(FILE* stream);

Use: This function is used to close a file stream. The data that is buffered but not written is flushed to the OS and all unread buffered data is discarded.

Related questions

Description : Explain the friend function with proper example.

Last Answer : Friend function: The private members of a class cannot be accessed from outside the class but in some situations two classes may need access of each other s private data. So a common function can be declared which can be made friend ... ; } friend void swap(A,B); }; void swap(A a,B b) { cout

Description : What are the rules for virtual function?

Last Answer : Rules for virtual function: 1. The virtual functions must be members of some class. 2. They cannot be static members. 3. They are accessed by using object pointers. 4. A virtual function can ... virtual function is defined in the base class, it need not be necessarily redefined in the derived class.

Description : State the rules for writing destructor function.

Last Answer : Rules for writing destructor function are: 1) A destructor is a special member function which should destroy the objects that have been created by constructor. 2) Name of destructor and name of the class should ... should not be classified in any types. 7) A class can have at most one destructor. 

Description : Write two properties of static member function

Last Answer : i) A static member function can have access to only other static data members and functions declared in the same class. ii) A static member function can be called using the class name with a scope resolution operator instead of object name as follows: class_name::function_name;

Description : What is multilevel inheritance? Draw the diagram to show multilevel inheritance. using classes with data member and member function. 

Last Answer : When a class is derived from another derived class then it is called as multilevel inheritance.

Description : What is inheritance? Give different types of inheritance.

Last Answer : Inheritance: The mechanism of deriving new class from an old/existing class is called inheritance. OR Inheritance is the process by which objects of one class acquired the properties of ... is a combination of single, multiple, multilevel and hierarchical inheritance. Diagram:

Description : What is a class? Give its example. 

Last Answer : Class is a user defined data type that combines data and functions together. It is a collection of objects of similar type. Example: class Student { int rollno; char name[10]; public: void getdata( ); void putdata( ); };

Description : Describe syntax and use of defining member function outside class. Give one example.

Last Answer : Member function that is declared inside a class has to be defined separately outside the class. These member functions associate a membership identify label in the header. This label tells the ... ) A member function can call another member function directly, without using the dot operator. 

Description : Explain use of scope resolution operator.

Last Answer : It is used to uncover a hidden variable. Scope resolution operator allows access to the global version of a variable. The scope resolution operator is used to refer variable of class anywhere in program. ... outside of class. Return_type class_name:: function_name( ) { Function body }

Description : Write a program to declare a class ‘book’ containing data members as ‘title’, ‘author-name’, ‘publication’, ‘price’. Accept and display the information for one object using pointer to that object.

Last Answer : #include<iostream.h> #include<conio.h> class book { char author_name[20]; char title[20]; char publication[20]; float price; public: void Accept(); void Display(); }; void ... title \t author_name \t publication \t price\n ; p-> Display(); getch(); }

Description : Write a program that copies contents of one file into another file.

Last Answer : Assuming input file to be copied file1.txt contents are “Hello Friends…” and file where the contents need to copy is file2.txt already created  #include #include #include #include #include void main() { clrscr(); ifstream fs; ofstream ft; char ch, fname1[20], fname2[20]; cout

Description : Write a program to implement the following hierarchy using suitable member functions. Refer Figure No.2.

Last Answer : # include <iostream.h> #include<conio.h> class Student { int roll_no; char name[10]; public: void read_studentData() { cout<< Enter student s roll no and name \n ; cin> ... { result r; clrscr(); r.read_result(); r.display_result(); getch(); }

Description : Write a program to overload the ‘—’ unary operator to negate the values.

Last Answer : #include<iostream.h> #include<conio.h> #include<string.h> class Number { int x,y; public: Number (int a, int b) { a =x; b =y; } void display() { cout<< ... ; -N1; cout<<"\n After negation:"; N1. display (); getch (); }

Description : Write a program to count the number of lines in file.

Last Answer : #include<iostream.h> #include<fstream.h> #include<conio.h> void main() { ifstream file; char ch; int n=0; clrscr(); file.open("abc.txt"); while(file) { file. ... \n Number of lines in a file are:"<<n; file.close(); getch(); }

Description : Write a program to sort an 1-d array in ascending order.

Last Answer : #include<iostream.h> #include<conio.h> void main() { int arr[20]; int i, j, temp,n; clrscr(); cout<<"\n Enter the array size:"; cin>>n; cout<<"\n Enter ... 0;i<n;i++) {  cout<< \n <<arr[i]; } getch(); }

Description : What is parameterized constructor?

Last Answer : A constructor that accepts parameters is called as parameterized constructor. In some applications, it may be necessary to initialize the various data members of different objects with different values when they are ... an argument. Member function put ( ) displays the value of data member m .

Description : Write the applications of object oriented programming.

Last Answer : Applications of object oriented programming are: 1) Real time systems 2) Simulation and modeling 3) Object-oriented databases 4) Hypertext, hypermedia and expertext 5) AI and expert systems ... and parallel programming 7) Decision support and office automation systems 8) CIM/CAM/CAD systems

Description : Describe ‘this’ pointer with an example.

Last Answer : this' pointer:  C++ uses a unique keyword called this to represent an object that invokes a member function. This unique pointer is automatically passed to a member function when it is invoked. ... pointer is used to represent object s when setdata ( ) and putdata ( ) functions are called. 

Description : Write any four benefits of OOP. 

Last Answer : Benefits of OOP: 1. We can eliminate redundant code and extend the use of existing classes. 2. We can build programs from the standard working modules that communicate with one another, ... interface descriptions with external systems much simpler. 10. Software complexity can be easily managed.

Description : Write a program to implement single inheritance from the following Refer Figure No.1

Last Answer : #include #include class employee { protected: int emp_id; char name[10]; }; class emp_info:public employee { int basic_salary; public: void getdata() { coutemp_id; coutname; coutbasic_salary; } void putdata() { cout

Description : Describe memory allocation for objects.

Last Answer : The memory space for object is allocated when they are declared and not when the class is specified. The member functions are created and placed in memory space only once when they are ... are essential because the member variables will hold different data values for different objects.

Description : Explain virtual base class with suitable example.

Last Answer : Consider a situation where all three kinds of inheritance, namely, multilevel, multiple, hierarchical inheritance, are involved. This illustrated in fig a. the child has two direct base classes, parent1 & ... Grandparent { }; class Child: public Parent1,public Parent2 { };

Description : State the difference between OOP and POP.

Last Answer : OBJECT ORIENTED PROGRAMMING (OOP) PROCEDURE ORIENTED PROGRAMMING (POP) Focus is on data rather than procedure. Focus is on doing things (procedure). Programs are divided into multiple ... approach is used in C++ language. Procedure oriented approach is used in C language.

Description : State the syntax & use of strlen ( ) & strcat ( ) function.

Last Answer : strlen( ): calculates the length of the string Syntax: strlen(s1); strcat():concatenates two strings Syntax: strcat(s1,s2)

Description : Write syntax and use of pow ()function of header file.

Last Answer : pow()- compute the power of a input value Syntax: double pow (double x, double y);

Description : What is syntax for dropping a procedure and a function .Are these operations possible?

Last Answer : Drop Procedure procedure_name Drop Function function_name

Description : What is function definition? (OR) what is user defined function? (OR) Write syntax of user defined function?

Last Answer : Function Definition : The program module that is written to achieve a specific task is called function definition. Syntax : type function-name(parameter list) // function header. { declaration of variables; body of function; // ... and b ); scanf( %d%d ,&a,&b); c=a+b; printf( %d ,c); }

Description : If we define putchar function in putchar :. char -> IO () syntax than character input as an argument andreturns a. Useful value b. Get output c. Getno output d. None of these

Last Answer : c. Getno output

Description : Virtual constructor: Constructors cannot be virtual. Declaring a constructor as a virtual function is a syntax error. Does c++ support multilevel and multiple inheritance?

Last Answer : Yes.

Description : Give the syntax and use of following with respect to (i) get() (ii) put().

Last Answer : (i) get() function: The get() function is member of istream class. It is used to read a single character from the keyboard. Syntax of get() function: get(variable_name); example:  char c; ... /variable_name); example: cout.put( X ); The above example displays character X on the screen.

Description : The rules that give meaning to the instructions. a) Semantics b) Syntax c) Code d) Cases

Last Answer : Answer: a Explanation: The answer is semantics. They are the rules that give meaning to the instructions. Syntax is the formal rules that ensure validation of code

Description : Give syntax of if-else ladder. 

Last Answer : if(condition_expression_One) {  statement1; } else if (condition_expression_Two) {  statement2; } else if (condition_expression_Three) {  statement3; } else {  statement4; }

Description : Define pointer variable. Give its syntax.

Last Answer : Definition: Pointer is a variable that holds memory address of another variable of similar data type.  Syntax to declare pointer variable: data_type *pointer_variable;

Description : Define pointer. Give syntax for declaration of pointer. 

Last Answer : Definition: Pointer is a variable that holds memory address of another variable of similar data type.  Syntax to declare pointer variable: data_type *pointer_variable;

Description : Any web references for correct syntax use?

Last Answer : It’s unclear whether you want this in English or Italian, but I think what you’re looking for is a reference for idioms. If you google the word, you’ll find many out there. Here’s one that has lots of examples: The Idiom Connection .

Description : State use of while loop with syntax.

Last Answer : While loop is used in programming to repeat a specific block of statement until some end condition is met. The syntax of a while loop is: while (test Expression) {  Statements…  statements…. }

Description : Describe the use of any methods of vector class with their syntax. 

Last Answer : boolean add(Object obj)-Appends the specified element to the end of this Vector. Boolean add(int index,Object obj)-Inserts the specified element at the specified position in this Vector. ... vector. void removeAllElements()-Removes all components from this vector and sets its size to zero.

Description : State use of finalize( ) method with its syntax.

Last Answer : Use of finalize( ): Sometimes an object will need to perform some action when it is destroyed. Eg. If an object holding some non java resources such as file handle or window character font, then before ... method whenever it is about to recycle an object. Syntax: protected void finalize() { }  

Description : Is there a syntax or word construction plug-in for Microsoft Office Mac?

Last Answer : answer:Have you tried the grammar checker included with Word? Microsoft Office for Mac 2011 – Check spelling and grammar in a different language link

Description : What's the correct syntax for linking to an HTML page on your local C: drive from an tag in a HTML page on your desktop?

Last Answer : try using \ instead of / for starters…

Description : What is the right access 2007 sql syntax for adding the last record of another table?

Last Answer : INSERT INTO samples (id_sample) SELECT Last(project.Id) AS LastOfId FROM project I tested this and it works. One nice thing about Access is you can use the graphical query designer to test your syntax. The ... View if you prefer text over the GUI. It will not run or save your query if errors exist

Description : Syntax for a Linux task, please. I am not familiar with the OS.

Last Answer : Did you get a chance to read over something like this?

Description : My calculator keeps saying syntax error over 10.2x10^12 why?

Last Answer : ok it works if I type in x10^12 but if I use the button x10^x it gives a syntax error.

Description : Changing syntax highlighting in Emacs?

Last Answer : Yes, it is, but it’s a complicated process that requires you to know how your major-mode parses whatever language you’re working in. Syntax highlighting annoys me, so I turn it off and can’t give you much more info than that.

Description : Can someone please explain the origins and syntax of using "something fierce" at the end of a phrase?

Last Answer : To want something very badly.

Description : Why do many gay men speak with similar inflections and syntax, regardless of place of origin, ethnicity, or age?

Last Answer : Because it's a learned cultural affectation. My understanding is that as the gay rights movement became more visible in the late 60s in urban centers like NY and San Francisco, the very vocal/visible ... affluent kids in the suburbs, emulating kids in the inner city. It's all just learned behavior.

Description : Choose the correct syntax to create an E_mail link. (a) -Technology

Last Answer : (b)

Description : The general syntax for inline image is . -Technology

Last Answer : True At the place of the file name, the path of the image is specified. If the image is in the same folder as HTML file, it is not needed to specify the full path of an image.

Description : Which one of these is correct syntax of the declaration, that defines the XML version? -Technology

Last Answer : (a) is a correct syntax of the declaration.

Description : An XML document that follows the XML syntax is called a -Technology

Last Answer : (b) well-formed XML document