c) 3 only Types, Pointers, Arrays & Structures in C++, Functions, Namespaces & Exceptions in C++, Source Files, Classes & Operator Overloading in C++, Derived Classes, Templates & Exception Handling in C++, here is complete set of 1000+ Multiple Choice Questions and Answers, Prev - C++ Programming Questions and Answers Random Numbers, Next - C++ Programming Questions and Answers Lambda Expressions, C Program to Find the File Size using File Handling Function, C++ Programming Questions and Answers File Streams and String Streams, What is Nested File Inclusion in C Programming, C++ Programming Questions and Answers Header Files Usage, C Programming Questions and Answers File Inclusion 2, Unix Questions and Answers File Handling System Calls 2, C++ Program to Print the Contents of File in Reverse Order, Object Oriented Programming MCQ Questions. delete[] b; The range for signed integers is -32768 to 32767. This operator increments the value of its operand then uses the value in context. Which of the following is not used as a file opening mode? Therefore, it will continue to print javatpoint. Use the LOF and Loc functions instead of EOF when reading binary files with Input, or use Get when using the EOF function.
25) How many instances of a class can be declared? Answer: A
ios::curr from the current position. cout.write (b, l);
A pointer to an int and a pointer to a double are of the same size. Explanation: Returns true if a file open for reading has reached the end is the correct statement about eof(). In the context of counter-controlled iteration, which of the following, Which data type should normally not be used to control a counting. Which of the following true about FILE *fp. C. myfile::open ("example.bin", ios::out);
c) The logical AND of two expressions is true if and only if each of the conditions is true. What is the highest value assumed by the loop counter in a correct, What is produced by a for statement with a correct body and with. Thank you for this questions and excellent explainations. b) ifstream Our C++ questions and answers focuses on all areas of C++ programming language covering 100+ topics in C++, a) ios::set
5) Which of the following comment is correct when a macro definition includes arguments? Which of the following is the default mode of the opening using the fstream class? d) VTC Answer: (a) The opening parenthesis should immediately follow the macro name. not at end of file, continue reading numbers
5. exit(1);
Interviewmania is the world's largest collection of interview and aptitude questions and provides a comprehensive guide to students appearing for placements in India's most coveted companies. #include
d) ios::beg. c) FILE is a keyword in C for representing files and fp is a variable of FILE type
a) int B. ifstream
Which of the following is used to create an output stream? i.seekg (0, ios :: end);
2. Sanfoundry Global Education & Learning Series C++ Programming Language. It's popularity has gained significantly in last few years as SAS is one of the most sought-after IT skill. 1. 40) Suppose that cPtr is a character pointer, and its current content is 300. 16) Which one of the following is a loop construct that will always be executed once? Note:Includes all required header files
Which of the following true about FILE *fp, A. What is the qualifying input for the type specifier G? If the mode includes b after the initial letter, what does it indicates. This program's output will not appear in the new line because the \ n escape sequence has not been used in this program. Which is true for fgets? c) ios::cur Which statement automatically handles all the details of counter-controlled. All Rights Reserved. A text is made up of the characters a, b, c, d, e each occurring with the probability 0.12, 0.4, 0.15,0.08 and .25 respectively. Which statement about a correct for statement with an initialization. Which one is a syntactically wrong statement? something to read. b) ios::out This section focuses on the "File Handling" in C++ programming langauge. b) 2, 3 Import raw data files. c) To truncate an existing file to half On my screen, I can't see possible answers to Q24, there is just the Q and the explanation, but there are no possible choices (A:D)THX for your work! Please mail your requirement at [emailprotected] Duration: 1 week to 2 week. b = new char [l];
Note:Includes all required header files using namespace std; int main () { ofstream outfile ("find.txt"); for (int i = 0; i < 70; i++) { outfile << i; outfile.flush(); } cout << "Done"; outfile.close(); return 0; }, What is the output of this program? Very conceptual questions, helped me a lot, thankyou very good excercise to brushup the topics, My question Data a;Office ='stansys';Run;Output : StAnSyS, To continue reading you need to turnoff adblocker and refresh the page, SAS Base Certification is one of the most popular certification in analytics industry. With files opened for Random or Binary access, EOF returns False until the last executed Get statement is unable to read an entire record. Please continue the good work! Explanation: End1 is an I/O manipulator that takes effect in printing a new line '\ n' character and then flushing the output stream. Which of the following methods can be used to open a file in file handling? |
i) Use of wx is more efficient. a) Statements preceding a for and statements in the body of a for should typically be merged into the for header. Which of the following statement is correct? #include
cout << course << endl;
The comma operator is most often used in __________ statements. char * b;
d) Returns true if a file open for reading has reached the middle. ________ iteration is sometimes called definite iteration. What is the output of this program? c) ios::cur c)
SAS Certification prep Guide for base programming 9 by SAS Institute, Really helpful explanations..! Answer: C All Rights Reserved. It should be " " to get "Of". a) ofstream Suppose the pointer variable has p address 1000, and that p is declared to have type int*, and an int is 4 bytes long. Very helpful. Explanation: fp is a pointer of FILE type and FILE is a structure that store following information about opened file, a) Using Open ( ) file, however, is often unknown. Explanation: The output of this program is "Hello, World!". The first object created is the first object destroyed; last created is last destroyed. a) ios::beg View Answer, 2. thank you for questionsit helped a lot. Note:Includes all required header files using namespace std; int main () { int p = 1000; double q = 3.14; cout << p; cout << endl; cout << q << endl << p * q; endl (cout); return 0; }, Which of the following is true about the following program Note:Includes all required header files using namespace std; int main () { char i; streambuf * p; ofstream of ("find.txt"); pbuf = of.rdbuf(); do { i = cin.get(); p -> sputc(i); } while (i != '. Explanation: Both A and B methods can be used to open a file in file handling. With files opened for Output, EOF always returns True. ifstream i; 36) Which of the following SLT template class is a container adaptor class? The ____________, __________, and ____________ are the only three forms, c) In the "Rules for Forming Structured Programs (and Structured Flowcharts)," the rule that states, "Any rectangle (action) can be replaced by any control statement" is called the "nesting rule.". The optimal coding tech-nique will have the average length of. Explanation: Any C program has at least one function, and even the most trivial programs can specify additional functions.
Which sets are best represented by the venn diagram. int data; Note:Includes all required header files using namespace std; int main () { int l; char * b; ifstream i; i.open ("find.txt", ios :: binary ); i.seekg (0, ios :: end); l = i.tellg(); i.seekg (0, ios :: beg); b = new char [l]; i.read (b, l); i.close(); cout.write (b, l); delete[] b; return 0; }, What is the output of this program? 1. How many objects are used for input and output to a string? Thanks for providing these good, accurate questions with thoughtful explanations for free. thanks a lot, Great Job Mr. Bhalla.. Keep up the good work. What is the default return-type of getchar()?
d)
a) ios::in Explanation: Both A and B methods can be used to open a file in file handling.
no more data to be read from an input file stream, and zero (meaning FALSE)
TRUE FILE is a structure and fp is a pointer to the structure of FILE type d) ios::trunc. The question was framed in such a way. JavaTpoint offers college campus training on Core Java, Advance Java, .Net, Android, Hadoop, PHP, Web Technology and Python. Which of the following is used to move the file pointer to start of a file? Explanation: Macro is used in place of a function because it reduces code size, and very efficient. b) ios::start 24) Each instance of a class has a different set of, Explanation: Each instance of the class has a different set of attribute values. When wx is used, fopen() returns NULL if file already exists.
D. myfile.open ("example.bin", ios:out); Explanation: myfile.open ("example.bin", ios::out); is correct syntax. It first evaluates to "a + = 3" i.e. 32) Give the following declarations and an assignment statement. }, A. course Objects are destroyed in the order they appear in memory, the object with the lowest memory address is destroyed first. file contains an undermined number of integer values Which of the following statements are correct? Explanation: You can always declare multiple instances of a class, as per required. b) char c) Sentinels must be distinct from regular data items. contained within the file are known. A single die is rolled twice. its value is implementation dependent and cant be negative, its value should not equal the integer equivalent of any character, Following Operating System was Created by Dennis Ritchie. c) changep() Note:Includes all required header files What is the return type open() method? d) ios::beg Explanation: In C language, the pre-processor is a macro processor that is dynamically used by the C programmer to modify the program before it is properly compiled (Before construction, pro-processor directives are implemented).