cse interview q-a for placement drill

Upload: jnee91

Post on 04-Jun-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    1/97

    Sr

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    2/97

    11

    12

    13

    14

    15

    16

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    3/97

    17

    18

    19

    20

    21

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    4/97

    22

    23

    24

    25

    26

    27

    28

    29

    30

    31

    32

    33

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    5/97

    34

    35

    36

    37

    38

    39

    40

    41

    42

    43

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    6/97

    44

    45

    46

    47

    48

    49

    50

    51

    52

    53

    54

    55

    56

    57

    58

    59

    60

    61

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    7/97

    62

    63

    64

    65

    66

    67

    68

    69

    70

    71

    72

    73

    74

    75

    76

    77

    78

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    8/97

    79

    80

    81

    82

    83

    84

    85

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    9/97

    86

    87

    88

    89

    90

    91

    92

    93

    94

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    10/97

    95

    96

    97

    98

    99

    100

    101

    102

    103

    104

    105

    106

    107

    108

    109

    110

    111

    112

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    11/97

    113

    114

    115

    116

    117

    118

    119

    120

    121122

    123

    124125126127128

    129

    130

    131

    132

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    12/97

    133

    134

    135

    136

    137

    138

    139

    140

    141

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    13/97

    142

    143

    144

    145

    146

    147

    148

    149

    150

    151152

    153154

    155

    156

    157

    158

    159

    160

    161

    162

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    14/97

    163

    164

    165

    166

    167

    168

    169170171

    172173

    174

    175

    176

    177

    178

    179

    180

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    15/97

    181

    182

    183

    184

    185

    186

    187

    188

    189

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    16/97

    190

    191

    192

    193

    194

    195

    196

    197

    198199200201202

    203

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    17/97

    204

    205

    206

    207

    208

    209210

    211

    212

    213

    214

    215

    216

    217

    218

    219

    220

    221

    222

    223

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    18/97

    224

    225

    226

    227

    228

    229

    230

    231

    232

    233

    234

    235

    236237

    238

    239

    240

    241

    242

    243

    244

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    19/97

    245

    246

    247

    248

    249

    250

    251

    252

    253

    254

    255

    256

    257

    258

    259

    260

    261

    262

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    20/97

    263

    264

    265

    266

    267

    268

    269

    270

    271

    272

    273

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    21/97

    274

    275

    276

    277

    278

    279

    280

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    22/97

    281

    282

    283

    284

    285

    286

    287

    288

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    23/97

    289

    290

    291

    292

    293

    294

    295

    296

    297

    298

    299

    300

    301

    302

    303

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    24/97

    304

    305

    306

    307

    308

    309

    310

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    25/97

    311

    312

    313

    314

    315

    316

    317

    318

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    26/97

    319

    320

    321

    322

    323

    324

    325

    326

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    27/97

    327

    328

    329

    330

    331

    332

    333

    334

    335

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    28/97

    336

    337

    338

    339

    340

    341

    342

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    29/97

    343

    344

    345

    346

    347

    348

    349

    350

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    30/97

    Question (with answer)

    What is the difference between namespace and assembly?Ans. Namespace is a collection of different classes. whereas an assembly is the basic building

    blocks of the .net framework What is the difference between early binding and late binding?Ans. Calling a non-virtual method, decided at a compile time is known as early binding. Calling avirtual method (Pure Polymorphism), decided at a runtime is known as late binding.What is Intermediate Language?Ans. Microsoft Intermediate Language(MSIL or IL) is the CPU -independent instruction set intowhich .Net framework programs are compiled. It contains instructions for loading, storinginitializing, and calling methods on objects.

    What is Common Language Runtime?Ans. CLR also known as Common Language Run time provides a environment in which programare executed, it activate object, perform security check on them, lay them out in the memory,execute them and garbage collect them.What is common Type System?Ans. The common type system is a rich type system, built into the common language runtime,which supports the types and operations found in most programming language.What namespace does the webpage belong in the .NET framework class hierarchy?Ans. System.Web.UI.Page

    Ans. Increased performance. Better code management and encapsulation. It also introduces the n-tier concepts and

    What is the difference between dataset.clone and dataset.copy?Ans. Dataset.clone copies just the structure of dataset (including all the datatables, schemas,relations and constraints.); however it doesnt copy the data.Dataset.copy, copies both the dataset structure and the dataWhat is the use of Internal Keyword?Ans. Internal keyword is one of the access specifier available in .Net framework , that makes atype visible in a given assembly , for e.g : a single dll can contain multiple modules.

    How do I create frames? What is a frameset?Frames allow an author to divide a browser window into multiple (rectangular) regions. Multiple documents can bedisplayed in a single window, each within its own frame. Graphical browsers allow these frames to be scrolledindependently of each other, and links can update the document displayed in one frame without affecting the others.You can't just "add frames" to an existing document. Rather, you must create a frameset document that defines a

    particular combination of frames, and then display your content documents inside those frames. The framesetdocument should also include alternative non-framed content in a NOFRAMES element.The HTML 4 frames model has significant design flaws that cause usability problems for web users. Frames should beused only with great care.

    MOCK PLACEMENT DRILL (21-22 September 2013)Technical Interview Questions (CSE/IT)

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    31/97

    How can I include comments in HTML?Technically, since HTML is an SGML application, HTML uses SGML comment syntax. However, the full syntax iscomplex, and browsers don't support it in its entirety anyway. Therefore, use the following simplified rule to createHTML comments that both have valid syntax and work in browsers:

    An HTML comment begins with "", and does not contain "--" or ">" anywhere in the comment.

    ow com or a e are you w wr ng en re y y anVery. I dont usually use WYSIWYG. The only occasions when I do use Dreamweaver are when I want to drawsomething to see what it looks like, and then Ill usually either take that design and hand-modify it or build it all overagain from scratch in code. I have actually written my own desktop HTML IDE for Windows (its called Less ThanSlash) with the intention of deploying it for use in web development training. If has built-in reference features, and willautocomplete code by parsing the DTD you specify in the file. That is to say, the program doesnt know anything aboutHTML until after it parses the HTML DTD you specified. This should give you some idea of my skill level withHTML.

    What is a DOCTYPE? Which one do I use?According to HTML standards, each HTML document begins with a DOCTYPE declaration that specifies whichversion of HTML the document uses. Originally, the DOCTYPE declaration was used only by SGML-based tools like

    HTML validators, which needed to determine which version of HTML a document used (or claimed to use).Today, many browsers use the document's DOCTYPE declaration to determine whether to use a stricter, morestandards-oriented layout mode, or to use a "quirks" layout mode that attempts to emulate older, buggy browsers.

    Can I nest tables within tables?Yes, a table can be embedded inside a cell in another table. Here's a simple example:

    How can we embed Audio in HTML 5?TML 5 comes with a standard way of embedding audio files. Supported audio formats are MP3, Wav and Ogg.Your browser doesn't support audio embedding feature.

    What are the different types of storage in HTML 5?HTML 5 has the capability to store data locally. Previously, it was done with the help of cookies. The exciting thingabout this storage is that it's fast as well as secure.

    There are two different objects which can be used to store data: localStorage object stores data for a longer period of time even if the browser is closed. sessionStorage object stores data for a specific session.

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    32/97

    What are the new Form Elements introduced in HTML 5?There are a number of new form elements that have been introduced in HTML 5 as follows: datalist datetime output keygen date month week time number range email url

    What is the difference between HTML 5 Application Cache and regular HTML Browser Cache?One of the key features of HTML 5 is "Application Cache" that enables us to make an offline version of a webapplication. It allows to fetch few or all of website contents such as HTML files, CSS, images, JavaScript, etc. locally.

    This feature speeds up the site performance. This is achieved with the help of a manifest file defined as follows:.....As compared with traditional browser caching, it's not compulsory for the user to visit website contents to be cached.

    How do I display the current date or time in my document?With server-side includes. Ask your webmaster if this is supported, and what the exact syntax is for your server. Butthis will display the local time on the server, not for the client. And if the document is cached, the date will of course

    be incorrect after some time.JavaScript can be used to display the local time for the client, but as most people already have one or more clocks ontheir screen, why display another one?

    How do I get my visitor's e-mail addresses?You can't. Although each request for a document is usually logged with the name or address of the remote host, theactual username is almost never logged as well. This is mostly because of performance reasons, as it would require thatthe server uses the ident protocol to see who is on the other end. This takes time. And if a cache proxy is doing therequest, you don't get anything sensible.In Netscape 2.0, it was possible to automatically submit a form with a mailto as action, using Javascript. This wouldsend e-mail to the document's owner, with the address the visitor configured in the From line. Of course, that can be"[email protected]". This is fixed in Netscape 2.01.The most reliable way is to put up a form, asking the visitor to fill in his e-mail address. If you offer him something in

    return, he will most likely do it.

    Is there a way to get indexed better by the search engines?Yes. Put these two statements in the part of your documents:

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    33/97

    Should I use lower case or upper case for tags?Tags are case insensitive, so it doesn't matter. This is just a matter of style. Many people prefer upper case, as it makesthe tags "stand out" better amongst the text.

    Should I put quotes around attribute values or not?It depends. It is never wrong to use them, but you don't have to if the attribute value consists only of letters, digits,

    periods and/or hyphens. This is explained in the HTML 2.0 specs.Oh, and keep in mind that if you use double quotes, you should escape any quotes inside the value with """ soyou don't accidentally terminate the value prematurely.

    How do I get a button which takes me to a new page?This is done with a small form:

    Which tag is used to display a webpage inside another webpage in HTML?

    IframeHTML Form Events ___________, fires the moment that the element loses focus.-onblur

    What is cell padding?-Used to separate cell walls from their contents.What is the difference between XML and HTML?Define graph matrix and connection matrix.Answer: Graph matrix: A graph matrix is a square matrix whose size(i.e., number of rows and columns) is equal tothe number of nodes on the flow graph. Each row and column corresponds to an identified node, and matrix entriescorrespond to connections (an edge) between nodes.Connection matrix: In connection matrix, each letter has been replaced with a 1, indicating that a connection exists(zeros have been excluded for clarity).

    Name any Maintenance Model.Answer: Quick-fix Model: This is the simplest model used for the maintenance of the software. In this model changesat the code level are made as early as possible without anticipating future maintenance problems.

    What is the difference between software engineering and system engineering?Answer: Software Engineering - is concerned with all aspects of computer based systems development includinghardware, software and process engineering.System Engineering - are involves in system specification architectural design intergration and deployment.

    What is winwinspiral model?Answer: Winwin spiral model defines a set of negotiation activities at the beginning of each pass around the spiral.The best negotiations strive for a win-win result.

    What do you mean by the term Hybrid Design?Answer: Hybrid design: Pure top-down or pure bottom up approaches are often not practical therefore hybrid approachwhich combines the above two approaches is often used

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    34/97

    What is stepwise refinement?Answer: -Stepwise Refinement is a top-down design strategy originally proposed by Niklaus Wirth. A program isdeveloped by successively refining levels of procedural detail. A hierarchy is developed by decomposing amacroscopic statement of function in a stepwise fashion until programming language statements are reached.

    a s e our ma ur y eve oAnswer: Managed (maturity level 4)-At this level, the organization sets quantitative quality goals for both software

    products and processes. Productivity and quality are measured for important software process activities across all projects as part of an organizational measurement program. The software process capability at level 4 organizationscan be summarized as predictable .

    Answer: Cyclomatic complexity is a software metric that provides a quantitative measuer of the logical complexity of a

    program.

    What is Data Dictionary?Answer: Data dictionary is a storehouse of data giving information about data. It is a list of terms and their definitionfor all data items and data files of a system. A data dictionary contains descriptions and definitions concerning the datastructure, data elements, their interrelationships and other characteristics of a system.

    Explain Equivalence Class Partitioning.Answer: It is a technique in black box testing. It is designed to minimize the number of test cases by dividing tests insuch a way that the system is expected to act the same way for all tests of each equivalence partition. Test inputs areselected from each class. Every possible input belongs to one and only one equivalence partition."

    What is reverse engineering?Answer: It is a process of analysing software with a view to understanding its design and specification. - In reverseengineering, source code and executable code are the input. - It may be part of a re-engineering process but may also beused to re- specify a system for re-implementation.

    What is meant by loop testing?Answer: Loop testing is a white box testing techniques that focuses exclusively on the validity of loop constructs. Thistechnique can be applied to simple loops, nested loops, concatenated loops and unstructured loops.

    What is adaptive maintenance?Answer: Adaptive maintanence is the maintenance to adapt software to a different operating environment. It involveschanging a system so that it operates in a different environment from its initial implementation.

    Define Throwaway Prototyping?Answer: Throw-Away Prototyping: Also called close ended prototyping. Throwaway or Rapid Prototyping refers tothe creation of a model that will eventually be discarded rather than becoming part of the final delivered software.

    What is white box testing?Answer: White box testing is a test case design method that uses the control structure of the procedural design toderive test cases. It is otherwise called as structural testing

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    35/97

    What are the categories of software?

    Answer:System software, Application software, embedded software, Web Applications, Artificial Intelligencesoftware, scientific software.

    Answer: Verification refers to the set of activities that ensure that software correctly implements a specific function.Validation refers to the set of activities that ensure that the software that has been built is traceable to customerrequirements.

    a s

    Answer: Software cycle deals with various parts and phases from planning to testing and deploying. All these activitiesare carried out in different ways, as per the needs. Each way is known as a Software Development Lifecycle Model(SDLC)

    When is a switch statement better than multiple if statements?Answer: A switch statement is generally best to use when you have more than two conditional expressions based on asingle variable of numeric type.

    How we can print "Hello World" without using semicolon in c programAnswer: if we write the printf function inside the if block structure eg : if(printf("Hello World"));what printf library function returns ?Answer: printf functions is having int return type which is used to return number of elements which is printedwhich header file is used to define a function in c programming which can have variable number of argumentsAnswer: stdarg.hhow we can achieve run time polymorphism in C++Answer: we can achieve run time polymorphism with the use of virtual function in base class in C++what is dangling pointer?Answer: Dangling pointer is referred to that pointer which points to deallocated memory locationLibrary function which is used to convert string value into int valueAnswer: atoi () , the function is defined in header file is stdlib.hHow the overriding is different than overloading ?Answer: Overriding is achieved using redefine the base class into derived class but overloading is achieve using two ormore functions with same name and different arguments

    Answer: Diamond problem is ambiguity problem of hybrid inheritance, this ambiguity can be resolved using virtual

    Answer: argc stands for number of arguments including executable file name, argv stands for argument vector(set of

    why we create reference object in the argument of copy contructor ? Answer: if we create copy constructor without reference ,in that it will result into infinite execution of copyconstructor.so to avoid infinite execution, we create reference object in the argument of copy constructor can we call any class member function without using object of the class

    Answer: Yes, we can call static member function without using object.static member function can be executed with thehelp of class itself.Give 3 uses of scope resultion operator ( :: ) in C++Answer: 1) to define member function of the outside the class 2)to define static data member outside the class 3) toaccess static member function with classname 4) to access global variablewhat is importance of this pointerAnswer: this object always refers to self object.which is used to access data member as well as this object is used toreturn self object from the member functionwrite the statements which are used to swap two variables without using 3rd variable and without using airthematic ope

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    36/97

    Answer: Polymorphism is the property of C++ , by which we can use same name functions/operators with different

    purposes.compile time polymorphism(functions overloading,operator overloading ) run time polymorphism(virtual

    how can we change the const variable value in the program?Answer: We can change the const variables value with the help of pointers only.how type conversion is different than type casting ?Answer: Generally type casting works with basic data types like int to float or vice versa, Type casting mathod is notapplicable with user defined data types, so type conversion method is used with user defined data types conversion(like

    basic to user defined, user defined to basic and user defined 1 to user defined 2)list the operators which cant be overloaded ?Answer: 1) :: 2) .* 3). 4)sizeof 5) ?:which operator can replace the if statement in the program?Answer: conditional operator ( ?:)what is the role of abstract class in c++Answer: Abstract class,is the class which is having minimum one pure virtual function inside its definition.Abstractclass is no having any object with it.what is the return type of malloc and calloc function and in which header file they are definedAnswer: return type of memory functions are generic pointer(Void *) and they are defined in stdlib.h header file

    what is use of sscanf() functionAnswer: sscanf function is used to convert string value into any other data type value based on the format specifer?which is having more precedence between pre increment and post increment operatorAnswer: post increment operator When is a switch statement better than multiple if statements?Answer: A switch statement is generally best to use when you have more than two conditional expressions based on asingle variable of numeric type.What is the output of printf("%d")?Answer: When we write printf("%d",x); this means compiler will print the value of x. But as here, there is nothingafter %d so compiler will show in output window garbage value.

    ... ...Answer: . calloc(...) allocates a block of memory for an array of elements of a certain size. By default the block is

    initialized to 0. The total number of memory allocated will be (number_of_elements * size).malloc(...) takes in only asingle argument which is the memory required in bytes. malloc(...) allocated bytes of memory and not blocks of

    What is the difference between "printf(...)" and "sprintf(...)"?Answer: sprintf(...) writes data to the character array whereas printf(...) writes data to the standard output device.How to reduce a final size of executable?Answer: Size of the final executable can be reduced using dynamic linking for libraries.

    Answer: 1. If you declare within a function It retains the value between function calls 2.If it is declared for a functionname:By default function is extern..so it will be visible from other files if the function declaration is as static..it is invisiblefor the outer files 3. Static for global variables:

    What are the advantages of a macro over a function?Answer: Macro gets to see the Compilation environment, so it can expand __ __TIME__ __FILE__ #defines. It isexpanded by the preprocessor.

    What are the differences between malloc() and calloc()?Answer: First, is in the number of arguments. malloc() takes a single argument(memory required in bytes), whilecalloc() needs 2 arguments(number of variables to allocate memory, size in bytes of a single variable).

    Secondly, malloc() does not initialize the memory allocated, while calloc() initializes the allocated memory to ZERO.

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    37/97

    What is the difference between strings and character arrays?Answer: A major difference is: string will have static storage duration, whereas as a character array will not, unless it isexplicity specified by using the static keyword

    What is the difference between const char* p and char const* p?Answer: In const char* p, the character pointed by p is constant, so u cant change the value of character pointed by p

    but u can make p refer to some other location.

    In char const* p, the ptr p is constant not the character referenced by it, so u cant make p to reference to any otherlocation but u can change the value of the char pointed by p.

    What is hashing?Answer: To hash means to grind up, and thats essentially what hashing is all about. The heart of a hashing algorithmis a hash function that takes your nice, neat data and grinds it into some random-looking integer.

    The idea behind hashing is that some data either has no inherent ordering (such as images) or is expensive to compare(such as images). If the data has no inherent ordering, you cant perform comparison searches.

    an s a c var a es e ec are n a ea er eAnswer: You cant declare a static variable without defining it as well (this is because the storage class modifiersstatic and extern are mutually exclusive). A static variable can be defined in a header file, but this would cause eachsource file that included the header file to have its own private copy of the variable, which is probably not what wasintended.

    Can a variable be both const and volatile?Answer: Yes. The const modifier means that this code cannot change the value of the variable, but that does not meanthat the value cannot be changed by means outside this code.

    Can include files be nested?Answer: Yes. Include files can be nested any number of times. As long as you use precautionary measures , you canavoid including the same file twice. In the past, nesting header f iles was seen as bad programming practice, because itcomplicates the dependency tracking function of the MAKE program and thus slows down compilation. Many oftodays popular compilers make up for this difficulty by implementing a concept called precompiled headers, in whichall headers and associated dependencies are stored in a precompiled state.

    What is a null pointer?

    Answer: There are times when its necessary to have a pointer that doesnt point to anything. The macro NULL,defined in , has a value thats guaranteed to be different from any valid pointer. NULL is a literal zero, possibly cast tovoid* or char*. Some people, notably C++ programmers, prefer to use 0 rather than NULL.

    The null pointer is used in three ways:

    1) To stop indirection in a recursive data structure

    2) As an error value3) As a sentinel value

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    38/97

    What is the difference between text and binary modes?Answer: Streams can be classified into two types: text streams and binary streams. Text streams are interpreted, with amaximum length of 255 characters. With text streams, carriage return/line feed combinations are translated to thenewline n character and vice versa. Binary streams are uninterrupted and are treated one byte at a time with notranslation of characters. Typically, a text stream would be used for reading and writing standard text files, printingoutput to the screen or printer, or receiving input from the keyboard.

    A binary text stream would typically be used for reading and writing binary files such as graphics or word processingdocuments, reading mouse input, or reading and writing to the modem.

    What is static memory allocation and dynamic memory allocation?Answer: Static memory allocation: The compiler allocates the required memory space for a declared variable.By usingthe address of operator,the reserved address is obtained and this address may be assigned to a pointer variable.Sincemost of the declared variable have static memory,this way of assigning pointer value to a pointer variable is known asstatic memory allocation. memory is assigned during compilation time.

    When should a far pointer be used?Answer: Sometimes you can get away with using a small memory model in most of a given program. There might be

    just a few things that dont fit in your small data and code segments.

    How are pointer variables initialized?Answer: Pointer variable are initialized by one of the following two ways

    - Static memory allocation- Dynamic memory allocation

    Answer: Pointers are used to manipulate data using the address. Pointers use * operator to access the data pointed to bythem

    - Arrays use subscripted variables to access and manipulate data. Array variables can be equivalently written using

    Is using exit() the same as using return?Answer: No. The exit() function is used to exit your program and return control to the operating system. The returnstatement is used to return from a function and return control to the calling function. If you issue a return from themain() function, you are essentially returning control to the calling function, which is the operating system. In this case,the return statement and exit() function are similar.

    What is indirection?Answer: If you declare a variable, its name is a direct reference to its value. If you have a pointer to a variable, or anyother object in memory, you have an indirect reference to its value.

    What is modular programming?Answer: If a program is large, it is subdivided into a number of smaller programs that are called modules orsubprograms. If a complex problem is solved using more modules, this approach is known as modular programming.How many levels deep can include files be nested?Answer: Even though there is no limit to the number of levels of nested include files you can have, your compilermight run out of stack space while trying to include an inordinately high number of files. This number varies accordingto your hardware configuration and possibly your compiler.

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    39/97

    a s an va ueAnswer: An lvalue is an expression to which a value can be assigned. The lvalue expression is located on the left sideof an assignment statement, whereas an rvalue is located on the right side of an assignment statement. Each assignmentstatement must have an lvalue and an rvalue. The lvalue expression must reference a storable variable in memory. It

    Differentiate between an internal static and external static variable?Answer: An internal static variable is declared inside a block with static storage class whereas an external staticvariable is declared outside all the blocks in a file.An internal static variable has persistent storage, block scope and no

    linkage.An external static variable has permanent storage,file scope and internal linkage.What is a void pointer?Answer: A void pointer is a C convention for a raw address. The compiler has no idea what type of object a voidPointer really points to. If you write int *ip; ip points to an int. If you write void *p; p doesnt point to a void!

    Answer: A type cast should not be used to override a const or volatile declaration. Overriding these type modifiers cancause the program to fail to run correctly. A type cast should not be used to turn a pointer to one type of structure ordata type into another. In the rare events in which this action is beneficial, using a union to hold the values makes the

    Answer:A static function is a function whose scope is limited to the current source file. Scope refers to the visibility of afunction or variable. If the function or variable is visible outside of the current source file, it is said to have global, orexternal, scope. If the function or variable is not visible outside of the current source file, it is said to have local, or

    Differentiate between a linker and linkage?Answer: A linker converts an object code into an executable code by linking together the necessary build in functions.The form and place of declaration where the variable is declared in a program determine the linkage of variable.When is a switch statement better than multiple if statements? Answer: A switch statement is generally best to usewhen you have more than two conditional expressions based on a single variable of numeric type.What is the difference between declaration and definition? Answer: The declaration tells the compiler that at somelater point we plan to present the definition of this declaration.The definition contains the actual implementation.

    .development. It encourages the reuse of proven and debugged high-quality software, thus reducing problem after a

    a called function at the point where the function is called. If done carefully, this can improve the applications performance in exchange for increased compile time and possibly (but not always) an increase in the size of the

    What is a template? Answer: Templates allow creating generic functions that admit any data type as parameters andreturn value without having to overload the function with all the possible data types

    free() are functions.no need of allocate the memory while using new but in malloc() we have to use sizeof() .new will initlize the new memory to 0 but malloc() gives random value in the new alloted memory location [better

    What is namespace? Answer: Namespaces allow us to group a set of global classes, objects and/or functions under aname. To say it somehow, they serve to split the global scope in sub-scopes known as namespaces.What is the word you will use when defining a function in base class to allow this function to be a polimorphicfunction? Answer: virtual

    What is a scope resolution operator? Answer: A scope resolution operator (::), can be used to define the memberfunctions of a class outside the class.

    an index variable to traverse the array, accessing each element with the same expression a[i]. All the is needed to makethis work is a iterated statement in which the variable i serves as a counter, incrementing from 0 to a.length -1That is

    What is the difference between macro and inline? Answer: Inline follows strict parameter type checking, macros donot.Macros are always expanded by preprocessor, whereas compiler may or may not replace the inline definitions.

    Name some pure object oriented languages? Answer: Smalltalk, Java,Effel,Sather

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    40/97

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    41/97

    What is the difference between declaration and definition?What is the difference between declaration and definition?Answer: The declaration tells the compiler that at some later point we plan to present the definition of this declaration.

    E.g.: void stars () //function declarationThe definition contains the actual implementation.E.g.: void stars () // declarator {

    for(int j=10; j > =0; j--) //function bodycout

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    42/97

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    43/97

    A class object can be static or public? That is, it can be created once, when the control reaches its declaration, anddestroyed when the program terminates. Answer: StaticIn C++,Which keyword can you use with a variable so that when fuction is called by reference and still prevent thefunction from changing its value. Answer: constHow many destructors can a class have? Answer: 1Out of fgets() and gets() which function is safe to use and why?

    Answer: fgets() is safer than gets(), because we can specify a maximum input length. Neither one is completely safe, because the compiler cant prove that programmer wont overflow the buffer he pass to fgets ().

    . binding occurs when all information needed to call a function is known at compile time. Examples of early bindinginclude normal function calls, overloaded function calls, and overloaded operators. The advantage of early binding is

    How many characters are recognized by ANSI C++? Answer: no limitThe null character will take space of Answer: 1 byteKeywords support dynamic method of resolution is Answer: Virtual

    Destructor can have following number of argument Answer: 0 Name the operators that cannot be overloaded? Answer: sizeof, ., .*, .->, ::, ?:What is class invariant? Answer: A class invariant is a condition that defines all valid states for an object. It is a logicalcondition to ensure the correct working of a class. Class invariants must hold when an object is created, and they must

    be preserved under all operations of the class. In particular all class invariants are both preconditions and post-conditions for all operations or member functions of the class.What is a dangling pointer? Answer: A dangling pointer arises when you use the address of an object after its lifetimeis over. This may occur in situations like returning addresses of the automatic variables from a function or using theaddress of the memory block after it is freed.What do you mean by late binding? Answer: Late binding refers to function calls that are not resolved until run time.Virtual functions are used to achieve late binding. When access is via a base pointer or reference, the virtual functionactually called is determined by the type of object pointed to by the pointer.

    Whats the difference between these two declarations? Ans: struct x1 { };typedef struct { } x2; Answer: The first form declares a structure tag; the second declares a typedef. The maindifference is that the second declaration is of a slightly more abstract type.its users dont necessarily know that it is astructure, and the keyword struct is not used when declaring instances of it.

    Why doesnt this code: a[i] = i++; work?

    Answer: The subexpression i++ causes a side effect.it modifies is value.which leads to undefined behavior since i is also referenced elsewhere in the same expression.

    Differentiate between a constant pointer and pointer to a constant?

    Answer: const char *p; //pointer to a const character.char const *p; //pointer to a const character.char * const p; //const pointer to a char variable.const char * const p; // const pointer to a const character.

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    44/97

    How are structure passing in functions and returning implemented? Answer: When structures are passed as argumentsto functions, the entire structure is typically pushed onthe stack, using as many words as are required. Some compilers merely pass a pointer to the structure, though they mayhave to make a local copy to preserve pass-by-value semantics.Structures are often returned from functions in a location pointed to by an extra,compiler-supplied hidden argumentto the function. Some older compilers used a special,static location for structure returns, although this made structure-valued functions non-reentrant, which ANSI C disallows.

    Is the allocated space within a function automatically deallocated when the function returns?

    Answer: No pointer is different from what it points to .Local variables including local pointersvariables in a function are deallocated automatically when function returns.,But in case of alocal pointer variable ,deallocation means that the pointer is deallocated and not the block of memory allocated to it. Memory dynamically allocated always persists until the allocation is freedor the program terminates.

    What are the advantages of using array of pointers to string instead of an array of strings?

    Answer: i) Efficient use of memory.ii) Easier to exchange the strings by moving their pointers while sorting.

    Are the expressions *ptr ++ and ++ *ptr same?

    Answer: No,*ptr ++ increments pointer and not the value pointed by it. Whereas ++ *ptr increments the value being pointed to by ptr.

    What would be the equivalent pointer expression foe referring the same element asa[p][q][r][s] ?

    Answer: *( * ( * ( * (a+p) + q ) + r ) + s)

    Are the variables argc and argv are always local to main?

    Answer: Yes they are local to main.Can main () be called recursively? Answer: YesHow is a file closed ? Answer: A file is closed using fclose() functionEg. fclose(fp);Where fp is a f ile pointer.

    What is the purpose of ftell ? Answer: The function ftell() is used to get the current file represented by the file pointer.ftell(fp);returns a long integer value representing the current file position of the file pointed by thefile pointer fp.If an error occurs ,-1 is returned.

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    45/97

    Difference between an array of pointers and a pointer to an array?

    Answer: Array of pointers1- Declaration is: data_type *array_name[size];2-Size represents the row size.3- The space for columns may be dynamically

    Pointers to an array1-Declaration is data_type ( *array_name)[size];2-Size represents the column size.

    Can a Structure contain a Pointer to itself?

    Answer: Yes such structures are called self-referential structures.

    How many ways are there to initialize an int with a constant?

    Answer: There are two formats for initializers in C++ as shown in the example that follows. The first format uses thetraditional C notation. The second format uses constructor notation.int foo = 123;int bar (123);

    .does not use an explicit constructor to implement an implied conversion of types. Its purpose is reserved explicitly forconstruction.

    What do you mean by virtual methods? Answer: virtual methods are used to use the polymorphism feature in C++. Sayclass A is inherited from class B. If we declare say function f() as virtual in class B and override the same function inclass A then at runtime appropriate method of the class will be called depending upon the type of the object.

    ,called modules or subprograms. If a complex problem is solved using more modules, this approach is known asmodular programming.

    What is a Null object? Answer: It is an object of some class whose purpose is to indicate that a real object of that classdoes not exist. One common use for a null object is a return value from a member function that is supposed to return anobject with some specified properties but cannot find such an object.

    When is a switch statement better than multiple if statements? Answer: A switch statement is generally best to usewhen you have more than two conditional expressions based on a single variable of numeric type. Specify the 2 library functions to dynamically allocate memory? Answer: malloc() and calloc()Which function reads at most next n-1 characters into the array and stops if a newline is encountered. Answer: fgets. Which function we use in order to find the current file position Answer: ftell.What is the difference between a structure and a union? Answer: The way memory is allocatedWhat is the use of sprintf() Answer: used in strings just like printf()

    an underscore followed by a capital letter are reserved for use by the compiler or standard library functions wherever

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    46/97

    ,switch statements for error- or logic-checking purposes. For instance, the following switch statement is perfectly

    statement does not require a break statement at the end, you should add break statements to all cases of the switchstatement, including the last case. You should do so primarily because your program has a strong chance of beingmaintained by someone other than you who might add cases but neglect to notice that the last case has no break

    What is the difference between goto and long jmp( ) and setjmp()? Answer: A goto statement implements a local jumpof program execution, and the longjmp() and setjmp() functions implement a nonlocal, or far, jump of programexecution. Generally, a jump in execution of any kind should be avoided because it is not considered good

    programming practice to use such statements as goto and longjmp in your program.Can an array be an lvalue? Answer: he answer to this question is no, because an array is composed of several separatearray elements that cannot be treated as a whole for assignment purposes. The following statement is therefore illegal:Can include files be nested? Answer: Yes. Include files can be nested any number of times. As long as you use

    precautionary measures , you can avoid including the same file twice.

    Which bit wise operator is suitable for turning off a particular bit in a number? Answer: The bitwise AND operator Can the sizeof operator be used to tell the size of an array passed to a function? Answer: No. There's no way to tell, atruntime, how many elements are in an array parameter just by looking at the array parameter itself. Remember, passing

    an array to a function is exactly the same as passing a pointer to the first element. This is a Good Thing. It means that passing pointers and arrays to C functions is very efficient.Is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name? Answer: It'seasier for a C compiler to generate good code for pointers than for subscripts.When is a null pointer used? Answer: To stop indirection in a recursive data structure.As an error value.When should the register modifier be used? Does it really help? Answer: The register modifier hints to the compilerthat the variable will be heavily used and should be kept in the CPU's

    how large or small a number that a particular type can hold is to use the values defined in the ANSI standard header

    ,converted to the smallest type that can hold both values. The result has the same type as the two operands wind up

    What is the difference between declaring a variable and defining a variable? Answer: Declaring a variable meansdescribing its type to the compiler but not allocating any space for it. Defining a variable means declaring it and alsoallocating space to hold the variable.What is the benefit of using const for declaring constants? Answer: The benefit of using the const keyword is that thecompiler might be able to make optimizations based on the knowledge that the value of the variable will not change. Inaddition, the compiler will try to ensure that the values won't be changed inadvertently.How do I determine whether a character is numeric, alphabetic, and so on? Answer: The header file ctype.h definesvarious functions for determining what class a character belongs to.What is a "locale"? Answer: A locale is a description of certain conventions your program might be expected to followunder certain circumstances. It's mostly helpful to internationalize your program.Is there a way to jump out of a function or functions? Answer: The standard library functions setjmp() and longjmp()are used to provide a goto that can jump out of a function or functions

    a s e erence e ween rea oc an ree nswer: e ree su rou nefrees a block of memory previously allocated by the malloc subroutine. Undefined results occur if the Pointer

    parameter is not a valid pointer. If the Pointer parameter is a null value, no action will occur. The realloc subroutinechanges the size of the block of memory pointed to by the Pointer parameter to the number of bytes specified by theSize parameter and returns a new pointer to the block. The pointer specified by the Pointer parameter must have beencreated with the malloc, calloc, or realloc subroutines and not been deallocated with the free or realloc subroutines.

    What is the difference between declaration and definition Answer: The declaration tells the compiler that at some later point we plan to present the definition of this declaration .The definition contains the actual implementation.

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    47/97

    ,(or function) in C++ is the ability for functions of the same name to be defined as long as these methods have differentsignatures (different set of parameters). Method overriding is the ability of the inherited class rewriting the virtual

    What is the benefit of constructor? Answer: Constructor eases our task by assigning values to object data membersat the time of their declaration.

    .space. This namespace keyword assigns a distinct name to a library that allows other libraries to use the same identifier

    names without creating any name collisions. Furthermore, the compiler uses the namespace signature forWhat is the difference between class and structure in C++ ? Answer: There is only one difference i.e bydefault data members and member functions are public in structure and in class they are private.What is virtual class and friend class? Answer: Friend classes are used when two or more classes aredesigned to work together and need access to each other's implementation in ways that the rest of the world shouldn't

    be allowed to have. In other words, they help keep private things private. For instance, it may be desirable for classDatabase Cursor to have more privilege to the internals of class Database than main() has.What is the word you will use when defining a function in base class to allow this function to be a polimorphicfunction? Answer: Virtual

    .

    called function at the point where the function is called. If done carefully, this can improve the application's performance in exchange for increased compile time and possibly (but not always) an increase in the size of the

    What is multiple inheritance? Answer: A class can inherit properties from more than one class which is known asmultiple inheritanceWhat do you mean by reference variable in c++? Answer: A reference variable provides an alias to a previouslydefined variable. Data -type & reference-name = variable nameWhat do you mean by implicit conversion? Answer: Whenever data types are mixed in an expression then c++

    performs the conversion automatically. Here smaller type is converted to wider type. Example : in case of integer andfloat integer is converted into f loat type.what is the use of virtual destructor in c++? Answer: A destructor is automatically called when the object is destroyed.A virtual destructor in C++ is used primarily to prevent resource leaks by performing a clean-up of the object.

    same name is given to different function. While overloading a function, the return type of the functions need to be theWhat are the advantages of inheritance? Answer: Code reusability , Saves time in program development. What is a dynamic constructor? Answer: The constructor can also be used to allocate memory while creating objects.Allocation of memory to objects at the time of their construction is known as dynamic construction of objects.Thememory is allocated with the help of the new operator.What is a scope resolution operator? Answer: A scope resolution operator (::), can be used to define the memberfunctions of a class outside the class.What is this pointer? Answer: It is a pointer that points to the current object. This can be used to access the membersof the current object with the help of the arrow operator.Can destructor be private? Answer: Yes destructors can be private. But according it is not advisable to havedestructors to be private.

    What is the difference between a copy constructor and an overloaded assignment operator? Answer: A copyconstructor constructs a new object by using the content of the argument object. An overloaded assignment operatorassigns the contents of an existing object to another existing object of the same class.

    private, these could not be accessed from outside the same class at which they are declared. This rule can betransgressed with the use of the friend keyword in a class, so we can allow an external function to gain access to the

    . binding occurs when all information needed to call a function is known at compile time. Examples of early bindinginclude normal function calls, overloaded function calls, and overloaded operators. The advantage of early binding is

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    48/97

    Is it better to create a thread or a child process for doing a task? Why?Ans: Thread. Because threads share resourcesWhat is the difference between preemptive and non- preemptive scheduling?Ans: Preemptive Any process keeps control of CPU until it is finished

    Non preemptive a higher priority process takes away the CPU from a lower priority processthat was using itHow resource allocation graph can help to solve the deadlock problem?Ans: A cycle in graph means deadlock else notWhat is swapping?Ans: Moving out processes from the main memory to the backing store and from backing storeto main memory.What is thrashing?Ans: when the system spends more time in paging than executing and the performance drops toalmost zero is called paging.How paging helps to improve system performance?Ans: By paging only those pages are brought into memory that are required and those areremoved which will not be required immediately.What is the need of process synchronization? Give a practical example

    Ans: Bank transaction. If one draws Rs. 100 and the other deposits Rs. 100 (in any order) thenthe resulting amount should the same as before the transactions. This can only be done if onereads the value after the other has finished.What is the reason behind calling a long term scheduler long term scheduler?Ans: Because it is called less frequently as compared to short term scheduler Differentiate between internal and external fragmentation.Ans: Internal when memory is wasted within a partitionExternal when memory is wasted as a wholeCalculate waiting time using SJF (preemptive)Ans: Student can give any exampleWhich threading model is used in Windows?Ans: Many to manyWhat is locality of reference?Ans: is a phenomenon describing the same value, or related storage locations, being frequentlyaccessedExplain Belady's Anomaly.Ans: Even on increasing the number of frames the page fault increases but it should havedecreased.What is a binary semaphore? What is its use?Ans: semaphore can have a value 0 or 1. It is used to solve critical section problemList the Coffman's conditions that lead to a deadlock.Ans: Mutual exclusion, hold and wait, no preemption and circular waitWhat is the Translation Lookaside Buffer (TLB)?

    Ans: Is a hardware cache memory that stores a part of the page table for faster referenceWhen is a system in safe state?Ans: When allocation of resources to a requesting process will not lead to a deadlock What are local and global page replacements?Ans: GLOBAL REPLACEMENT: All pages in the system are viewed as a common poolLOCAL REPLACEMENT: Each process is assigned a pool of pages, termed the "working set."When a process needs a page, the page comes from its own pool.

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    49/97

    What are demand-paging and pre-paging?Pre-paging bring into memory at one time all the pages that will be needed.Demand paging bring into memory those pages that are requested.What is cycle stealing?Cycle stealing is a method of accessing RAM without interfering with the CPU. It is similar toDMA for allowing I/O controllers to read or write RAM without CPU interventionWhat is busy waiting?Ans: When a process wastes CPU cycles in just checking on the value of semaphore variable thatit is TRUE or FALSEWhat is the difference between a JDK and a JVM?JDK is Java Development Kit which is for development purpose and it includes execution environment also. But JVMis purely a run time environment and hence you will not be able to compile your source files using a JVM.

    What is the return type of a constructor? Are the constructors inherited? Can we make a constructor final?Constructors dont have any return type. Constructors are never inherited. And we cant create a final constructor.

    What is Exception chaining in Java?Exception chaining is a popular exception handling concept in Java, where another exception is thrown in response of

    an exception and creating a chain of Exceptions. This technique mostly used to wrap a checked exception into anunchecked or RuntimeException. By the way if you are throwing new exception due to another exception then alwaysinclude original exception so that handler code can access root cause by using methods like getCause() and initCause().

    a s erence n na , na ze an na y eywor n avaAnother classic interview question in core Java, this was asked to one of my friend on his telephonic interview for coreJava developer with Morgan Stanley. final and finally are keyword, while finalize is method. final keyword is veryuseful for creating a Immutable class in Java By making a class final, we prevent it from being extended, similarly bymaking a method final, we prevent it from being overridden,. On the other hand, finalize() method is called by garbagecollector, before that object is collected, but this is not guaranteed by Java specification. finally keyword is the onlyone which is related to error and exception handling and you should always have finally block in production code forclosing connection and resources.

    Can there be an abstract class with no abstract methods in it?Yes, there can be an abstract class without abstract methods.

    What is the difference between private, protected, and public?Public: accessible to all classesPrivate: accessible only to the class to which they belongProtected: accessible to the class to which they belong and any subclasses.

    Define static variable, instance variable and local variable.Variables defined inside methods, constructors or blocks are called local variables. The variable will be declared andinitialized within the method and it will be destroyed when the method has completed. Instance variables are variables

    within a class but outside any method. These variables are instantiated when the class is loaded. Static or classvariables are variables declared with in a class, outside any method, with the static keyword.

    Difference between Swing and Awt?AWT are heavy-weight componenets. Swings are light-weight components. Hence swing works faster than AWT.

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    50/97

    What do you mean by platform independence? What is the difference between platform-independence and portability?Platform independence means that we can write and compile the java code in one platform (eg Windows) and canexecute the class in any other supported platform eg (Linux,Solaris,etc).Portability is the ability to execute a program in any platform by either making some changes on it and recompilingwhere as platform-independence is to execute a program anywhere without recompiling it.

    What's the difference between the methods sleep() and wait()

    The code sleep(1000); puts thread aside for exactly one second. The code wait(1000), causes a wait of up to onesecond. A thread could stop waiting earlier if it receives the notify() or notifyAll() call. The method wait() is defined inthe class Object and the method sleep() is defined in the class Thread.

    What is Singleton class?Singleton class control object creation, limiting the number to one but allowing the flexibility to create more objects ifthe situation changes.

    What is the difference between an Interface and an Abstract class?

    An abstract class can have instance methods that implement a default behavior. An Interface can only declareconstants and instance methods, but cannot implement default behavior and all methods are implicitly abstract. Aninterface has all public members and no implementation. An abstract class is a class which may have the usual flavorsof class members (private, protected, etc.), but has some abstract methods.3. Describe synchronization in respect to multithreading?With respect to multithreading, synchronization is the capability to control the access of multiple threads to sharedresources. Without synchonization, it is possible for one thread to modify a shared variable while another thread is inthe process of using or updating same shared variable. This usually leads to significant errors.

    What is difference between Checked and Unchecked Exception in Java ?This is another popular Java Exception interview question appears in almost all level of Java interviews. Maindifference between Checked and Unchecked Exception lies in there handling. Checked Exception requires to behandled at compile time using try, catch and finally keywords or else compiler will flag error. This is not a requirementfor Unchecked Exceptions. Also all exceptions derived from java.lang.Exception classes are checked exception,exception those which extends RuntimeException, these are known as unchecked exception in Java.

    What is difference between throw and throws keyword in Java?One more Java Exception interview questions from beginners kitty. throw and throws keyword may look quite similar,especially if you are new to Java programming and haven't seen much of it. Though they are similar in terms that bothare used in Exception handling, they are different on how and where they are used in code. throws keyword is used inmethod signature to declare which checked exception method can throw, you can also declare unchecked exception,

    but that is not mandatory by compiler. This signifies lot of things like method is not going to handle Exception insteadits throwing it, if method throws checked Exception then caller should provide compile time exception handling etc.

    On the other hand throw keyword is actually used to throw any Exception.

    String objects are immutable what do you mean by this statement?The String class is immutable, so that once it is created a String object cannot be changed. Since String is immutable itcan safely be shared between many threads ,which is considered very important for multithreaded programming.

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    51/97

    What is an Iterator? How it is different from ListIterator?Some of the collection classes provide traversal of their contents via a java.util.Iterator interface. This interface allowsyou to walk through a collection of objects, operating on each object in turn. Remember when using Iterators that theycontain a snapshot of the collection at the time the Iterator was obtained; generally it is not advisable to modify thecollection itself while traversing an Iterator.Using iterator we can move or traverse only in the forward direction but listIterator proides the methods to traverse thecollection in both forward and backward directions.

    Is it possible to override the main method? NO, because main is a static method. A static method can't be overridden in Java.

    Can we declare the main() method as public static final void main(String arr[])?Yes.

    How can a dead thread be restarted?A dead thread cannot be restarted.

    Can we overload a static method with a non-static method?Static methods cant be overloaded with non-static methods but static methods can be overloaded with static methods.The basic requirement is to change the parameters.

    Parent class reference variable can hold the child class object but child class reference variable can not hold the parentclass object. Why?class A{}class B extends A{}then; Aa = new B(); // validB b = new A(); //invalidWhen a subclass extends a superclass, it can also have additional attributes and methods not existing in the superclass.As the reference variable determines what methods you can use on it, a variable of a subclass type can hence exposemore operations available than the superclass has implemented.That's why a variable of a subclass type can't reference an instance of a superclass.

    Can we define a class within a constructor? What will happen if we define a static nested class in a constructor?Yes we can define a non-static class within a constructor. But we can not define a static (nested )class within aconstructor. It will result in a compile time error.

    Can we declare and use a private constructor in any class?Yes, but we can not create the object of that class in any other class. Its object can be created only within that class.

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    52/97

    Use Interfaces when You see that something in your design will change frequently. If various implementations only share method signatures then it is better to use Interfaces. you need some classes to use some methods which you don't want to be included in the class, then you go for theinterface, which makes it easy to just implement and make use of the methods defined in the interface.Use Abstract Class when If various implementations are of the same kind and use common behavior or status then abstract class is better to

    use. When you want to provide a generalized form of abstraction and leave the implementation task with the inheritingsubclass. Abstract classes are an excellent way to create planned inheritance hierarchies. They're also a good choice for nonleafclasses in class hierarchies.

    Define leaf?The node without any child node is a leaf node.What do you mean by overflow and underflow?Overflow: When there is no more room to store new elementsUnderflow: When there are no more elements to be deletedWhat is binary search tree?

    The tree constructed using the relationship as Left Child < Root < Right ChildWhat is time-space trade-off?A compromise between achieving either of the two rendering the other as expensiveWhat are the different types of traversing (trees)? Preorder, Postorder and Inorder What is the data structures used to perform recursion?Stack When is a binary search algorithm best applied?In case the data items are already sortedThere are 8, 15, 13, 14 nodes were there in 4 different trees. Which of them could have formed a full binary tree?Tree with 15 nodesWhether Linked List is linear or Non-linear data structure?Linear Convert the expression ((A + B) * C - (D - E) ^ (F + G)) to equivalent Prefix and Postfix notations.Prefix: -*+ABC -DE+FGPostfix: AB+C* DE-FG+^-In tree construction which is the suitable efficient data structure? (Array, Linked list, Stack, Queue)Array or Linked ListWhat is difference between Singly Linked List and Doubly Linked List data structure?Singly list: Each node can point only to next nodeDoubly list: Each node can point to previous node as well as next node-- Exceptions for first and last nodes in each case

    What are the types of Collision Resolution Techniques and the methods used in each of the type?

    Separate chainingOpen addressingLinear probingQuadratic probingDouble hashing

    ,model.RDBMS: Array

    Network Model: Graph

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    53/97

    If you are using C language to implement the heterogeneous linked list, what pointer type will you use?Void pointer What is database?ANSWER:A database is a logically coherent collection of data with some inherent meaning, representing some aspect of realworld and which is designed, built and populated with data for a specific purpose.

    What is DBMS? State its advantages/featuresANSWER: Database management system? Redundancy is controlled.? Unauthorised access is restricted.? Providing multiple user interfaces.? Enforcing integrity constraints.? Providing backup and recovery.

    What is a Database system?ANSWER:The database and DBMS software together is called as Database system.

    Disadvantage in File Processing System?ANSWER:? Data redundancy & inconsistency.? Difficult in accessing data.? Data isolation.? Data integrity.? Concurrent access is not possible.? Security Problems. .

    Describe the three levels of data abstraction?ANSWER:The are three levels of abstraction:? Physical level: The lowest level of abstraction describes how data are stored.? Logical level: The next higher level of abstraction, describes what data are stored in database and what relationshipamong those data.? View level: The highest level of abstraction describes only part of entire database.

    e ne e n egr y ru esANSWER:There are two Integrity rules.? Entity Integrity: States that ?Primary key cannot have NULL value?? Referential Integrity: States that ?Foreign Key can be either a NULL value or should be Primary Key value of otherrelation.

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    54/97

    What is System R? What are its two major subsystems?ANSWER:System R was designed and developed over a period of 1974-79 at IBM San Jose Research Center . It is a prototypeand its purpose was to demonstrate that it is possible to build a Relational System that can be used in a real lifeenvironment to solve real life problems, with performance at least comparable to that of existing system.Its two subsystems are? Research Storage

    ? System Relational Data System.

    a s a a n epen enceANSWER:Data independence means that ?the application is independent of the storage structure and access strategy of data?. Inother words, The ability to modify the schema definition in one level should not affect the schema definition in the nexthigher level.Two types of Data Independence:? Physical Data Independence : Modification in physical level should not affect the logical level.? Logical Data Independence : Modification in logical level should affect the view level.

    NOTE: Logical Data Independence is more difficult to achieve

    What is a view? How it is related to data independence?ANSWER:A view may be thought of as a virtual table, that is, a table that does not really exist in its own right but is insteadderived from one or more underlying base table. In other words, there is no stored file that direct represents the viewinstead a definition of view is stored in data dictionary.Growth and restructuring of base tables is not reflected in views. Thus the view can insulate users from the effects ofrestructuring and growth in the database. Hence accounts for logical data independence. .

    What is Data Model?ANSWER:A collection of conceptual tools for describing data, data relationships data semantics and constraints.

    What is Object Oriented model?ANSWER:This model is based on collection of objects. An object contains values stored in instance variables with in the object.An object also contains bodies of code that operate on the object. These bodies of code are called methods. Objectsthat contain same types of values and the same methods are grouped together into classes.

    What is an Entity type?ANSWER:It is a collection (set) of entities that have same attributes.

    What is an Entity set?

    ANSWER:It is a collection of all entities of particular entity type in the database.

    What is degree of a Relation?ANSWER:It is the number of attribute of its relation schema.

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    55/97

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    56/97

    What is BCNF (Boyce-Codd Normal Form)?ANSWER:A relation schema R is in BCNF if it is in 3NF and satisfies an additional constraint that for every FD X A, X must bea candidate key.

    What is "transparent DBMS"?It is one, which keeps its Physical Structure hidden from user.

    Brief theory of Network, Hierarchical schemas and their properties Network schema uses a graph data structure to organize records example for such a database management system isCTCG while a hierarchical schema uses a tree data structure example for such a system is IMS.

    a o you mean y orre a e su query ve examp e Subqueries, or nested queries, are used to bring back a set of rows to be used by the parent query. Depending on howthe subquery is written, it can be executed once for the parent query or it can be executed once for each row returned

    by the parent query. If the subquery is executed for each row of the parent, this is called a correlated subquery.A correlated subquery can be easily identified if it contains any references to the parent subquery columns in itsWHERE clause. Columns from the subquery cannot be referenced anywhere else in the parent query. The followingexample demonstrates a non-correlated subquery.E.g. Select * From CUST Where '10/03/1990' IN (Select ODATE From ORDER Where CUST.CNUM =

    ORDER.CNUM)

    What are the primitive operations common to all record management systems?Addition, deletion and modification.

    Are the resulting relations of PRODUCT and JOIN operation the same? No. PRODUCT: Concatenation of every row in one relation with every row in another. JOIN: Concatenation of rows from one relation and related rows from another.

    Name the sub-systems of a RDBMS I/O, Security, Language Processing, Process Control, Storage Management, Logging and Recovery, DistributionControl, Transaction Control, Memory Management, Lock Management

    What is the purpose of the information stored in data-dictionary? The information in the data dictionary validates the existence of the objects, provides access to them, and maps theactual physical storage location.

    Define SQL and state the differences between SQL and other conventional programming Languages

    SQL is a nonprocedural language that is designed specifically for data access operations on normalized relationaldatabase structures. The primary difference between SQL and other conventional programming languages is that SQLstatements specify what data operations should be performed rather than how to perform them.

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    57/97

    What is an Oracle Instance?The Oracle system processes, also known as Oracle background processes, provide functions for the user

    processesfunctions that would otherwise be done by the user processes themselvesOracle database-wide system memory is known as the SGA, the system global area or shared global area. The data andcontrol structures in the SGA are shareable, and all the Oracle background processes and user processes can use them.The combination of the SGA and the Oracle background processes is known as an Oracle instance

    What are database files, control files and log files. How many of these f iles should a database have at least? Why?Database FilesThe database files hold the actual data and are typically the largest in size. Depending on their sizes, the tables (andother objects) for all the user accounts can go in one database filebut that's not an ideal situation because it does notmake the database structure very flexible for controlling access to storage for different users, putting the database ondifferent disk drives, or backing up and restoring just part of the database.You must have at least one database file but usually, more than one files are used. In terms of accessing and using thedata in the tables and other objects, the number (or location) of the files is immaterial.The database files are fixed in size and never grow bigger than the size at which they were createdControl FilesThe control files and redo logs support the rest of the architecture. Any database must have at least one control file,although you typically have more than one to guard against loss. The control file records the name of the database, thedate and time it was created, the location of the database and redo logs, and the synchronization information to ensurethat all three sets of files are always in step. Every time you add a new database or redo log file to the database, theinformation is recorded in the control files.Redo LogsAny database must have at least two redo logs. These are the journals for the database; the redo logs record all changesto the user objects or system objects. If any type of failure occurs, the changes recorded in the redo logs can be used to

    bring the database to a consistent state without losing any committed transactions. In the case of non-data loss failure,Oracle can apply the information in the redo logs automatically without intervention from the DBA.The redo log files are fixed in size and never grow dynamically from the size at which they were created.

    What is database Trigger? A database trigger is a PL/SQL block that can defined to automatically execute for insert, update, and deletestatements against a table. The trigger can e defined to execute once for the entire statement or once for every row thatis inserted, updated, or deleted. For any one table, there are twelve events for which you can define database triggers.A database trigger can call database procedures that are also written in PL/SQL.

    What are stored-procedures? And what are the advantages of using them.Stored procedures are database objects that perform a user defined operation. A stored procedure can have a set ofcompound SQL statements. A stored procedure executes the SQL commands and returns the result to the client. Stored

    procedures are used to reduce network traffic.

    .PL/SQL uses cursors for all database information accesses statements. The language supports the use two types ofcursors

    What operator performs pattern matching?LIKE operator

    Which command executes the contents of a specified file? START or @

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    58/97

    State true or false. EXISTS, SOME, ANY are operators in SQL. True

    Which system table contains information on constraints on all the tables created? USER_CONSTRAINTS

    TRUNCATE is a DDL command whereas DELETE is a DML command. Hence DELETE operation can be rolled back, but TRUNCATE operation cannot be rolled back. WHERE clause can be used with DELETE and not withTRUNCATE.

    What will be the output of the following query?SELECT REPLACE(TRANSLATE(LTRIM(RTRIM('!! ATHEN !!','!'), '!'), 'AN', '**'),'*','TROUBLE') FROM DUAL; TROUBLETHETROUBLE

    SELECT SAL + NVL(COMM,0) FROM EMP; This displays the total salary of all employees. The null values in the commission column will be replaced by 0 andadded to salary.

    What is the advantage of specifying WITH GRANT OPTION in the GRANT command? The privilege receiver can further grant the privileges he/she has obtained from the owner to any other user.

    What is the use of the DROP option in the ALTER TABLE command? It is used to drop constraints specified on the table.

    a s e use o an n comman sAnswer : DESC has two purposes. It is used to describe a schema as well as to retrieve rows from table in descending order.

    Explanation :The query SELECT * FROM EMP ORDER BY ENAME DESC will display the output sorted on ENAME indescending order.

    CASCADE When this clause is used with the DROP command, a parent table can be dropped even when a child table exists.

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    59/97

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    60/97

    HTML 3

    HTML 2

    HTML 4

    HTML 3

    HTML 4

    HTML 3

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    61/97

    HTML 4

    HTML 4

    HTML 4

    HTML 4

    HTML 3

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    62/97

    HTML 1

    HTML 1

    HTML 4

    HTML 3

    HTML 3

    HTML 3

    HTML 2

    SE 5

    SE 5

    SE 5

    SE 4

    SE 4

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    63/97

    SE 4

    SE 4

    SE 3

    SE 3

    SE 3

    SE 3

    SE 2

    SE 2

    SE 2

    SE 1

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    64/97

    SE 1

    SE 1

    SE 1

    C/C++ 2

    C/C++ 3

    C/C++ 3

    C/C++ 5

    C/C++ 3

    C/C++ 3

    C/C++ 4

    C/C++ 3

    C/C++ 4

    C/C++ 4

    C/C++ 4

    C/C++ 4

    C/C++ 3

    C/C++ 3

    C/C++ 4

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    65/97

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    66/97

    C/C++ 5

    C/C++ 5

    C/C++ 5

    C/C++ 4

    C/C++ 5

    C/C++ 5

    C/C++ 4

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    67/97

    C/C++ 5

    C/C++ 4

    C/C++ 3

    C/C++ 3

    C/C++ 3

    C/C++ 4

    C/C++ 5

    C/C++ 5

    C/C++ 5

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    68/97

    C/C++ 5

    C/C++ 4

    C/C++ 4

    C/C++ 4

    C/C++ 4

    C/C++ 4

    C/C++ 2

    C/C++ 2

    C/C++ 2

    C/C++ 3

    C/C++ 4

    C/C++ 4

    C/C++ 3

    C/C++ 2

    C/C++ 2

    C/C++ 3

    C/C++ 4

    C/C++ 2

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    69/97

    C/C++ 3

    C/C++ 3

    C/C++ 1

    C/C++ 4

    C/C++ 2

    C/C++ 4

    C/C++ 5

    C/C++ 3

    C/C++ 1C/C++ 1

    C/C++ 4

    C/C++ 1C/C++ 2C/C++ 2C/C++ 2C/C++ 2

    C/C++ 3

    C/C++ 3

    C/C++ 2

    C/C++ 4

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    70/97

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    71/97

    C/C++ 3

    C/C++ 3

    C/C++ 3

    C/C++ 2

    C/C++ 2

    C/C++ 22

    C/C++ 2

    C/C++ 2

    C/C++ 2

    C/C++ 2C/C++ 2

    C/C++ 2C/C++ 3

    C/C++ 2

    C/C++ 2

    C/C++ 4

    C/C++ 3

    C/C++ 5

    C/C++ 4

    C/C++ 3

    C/C++ 4

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    72/97

    C/C++ 3

    C/C++ 2

    C/C++ 2

    C/C++ 3

    C/C++ 3

    C/C++ 3

    C/C++ 3C/C++ 2C/C++ 3

    C/C++ 1C/C++ 3

    C/C++ 5

    C/C++ 5

    C/C++ 3

    C/C++ 4

    C/C++ 4

    C/C++ 4

    C/C++ 5

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    73/97

    C/C++ 5

    C/C++ 4

    C/C++ 3

    C/C++ 4

    C/C++ 5

    C/C++ 2

    C/C++ 1

    C/C++ 2

    C/C++ 3

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    74/97

    C/C++ 4

    C/C++ 4

    C/C++ 3

    C/C++ 3

    C/C++ 3

    C/C++ 2

    C/C++ 4

    C/C++ 2

    C/C++ 2C/C++ 4C/C++ 2C/C++ 2C/C++ 3

    C/C++ 4

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    75/97

    C/C++ 1

    C/C++ 3

    C/C++ 3

    C/C++ 3

    C/C++ 5

    C/C++ 3C/C++ 3

    C/C++ 4

    C/C++ 3

    C/C++ 4

    C/C++ 1

    C/C++ 5

    C/C++ 4

    C/C++ 2

    C/C++ 2

    C/C++ 5

    C/C++ 5

    C/C++ 4

    C/C++ 4

    C/C++ 2

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    76/97

    C/C++ 3

    C/C++ 2

    C/C++ 3

    C/C++ 2

    C/C++ 3

    C/C++ 3

    C/C++ 1

    C/C++ 3

    C/C++ 3

    C/C++ 2

    C/C++ 4

    C/C++ 3

    C/C++ 3C/C++ 2

    C/C++ 4

    C/C++ 3

    C/C++ 3

    C/C++ 2

    C/C++ 4

    C/C++ 3

    C/C++ 4

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    77/97

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    78/97

    OS 3

    ComputerArchitecture

    2

    OS 3

    Java 1

    Java 3

    Java 2

    Java 2

    Java 1

    Java 1

    Java 2

    Java 2

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    79/97

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    80/97

    Java 4

    Java 4

    Java 4

    Java 4

    Java 5

    Java 5

    Java 5

    Java 5

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    81/97

    Java 5

    DS 1

    DS 1

    DS 1

    DS 2

    DS 2

    DS 2

    DS 2

    DS 3

    DS 1

    DS 4

    DS 3

    DS 4

    DS 4

    DS 5

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    82/97

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    83/97

    DBMS 4

    DBMS 3

    DBMS 3

    DBMS 2

    DBMS 3

    DBMS 2

    DBMS 2

    DBMS 2

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    84/97

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    85/97

    DBMS 3

    DBMS 3

    DBMS 3

    DBMS 5

    DBMS 2

    DBMS 3

    DBMS 3

    DBMS 3

    DBMS 4

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    86/97

    DBMS 3

    DBMS 3

    DBMS 3

    DBMS 3

    DBMS 4

    DBMS 2

    DBMS 2

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    87/97

    DBMS 3

    DBMS 3

    DBMS 4

    DBMS 5

    DBMS 5

    DBMS 4

    DBMS 4

    DBMS 4

  • 8/13/2019 CSE Interview Q-A for Placement Drill

    88/97

    C/C++ A pointer to a function which receives nothing and returns nothingC/C++ A pointer to array of three charsC/C++ A pointer to function which receives an int pointer and returns a float pointerC/C++ An array of three char pointersC/C++ An array of three pointers to charsC/C++ Are the expressions arr and &arr same for an array of integers?

    C/C++ Are the variables argc and argv are local to main?C/C++ Can a Structure contain a Pointer to itself?C/C++ Can there be at least some solution to determine the number of arguments passed toC/C++ Can we generate a C++ source code from the binary file?C/C++ Can we have "Virtual Constructors"?C/C++ Can we specify variable field width in a scanf() format string? If possible how?C/C++ Can you dynamically allocate arrays in expanded memory?C/C++ Can you use the function fprintf() to display the output on the screen?C/C++ Can you write a function similar to printf()?C/C++ Comment: C++ "includes" behavior and java "imports"C/C++ Describe about storage allocation and scope of global, extern, static, local and registerC/C++ Difference between "C structure" and "C++ structure".C/C++ Difference between "printf" and "sprintf".C/C++ Difference between "vector" and "array"?C/C++ Difference between arrays and linked list?C/C++ Difference between Composition and Aggregation.C/C++ Difference between pass by reference and pass by value?C/C++ Difference between realloc() and free?C/C++ Difference between strdup and strcpy?C/C++ Difference: Activity Diagram and Sequence Diagram.C/C++ Difference: Sequence Diagrams, Collaboration Diagrams.

    C/C++ Difference: 'uses', 'extends', 'includes'C/C++ Differentiate between a for loop and a while loop? What are it uses?C/C++ Diffrence between a "assignment operator" and a "copy constructor"C/C++ Does c++ support multilevel and multiple inheritance?C/C++ Does mentioning the array name gives the base address in all the contexts?C/C++ Does there exist any other function which can be used to convert an integer or a floatC/C++ Does there exist any way to make the command line arguments available to other funC/C++ Does UML guarantee project success?C/C++ Explain "passing by value", "passing by pointer" and "passing by reference"C/C++ Explain one method to process an entire string as one unit?C/C++ Explain the need for "Virtual Destructor".

    C/C++ Explain working of printf.C/C++ Give 2 examples of a code optimization.C/C++ Have you heard of "mutable" keyword?C/C++ How are Structure passing and returning implemented by the complier?C/C++ How can a called function determine