Others Interview Questions and Answers (265) - Page 4

What is Cryptography?

Cryptography is one of the ways of encrypting and decrypting messages so that an average person while reading them will not be able to understand the meaning.
Differences between Window Services and Window Applications

Window Services:

1) They have no GUI (Graphical User Interface)

2) Used mainly for background processing or monitoring tasks.

3) They are found in the Services section of the Control Panel.

4)Installed using special utilities like InstallUtil.

5)They have startup types like Automatic, Manual


examples:

1) SMTP Service: used for sending emails across network

2)MSSQLServer Service: used for starting/stopping the SQL Server engine.

We can also create our own services and install them using InstallUtil.


Window Applications

1) They are GUI based.

2) Used for creating windows which can be run from their exe's stored a folder/desktop to enable the users to perform these kinds of tasks:

a)Data Entry(Ex: Inventory/Payroll management), Data viewing(view employee details)

b)Viewing hardware/software information of a system.

c) Games/ Graphics.

d)Customized calculators, Notepads, Explorers

3)They are not found in the Services section of Control Panel.

4)No startup types like Automatic/Manual.


We can start/stop Windows Service from a Windows Application .
Differences between a GroupBox and a Panel.

GroupBox and Panel are 2 of the Container Controls(which contain other User Interface Controls)


GroupBox:

1)It has the Text property.

2)We cannot display scrollbars on GroupBox.

3)It does not have the click event.
other events that are missing include MouseMove, MouseDown, MouseUp events

4)BorderStyle property is not there as Border or Frame is there by default.

However, FlatStyle property can be used to determine the control's appearance when the user moves the mouse over the control.

Panel:

1)It does not have the Text property.

2)We can display scrollbars on Panel if the height/width of the child controls exceeds that of the Panel. For that set AutoScroll property to true.

3)It has the click event.

It has also got MouseMove, MouseDown, MouseUp events

4)To display Border, we have to use the BorderStyle property.
What is errorprovider?

It is a control that is used to display blinking error message in a tooltip when some
control (example : a textbox) has invalid data.
Code snippet:

private void button1_Click(object sender, EventArgs e)

{
if (textBox1.Text == "")
{
errorProvider1.SetError(textBox1, "please enter");
}
else
{
errorProvider1.SetError(textBox1, "");

}
}

Which controls do not have events?

In Window applications, the following are the examples of controls
having no events


1) ImageList

Purpose: acts as a repository of images. Most useful for assigning images

in TreeView/ListView controls.

2)HelpProvider

Purpose: used to display help files with various extensions.(ex: .chm,.col, htm files)

Function key F1 is used by default to display the help files.

3)DirectorySearcher

Purpose: used in Directory Searching in active directory applications.


Can we copy a COM dll to GAC Folder?

No,
For a dll to be copied in GAC Folder,
1)It must be a .NET dll.
2)It must be strong named. Strong Naming is done by attaching a key pair file wih the .dll

This generates the key pair file.
example: sn -k abc.snk

sn : strong naming

k: generate key pair file

abc.snk: name of the key pair file.

to attach the key pair with the .NET dll, either use command line or

Visual sTUDIO Option


For the Visual Studio Option, open the class library project.It contains the .NET dll

View->Solution Explorer->Properties->click Signing tab->enter the path of key pair

file->save and build.

To install the signed .dll in GAC

use this command

gacutil /i <path of the signed .dll>

the COM dll has to be attached/converted to a .NET dll before we can think of putting it in GAC.
How can we call unmanaged code through .NET?

Unmanaged code can be called through .NET applications in a number of ways:

Example:

1)Pointer code is an unmanaged code:
Mark the pointer code secton with unsafe keyword.

compile the code with /unsafe switch
example:
class abc
{
static void Main()
{
unsafe
{
//Write the pointer code

}
}
}

example:
2)Win32 API Functions:
1)
//add this namespace
using System.Runtime.InteropServices;
(C#)

2)Mark the relevant dll with DllImport attribute
3)Put static and extern modifiers before the function
example:FlashWindow to blink the form's caption bar.

[DllImport("user32.dll")]
static extern void FlashWindow(IntPtr a, bool b);

Difference between http and https

http:
1)It is hyper text transfer protocol which is responsible for transmitting and receiving information across the Internet

2)It is transmitted over the wire via PORT 80 (TCP).

https
1)is secure http, which is used exchanging confidential information with a server, which needs to be secured in order to prevent unauthorized access.
It is http over SSL (Secure Sockets Layer).
2)Uses Port 443 instead of the http Port 80
Which property of a Windows Form TextBox cannot be changed dynamically?

It is the Locked property
It is used to prevent the dragging or moving of a TextBox. It is visible only in the property window and not in the source code.
How controls are created and events fired on a Windows Form?

It is possible using the InitializeComponent method mentioned in the
Constructor of the class of the Windows Form. If this method is removed, no control would be visible on the screen and no events would be fired.

For the events to fire, appropriate event-delegate relationship is also mandatory. This relationship is auto-generated and can be seen in the .designer.cs file.
Difference betweem MouseDown, Click,MouseClick events in Windows applications.

These events are fired when we press mouse button down on some control
(example: Button)


Their sequence of firing is:

1)MouseDown
2)Click
3)MouseClick

Differences:

MouseDown:
1)It helps us to identify which mouse button was pressed(ex: left,middle, right)

2) Does not fire through a keyboard

3)can also be used to give coordinates(X and Y coordinates where the mouse

was pressed)

Click:
1)we cannot identify the mouse button that was pressed

2) Does fire through keyboard (enter, spacebar keys for example)

3)Does not give co-ordinates

