This section includes 7 InterviewSolutions, each offering curated multiple-choice questions to sharpen your Current Affairs knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
What are the similarities and differences between bad() and fail() functions. |
|
Answer» Similarities: bad() and fail() both are error handling functions and return true if a reading or writing operation fails. Differences: Both bad() and fail() return true if a reading or writing operation fails but fail() also returns true in the case that a format error happens, like when an alphabetical character is extracted when we are trying to read an integer number. |
|
| 2. |
Compilation and execution there were no errors. But he got a wrong output. Name the type of error he faced. |
|
Answer» Logical Error. |
|
| 3. |
Prove the complementarity law of boolean algebra with the help of truth table? |
||||||||||||||||||
|
Answer» (a) X + X’ = 1 To prove this law, we will make a following truth table :
0 + 1 = 1 and 1 + 0 = 1 From truth table it is prove that X + X’ = 1 (b) X . X’= 0 To prove this law, we will make a following truth table :
0 . 1 = 0 and 1 . 0 = 0 From truth table it is prove that X + X’ = 1 From truth table it is prove that X . X’= 0 |
|||||||||||||||||||
| 4. |
How can we delete or deactivate our Instagram, Snapchat, Facebook account (or any Social Media account)? Justify it by telling all the steps. |
| Answer» You can deactivate facebook account | |
| 5. |
Discuss the working of good() and bad() functions in file I/O error handling. |
|
Answer» good(): Returns nonzero (true) if no error has occurred. For instance, if fin.good() is true, everything is okay with the stream named as fi and we can proceed to perform I/O operations. When it returns zero, o further operations can be carried out. bad(): Returns true if a reading or writing operation fails. For example in the case that we try to write to a file that is not open for writing or if the device where we try to write has no space left. |
|
| 6. |
Differentiate between i. Static variables and auto variables. ii. Execution error and compilation error. |
|
Answer» (i) Static variables and auto variables: Static variables: The features are as follows Declaration place:-may be declared internally or externally. Declaration syntax:-we use the keyword static to declare a static variable. Static int age; Default initial value:- Zero Scope:-in case of internal static variable, the scope is local to the function in which defined while scope of external static variable is to all the functions defined in the program. Life:- value of variable persists between different function calls. Automatic variables: The features are as follows Declaration place:-declared inside a function in which they are to be utilized, that’s why referred as local or internal variables. Declaration syntax:- A variable declared inside a function without storage class specification by default is an automatic variable. However, we may use the keyword auto to declare it explicitly. main() { auto int age; } Default initial value:-Garbage value Scope:-created when the function is called and destroyed on exit from the function. Life:- till the control remains within the block in which defined. (ii) Execution error and compilation error: Errors such as mismatch of data types or array out of bound error are known as execution errors or runtime errors. These errors are generally go undetected by the compiler so programs with run-time error will run but produce erroneous results. Compilation error also known as syntax errors are caused by violation of the grammar rules of the language. The compiler detects, isolate these errors and terminate the source program after listing the errors. |
|
| 7. |
Write a function in C++ to search for a laptop from a binary file “LAPTOP.DAT” containing the objects of classLAPTOP (as defined below). The user should enter the Model No and the function should search and display thedetails of the laptop.class LAPTOP { long ModelNo; float RAM,HDD; char Details[120];public: void StockEnter() { cin>>Modelno>>RAM>>HDD; gets(Details); } void StockDisplay() { cout<<ModelNo<<RAM<<HDD<<Details<<endl; } long ReturnModelNo() { return ModelNo; }}; |
|
Answer» void Search( ) { LAPTOP L; long modelnum; cin>>modelnum; ifstream fin; fin.open("LAPTOP.DAT",ios::binary|ios::in); while(fin.read((char*)&L,sizeof(L))) { if(L.ReturnModelNo( )==modelnum) L.StockDisplay( ); } fin.close(); //Ignore } |
|
| 8. |
int main(){ char ch='A';fstream fileout("data.dat",ios::out);fileout<<ch;int p=fileour.tellg();cout<<p;return 0;}What is the output if the file content before the execution of the program is the string "ABC"?(Note that " " are not part of the file). |
|
Answer» 1 is the output if the file content before the execution of the program is the string "ABC". |
|
| 9. |
If a, b and c are integer variables with the values a=8, b=3 and c=-5. Then what is the value of the arithmetic expression:2 * b + 3 *(a-c)(A) 45(B) 6(C) -16(D) -1 |
|
Answer» Correct option - (A) 45 Explanation:- the value of the arithmetic expression is 45 as 2*3+3*(8—5)=6+3*13=6+39=45 |
|
| 10. |
Write a function in C++ to print the count of the word as an independent word in a text file STORY.TXT. For example, if the content of the file STORY.TXT is:There was a monkey in the zoo.The monkey was very naughty.Then the output of the program should be 2. |
|
Answer» void wordcount() { ifstream fil("STORY.TXT"); char word[30]; //assuming longest word can be 29 characters long int count = 0; while(!fil.eof()) { cin>>word; if((strcmp("the",word)==0) && (strcmp("The",word)==0)); count++; } fil.close(); cout<<count; } |
|
| 11. |
Write a function in C++ to count the words to and the present in a text file “POEM.TXT”.[Note. that the words “to’ and “the” are complete words.] |
|
Answer» void COUNT () { ifstream File; File. open (POEM.TXT); char Word[80] ; int Cl = 0, C2 = 0; while(!File.eof()) { File>>Word; if (strcmp (Word, to) ==0) Cl++; else if (strcmp (Word, the) ==0) C2++; } cout<<”Count of -to- in file:" <<Cl; cout<<”Count of -the- in file:”<<C2; File.close(); //Ignore |
|
| 12. |
int main(){ char ch='A';fstream fileout("data.dat",ics::app);fileout<<ch;int p=fileout.tellg();cout<<p;return 0;}What is the output if the file content before the execution of the program is the string "ABC"?(Note that " " are not part of the file). |
|
Answer» 4 is the output if the file content before the execution of the program is the string "ABC". |
|
| 13. |
A global variable is a variable (A) declared in the main ( ) function.(B) declared in any function other than the main ( ) function.(C)declared outside the body of every function.(D)declared any where in the C program. |
|
Answer» Correct option - (C)declared outside the body of every function. Explanation:- A global variable is declared outside the body of every function. |
|
| 14. |
Write a function in C++ to print the count of the word is an independent word in a text file DIALOGUE.TXT.For example, if the content of the file DIALOGUE.TXT is: This is his book. Is this good?Then the output of the program should be 2. |
|
Answer» void wordcount { ifstream fin("DIALOGUE.TXT"); char word[10]; int wc=0; while(!fin.eof()) { fin>>word; if((strcmp(word,"Is")==0)||(strcmp(word,"is")==0)) wc++; } cout<<wc; fin.close(); } |
|
| 15. |
Write a function COUNT_DO( ) in C++ to count the presence of a word „do‟ in a text file “MEMO.TXT”. Example : If the content of the file “MEMO.TXT” is as follows:I will do it, if yourequest me to do it.It would have been done much earlier.The function COUNT_DO( ) will display the following message: Count of -do- in file: 2 |
|
Answer» void COUNT_TO( ) { ifstream Fi1(“MEMO.TXT”); char STR[10]; int c=0; while(Fi1.getline(STR,10,’ ‘)) { if (strcmpi(STR, “do”) = = 0) C++; } Fi1.close( ); cout<<“Count to -do- in file: “<<c<<end1; |
|
| 16. |
Write a user defined function in C++ to read the content from a text file NOTES.TXT, count and display the number of blank spaces present in it. |
|
Answer» void countspace() { ifstream fins; fins.open("NOTES.TXT"); char ch; int count=0; while(!fins.eof()) { fin.get(ch); if(ch==' ') count++; } cout<<"Number of blank spaces"<<count; fin.close(); } |
|
| 17. |
Write a function in C++ to count the number of digits present in a text file “PARA.TXT”. |
|
Answer» void countdigit() { ifstream fil("PARA.TXT”,ios::in); int count=0; char ch=fil.get(); while(!fil.eof()) { if(isdigit(ch)) count++; ch=fil.get(); } cout<<"no of digit: "<<count<<end1; } |
|
| 18. |
Write a function in C++ to count the no of “Me” or “My” words present in a text file “DIARY.TXT”. If the file “DIARY.TXT” content is as follows:My first book was Me and My family. It gave me chance to be known the world. The output of the function should be Count of Me/My in file : 4 |
|
Answer» void COUNT( ) { ifstream Fil("DIARY. TXT"); char STR[10]; int count = 0; while(!Fil.eof( )) { Fil>>STR; if(strcmp(STR,"Me")==0||strcmp(STR,"My")==0) count++; } Cout<<"Count of Me/My in file :"<<count<<end1; Fil.close( ); //Ignore } |
|
| 19. |
Which of the following is like a copier machine and used to scan documents by placing them upside down on a glass plate?1. OMR2. Hand-held scanner3. Plotter4. Flatbed scanner |
|
Answer» Correct Answer - Option 4 : Flatbed scanner The correct answer is a Flatbed scanner.
Working of Flatbed Scanner:
|
|
| 20. |
ASCII Is used to represent characters in memory. Is it sufficient to represent all characters used in the written languages of the world ? Propose a solution. Justify. |
|
Answer» No It is not sufficient to represent all characters used in the written languages of the world because , it is a 7 bit code so it can represent 27 = 128 possible codes. To represent all the characters Unicode is used because it uses 4 bytes, so it can represent 232 possible codes. |
|
| 21. |
The numbers in column A have an equivalent number in another number system of column B. Find the exact match. A B(12)8(1110)2F1625(19)1610(11)8(13)16(17)89 |
||||||||||
|
Answer» The numbers in column A have an equivalent number in another number system of column B. Find the exact match.
|
|||||||||||
| 22. |
Fill up the missing digit. If (220)a = (90)b then (451)a = ( )10 |
||||||||
|
Answer» It contains 2 & 9, so a and b 2, b 8. The values of a can be 8 or 19. The values of b can be 10 or 16, L.H.S > R.H.S. a The possible values of a and b are given below
Let a = 8 and b = 10
ie.(220)8 ≠ (90)10 So a ≠ 8 or b ≠ 10 Case II: Let a = 8 and b = 16 (220)8 = 2x82 +2x81 + 0x80 =128+16 = (144)10 (90)16 = 9x161 + 0x160 = (144)10 So a = 8 and b = 16 Then (451)8 = 4x82 + 5x81 + 1x80 =4x64 + 5x8 + 1 256 + 40 + 1 = (297)10 |
|||||||||
| 23. |
a) Name various number systems commonly used in computers. b) Include each of the following numbers into all possible number systems |
|
Answer» a) The number system are binary, octal, decimal and hexa decimal. b) 123 Octal, decimal and hexa decimal 569 Decimal, hexa decimal 1101 Binary, Octal, Decimal, Hexa decimal |
|
| 24. |
From the following which is exit controlled loop a) for b) while c) do while d) None of these |
|
Answer» do while is exit controlled loop |
|
| 25. |
What do you mean by Utilities? |
|
Answer» Utilities are useful programs which are designed to help computer for its smooth functioning. Some utilities are back up utility, Disk defragmentation. Virus scanner, etc. It is provided by the O.S. |
|
| 26. |
Differentiate CRT and LCD (OR) Your friend going to purchase a computer. He asked you which is better, CRT or LCD? What is your opinion? |
||||||||||
|
Answer» The difference between CRT and LCD is given below:
So LCD is more better than CRT |
|||||||||||
| 27. |
Odd man out. a) Track ball b) Joy Stick c) Scanner d) LCD |
|
Answer» d) LCD. It is an output device. Others are input device |
|
| 28. |
Normally a CD contains 700 MB. Is it possible to store a file with size 1 GB? Explain. OR Normally a Car has a seating capacity of 5 persons including the driver. But some adjustments more persons can be accommodated in Car. This is connected with a utility. Which is the utility? Explain. |
|
Answer» Compression utility is used for this. By using compression utility programs we can reduce the file size upto the one third of the file size. So by using this we can reduce 1GB file and store in a CD. It is provided by the OS. The other compression utility programs are Winzip, WinRar etc. It is possible to compress the files and when needed, these com-pressed files can be uncompressed and it is restored to their original form. |
|
| 29. |
Differentiate CRT and LCD (OR) Your friend going to purchase a computer. He asked you which is better, CRT or LCD ? What is your opinion ? |
||||||||||
|
Answer» The difference between CRT and LCD is given below:
So LCD is more better than CRT. |
|||||||||||
| 30. |
______ is a brush that is used for cleaning your nails. A) hairbrush B) nail cleaner C) toothbrush D) nail brush |
|
Answer» Correct option is D) nail brush |
|
| 31. |
______ is a brush for cleaning your teeth. A) toothbrush B) hairbrush C) paintbrush D) toothpaste |
|
Answer» Correct option is A) toothbrush |
|
| 32. |
Why and by whom canals were built in England? |
|
Answer» The canals were built because they offered the most economic and reliable way to transport goods and commodities in large quantities. The navigable water network grew rapidly at first and became an almost completely connected transport network. |
|
| 33. |
The Sultan of Delhi who is reputed to have built the biggest network of canals in India was (a) Iltutmish (b) Ghiyasuddin Tughluq (c) Firuz Shah Tughluq (d) Sikandar Lodhi |
|
Answer» (c) Firuz Shah Tughluq |
|
| 34. |
Canals were initially built in England A) to irrigate the crops B) to transport coal to cities C) to develop the tourism D) to practices swimming |
|
Answer» B) to transport coal to cities |
|
| 35. |
This vegetable continue to grow even after harvesting. a. Kohlrabib. Asparagusc. Mushroomsd. Lettuce |
|
Answer» Correct answer is c. Mushrooms |
|
| 36. |
These are the fruits where outer pericarp is stiffened a. Pepo b. Hesperidium c. Drupes d. Berries |
|
Answer» Correct answer is a. Pepo |
|
| 37. |
Sugar strengthens the ________ and help the vegetable or fruit to retain its shape. a. Texture b. Alkaline c. Fibres d. Alkali |
|
Answer» Correct answer is c. Fibres |
|
| 38. |
Chronic constipation and colon cancer can be prevented with a. Vitamins b. Dietary fiber c. Minerals d. Phyto-chemical |
|
Answer» Correct answer is b. Dietary fiber |
|
| 39. |
_______ pigment is fat soluble. a. Carotenoids b. Chlorophyll c. Flavones d. Anthocyanin |
|
Answer» Correct answer is a. Carotenoids |
|
| 40. |
Why is DNA copying an essential part of the process of reproduction? |
|
Answer» DNA (Deoxyribonucleic acid) copying is an essential part of reproduction as it passes genetic information from parents to offspring. It determines the body design of an individual. The reproducing cells produce a copy of their DNA through some chemical reactions and result in two copies of DNA. The copying of DNA always takes place along with the creation of additional cellular structure. This process is then followed by division of a cell to form two cells. |
|
| 41. |
Can you think of reasons why more complex organisms cannot give rise to new individuals through regeneration? |
|
Answer» Simple organisms such as Hydra and Planaria are capable of producing new individuals through the process of regeneration. The process of regeneration involves the formation of new organisms from its body parts. Simple organisms can utilize this method of reproduction as their entire body is made of similar kind of cells in which any part of their mbody can be formed by growth and development. However, complex organisms have organ-system level of organization. All the organ systems of their body work together as an interconnected unit. They can regenerate their lost body parts such as skin, muscles, blood, etc. However, they cannot give rise to new individuals through regeneration. More complex organisms cannot give rise to new individuals because: 1. Their body design is highly complicated. 2. There are specific organs to do specific functions. 3. There is a labour division in the body of complex organisms. 4. Exception is lizard, which can regenerate its tail. |
|
| 42. |
In fungi sexual reproduction is by :- (1) Fragmentation, Ascospores and Basidiospores (2) Budding, Conidia, and Basidiospores (3) Oospores, Ascospores and Basidiospores (4) Fission, Zoospores, Oospores |
|
Answer» Correct option is (3) Oospores, Ascospores and Basidiospores |
|
| 43. |
All Michael ate was two thin ______ of bread. A) rolls B) loaves C) slices D) snacks |
|
Answer» Correct option is C) slices |
|
| 44. |
(i) large number of spores(ii) availability of moisture and nutrients in bread(iii) presence of tubular branched hyphae(iv) formation of round shaped sporangia(a) (i) and (iii) (b) (ii) and iv)(c) (i) and (ii) (d) (iii) and (iv) |
| Answer» (c) (i) and (ii) | |
| 45. |
If a woman is using a copper−T, will it help in protecting her from sexually transmitted diseases? |
|
Answer» No. Using a copper-T will not provide a protection from sexually transmitted diseases, as it does not prevent the entry of semen. It only prevents the implantation of the embryo in the uterus. |
|
| 46. |
What would be the ratio of chromosome number between an eggand its zygote? How is the sperm genetically different from the egg? |
|
Answer» The ratio is 1 : 2. Sperms contain either X or Y chromosome whereas an egg will always have an X chromosome. |
|
| 47. |
Write two points of difference between asexual and sexual types of reproduction. Describe why variations are observed in the offspring formed by sexual reproduction. |
||||
Answer»
During sexual reproduction two types of gametes fuse. Although the gametes contain the same number of chromosomes, their DNA is not identical. This situation generates variations among the offsprings. |
|||||
| 48. |
If you are provided with root-tips of onion in your class and are asked to count the chromosomes, which of the following stages can you most conveniently look into?1. Anaphase2. Propose3. Metaphase4. Telophase5. None of these. |
|
Answer» Correct Answer - Option 3 : Metaphase Before Metaphase, the centrosomes are aligned at opposite ends, or poles of the cell and chromosomes move toward the center of the cell. Metaphase is marked by the alignment of chromosomes at the center of the cell. At this stage, it is easy to distinguish and count chromosomes. |
|
| 49. |
The best design of an arch dam is when?1. All horizontal water loads are transferred horizontal to the abutments2. The dam is safe against sliding at various levels3. The load is divided between the arches and cantilevers and the deflections at the conjugal points being equal.4. The deflections of the cantilevers are equal at different points |
|
Answer» Correct Answer - Option 3 : The load is divided between the arches and cantilevers and the deflections at the conjugal points being equal. Explanation: Arch dam:
Forces in Arch Dam: 1. Temperature stresses 2. Yield stress of concrete 3. Uplift Pressure 4. Reservoir water force or Hydrostatic force |
|
| 50. |
If the vapour and liquid of a pure component are in equilibrium, the equilibrium pressure is called(a) Partial pressure(b) Vapour pressure(c) Liquid pressure(d) None of the mentioned |
|
Answer» The correct choice is (b) Vapour pressure Explanation: If the vapour and liquid of a pure component are in equilibrium, the equilibrium pressure is called Vapour pressure. |
|