Question

Design Patterns Interview Questions #1

0

What is a Design Pattern?

Design Pattern is a re-usable, high quality solution to a given requirement, task or recurring problem. Further, it does not comprise of a complete solution that may be instantly converted to a code component, rather it provides a framework for how to solve a problem. In 1994, the release of the book Design Patterns, Elements of Reusable Object Oriented Software made design patterns popular. Because design patterns consist of proven reusable architectural concepts, they are reliable and they speed up software development More >

Question

AJAX Interview Questions #1

1

What’s AJAX ? AJAX (Asynchronous JavaScript and XML) is a newly coined term for two powerful browser features that have been around for years, but were overlooked by many web developers until recently when applications such as Gmail, Google Suggest, and Google Maps hit the streets. Asynchronous JavaScript and XML, or Ajax (pronounced "Aye-Jacks"), is a web development technique for creating interactive web applications using a combination of  XHTML (or HTML) and CSS for marking up and styling information. (XML is commonly used, although any format will work, More >

Question

JavaScript Interview Questions #1

0
  1. What’s relationship between JavaScript and ECMAScript? – ECMAScript is yet another name for JavaScript (other names include LiveScript). The current JavaScript that you see supported in browsers is ECMAScript revision 3.
  2. What are JavaScript types? – Number, String, Boolean, Function, Object, Null, Undefined.
  3. How do you convert numbers between different bases in JavaScript? – Use the parseInt() function, that takes a string as the first parameter, and the base as a second parameter. So to convert hexadecimal 3F to decimal, use parseInt ("3F", 16);

More >

Question

XML Interview Questions #1

0

1. What is XML?

XML is the Extensible Markup Language. It improves the functionality of the Web by letting you identify your information in a more accurate, flexible, and adaptable way. It is extensible because it is not a fixed format like HTML (which is a single, predefined markup language). Instead, XML is actually a meta language a language for describing other languages which lets you design your own markup languages for limitless different types of documents. XML can do this because it’s written in SGML, the More >

Question

JavaScript & AJAX Interview Questions #1

0

1.  Why so JavaScript and Java have similar name?

A.  JavaScript is a stripped-down version of Java

B.  JavaScript’s syntax is loosely based on Java’s

C.  They both originated on the island of Java

D.  None of the above

 

2.  More >

.NET

Inherit DataGridView in Windows Forms

8

Create a user control class DataGridViewEx and paste the code snippet given. You can use this control where you want an inherited DataGridView.

Download source code & sample:


using System;
using System.ComponentModel;
using System.Design;
using System.Drawing;
using System.Windows.Forms;

namespace DataGridViewInheritance
{

    [Designer(typeof(System.Windows.Forms.Design.ControlDesigner))]
    public partial class DataGridViewEx : DataGridView
    {
        public DataGridViewEx()
        {
            InitializeComponent();
        }
    }
}
SQL Server

Comma-Delimited Output (SQL Server)

1

Using Query:


use Northwind
GO

declare @CustIDs varchar(8000)

select top 10
        @CustIDs = isnull(@CustIDs + ',', '') + CustomerID
from    Customers

select  @CustIDs

GO

Using Cursor:


declare cCustomerIDs cursor for

select [CustomerID] from [dbo].[Customers] order by [CustomerID]

declare @CustomerIDs varchar(8000)

declare @CustomerID varchar(10)

open cCustomerIDs

fetch next from cCustomerIDs into @CustomerID

while @@FETCH_STATUS = 0
    begin

        set @CustomerIDs = isnull(@CustomerIDs + ',', '') + @CustomerID

        fetch next from cCustomerIDs into @CustomerID

    end

close cCustomerIDs

deallocate cCustomerIDs

select  @CustomerIDs as CustomerIDs

GO
.NET

Decimal to Byte array (vice versa)

14

        /// <summary>
        /// Decimal to Bye array
        /// </summary>
        /// <param name="dec">decimal</param>
        /// <returns>byte array</returns>
        public static byte[] DecimalToBytes(Decimal dec)
        {
            using (MemoryStream stream = new MemoryStream())
            {
                using (BinaryWriter writer = new BinaryWriter(stream))
                {
                    writer.Write(dec);

                    return stream.ToArray();
                }
            }
        }

        /// <summary>
        /// Byte array to Decimal
        /// </summary>
        /// <param name="src">byte array</param>
        /// <returns>decimal</returns>
        public static Decimal BytesToDecimal(byte[] src)
        {
            if (src.Length == 1)
            {
                return Decimal.Parse(((char)src[0]).ToString());
            }

           using (MemoryStream stream = new MemoryStream(src))
           {
               using (BinaryReader reader = new BinaryReader(stream))
               {
                   return reader.ReadDecimal();
               }

           }
        }
.NET

Byte array to String (vice versa)

0

        /// <summary>
        /// Byte arrary to String
        /// </summary>
        /// <param name="bytes">byte array</param>
        /// <returns>string</returns>
        public static string BytesToString(byte[] bytes)
        {
            ASCIIEncoding enc = new System.Text.ASCIIEncoding();

            return enc.GetString(bytes);
        }

        /// <summary>
        /// String to Byte array
        /// </summary>
        /// <param name="str">string</param>
        /// <returns>byte array</returns>
        public static byte[] StringToBytes(string str)
        {
            ASCIIEncoding enc = new System.Text.ASCIIEncoding();

            return enc.GetBytes(str);
        }    
.NET

Byte array to Integer (vice versa)

0

        /// <summary>
        /// Byte array to Integer
        /// </summary>
        /// <param name="bytes">byte array</param>
        /// <returns>int</returns>
        public static int BytesToInt(byte[] bytes)
        {
            return int.Parse(BytesToString(bytes).Trim());
        }

        /// <summary>
        /// Byte array to String
        /// </summary>
        /// <param name="bytes">byte array</param>
        /// <returns>string</returns>
        public static string BytesToString(byte[] bytes)
        {
            ASCIIEncoding enc = new System.Text.ASCIIEncoding();

            return enc.GetString(bytes);
        }

        /// <summary>
        /// Integer to Byte array
        /// </summary>
        /// <param name="value">int</param>
        /// <returns>byte array</returns>
        public static byte[] IntToBytes(int value)
        {
            ASCIIEncoding enc = new System.Text.ASCIIEncoding();

            return enc.GetBytes(value.ToString());

More >

Go to Top