MouseClick:
1)Fires through the default button(Left Button)

2)Does not fire through keyboard.

3)Gives coordinates where the Mouse was clicked.
How can we display the contents of an enum in a ComBoBox?

Create an enum and using Reflection, bind the enum contents with the DataSource
property of ComBoBox

ex:
enum WeekDays
{
Sunday,
Monday,
Tuesday
}

Write this statement in Form_Load event handler

combobox1.DataSource=Enum.GetValues(typeof(WeekDays));



. GetValues is a static method of Enum class and
retrieves an array of the values of the constants in a specified enumeration.//

. It expects the enum name as the parameter and the typeof operator retreives the

. contents of the user-defined enum
How can we display WindowListing in .NET?

WindowListing is a feature that allows us to display the names of the various child forms in an MDI application in the drop down of a particular menu.

For Example: If there is a control known as MenuStrip1 and there are two parent menus known as File and Edit.

To display the list of child forms in the Edit Menu

Set the MdiWindowListItem property to ->Edit

If there are submenus below the Edit Menu, list of child forms will be displayed
after the last submenu.
How can we view the ColumnHeaders in a ListView Control?

Set the View property of the ListView to Details:

Other settings like LargeIcon,SmallIcon can display images but not the ColumnHeaders.
How can we display check boxes in a List View control?

Set the CheckBoxes property of the List View to true. It will display check boxes besides the items of the List View.

The CheckBoxes will automatically be displayed when we add rows to the ListView
by creating an instance of ListViewItem class.


ex:

ListViewItem z=new ListViewItem();

z.Text="csharp";
listView1.Items.Add(z);

What is Code Instrumentation?

It is a set of techniques using which we can monitor and analyze the performance of an application.
It is implemented by using Tracing,debugging,performance counters and Event logs.

Tracing: information about run time code execution.
In ASP.NET , write Trace="true" in Page Directive.
Then write Trace.Warn("categoryname","messagename");
in the .aspx.cs file event handler(Page_Load).

Debugging: For troubleshooting and detecting logical errors in code.
We can use .NET Framework debugging tools like Cordbg.exe for that.

Performance Counters : can be very useful in analyzing the processing
of the program and vital statistics like Memory consumed.

Event Logs: used for writing Error messages in the Windows Event Log.
What is BSON ?

BSON is a bin­ary-en­coded seri­al­iz­a­tion of JSON-like doc­u­ments. BSON is designed to be lightweight, traversable, and efficient. BSON, like JSON, supports the embedding of objects and arrays within other objects and arrays.BSON supports all JSON types (objects, arrays, strings, integers, etc). BSON supports some additional types, most notably binary data, making it a superset of JSON.

The two major benefits of BSON over JSON are size and speed. BSON stores binary data directly, avoiding the time overhead and the additional size of base64 encoded text that regular JSON has with binary data. Reading and writing BSON is also faster than JSON.

Example :

{"hello": "world"} ? "\x16\x00\x00\x00\x02hello\x00\x06\x00\x00\x00world\x00\x00"

For more Details : http://bsonspec.org/
How can a function accepts variable mumber of arguments in C ?

Functions accepting variable number or type of arguments in C
A function to take variable number or type of arguments are referred to as varargs functions or variadic functions.

You can define a function as variadic using ellipsis('...') in the argument list. To access their variable arguments, you have to use special macros.

The only way to access them is sequentially, in the order they were written,using the special macros from stdarg.h in the following 3 steps:

•Initialize an argument pointer variable of type va-list using va-start.The argument pointer when initialized points to the first optional argument.

•Access optional argument by successive calls to va-arg. The first call to va-arg gives 1st optional argument, the next call gives you the second and so on.

•You indicate that you are finished with the argument pointer variables by calling va-end.

Macros
A macro is a fragment of code which has been given a name-whenever the name is used,it is replaced by the content of the macro.

Data Type: va-list
The type va-list is used for argument pointer variables.

Macro: va-start(va-list ap,last-required)
This macro initializes the argument pointer variable ap to point to the first of the optional argument of the current function.
last-required must be the last required argument of the function.

Macro: type va-arg(va-list ap,type)
The va-arg macro returns the value of the next optional argument, and modifies the value of ap to point to the subsequent argument. Thus successive use of va-arg returns successive optional argument.
The type of the value returned by va-arg is the type specified in the call.

Macro: void va-end(va-list ap)
This ends the use of ap. After the va-end call, further va-arg calls with the same ap may not work.


Example

#include<stdarg.h>

#include<stdio.h>
int add-em-up(int count,...)
{
va-list ap;
int i,sum;
va-start(ap,count);
sum=0;
for(i=0;i<count;i++)
sum+=va-arg(ap,int);
va-end(ap);
return sum;
}

void main()

{
printf("%d",add-em-up(3,5,5,6)); /* prints 16 */
printf("%d",add-em-up(10,1,2,3,4,5,6,7,8,9,10)); /*prints 55 */
}

Tell in brief, the difference between Development and Production Environment ?

Development Environment – It is the place where we develop our application/product. Here all the coders or programmers develops the application/product by writing code.

Production Environment – When the application/product is ready for release to the end-users. When that application/product executes or run in the target machine live.



Thanks and Regards
Akiii
What leadership style should I choose?

You can choose a style based on:

Experience of your team (junior or senior)
Nature of work (routine or creative)
Environment (stable or radically changing, conservative or adventurous)
Your own preferred or natural style

This can vary from situation to situation and person to person
Found this useful, bookmark this page to the blog or social networking websites. Page copy protected against web site content infringement by Copyscape

 Interview Questions and Answers Categories