Thursday, 28 February 2013

(•۝• ѴƲ cℓʋв •۝•) CS410 - FINAL TERM SUBJECTIVE WITH REFERENCE SOVED BY UMAIR SAULAT AND VU HAPPINESS.

CS410- VISUAL PROGRAMMING

SOLVED SUBJECTIVE FOR FINAL EXAM

FALL SEMESTER 2012

SPECIAL THANKS TO VU HAPPINESS

QNo.1   Synchronization objects?

Answer:-

A synchronization object is an object whose handle can be specified in one of the wait functions to coordinate the execution of multiple threads. More than one process can have a handle to the same synchronization object, making interprocess synchronization possible.

REF :: handouts Page No. 343

 

QNo.2   Define owner drawn items?

Answer:-

Owner-drawn items require an application to take total responsibility for drawing selected (highlighted), selected, and cleared states.

REF :: handouts Page No. 236

 

QNo.3   Give two disadvantages of the DLL version

Answer:-

  1. Saves memory and reduces swapping. 

Many processes can use a single DLL simultaneously, sharing a single copy of the DLL in memory.

  1. Saves disk space. 

Many applications can share a single copy of the DLL on disk. In contrast, each application built with a static link library has the library code linked into its executable image as a separate copy.

REF :: handouts Page No. 332

http://msdn.microsoft.com/en-us/library/dtba4t8b.aspx

 

QNo.4   int connect(  SOCKET s,  const struct sockaddr* name,  int namelen);Define the all parameters

Answer:-

Parameters

s:  

Descriptor identifying an unconnected socket.

name:

Name of the socket in the sockaddr structure to which the connection should be established.

 

namelen:

Length of name, in bytes

 

Return Values:

If no error occurs, connect returns zero. Otherwise, it returns SOCKET_ERROR, and a specific error code can be retrieved by calling WSAGetLastError.

REF :: handouts Page No. 367

 

 

QNo.5   dynamic library that export DLL function "hello! You are here in DLL"

Answer:-

Say you want to build this minimal function in mydll.c:

#include <stdio.h>

int

hello()

{

  printf ("Hello World!\n");

 

First compile mydll.c to object code:                                      gcc -c mydll.c

Then, tell gcc that it is building a shared library:                               gcc -shared -o mydll.dll mydll.o

you can now link to the dll with a simple program:

int

main ()

{

  hello ();

Then link to your dll with a command like:                          gcc -o myprog myprog.c -L./ -lmydll

REF :: http://cygwin.com/cygwin-ug-net/dll.html

 

QNo.6   Modeless dialog why we cannot use the control in parent

Answer:-

The application displays the dialog box (if it is not already displayed) by using the ShowWindow function. The application destroys the dialog box by using the DestroyWindow function. To support keyboard navigation and other dialog box functionality, the message loop for the dialog box must call the IsDialogMessage function.

REF :: handouts Page No. 267

 

QNo.7   Socket connect ?

Answer:-

The connect () system call connects the socket referred to by the file descriptor sockfd to the address specified by addr

REF :: http://linux.die.net/man/2/connect

 

QNo.8   list box styles?

Answer:-

There are two types of list boxes:

  1. single-selection
  2. multiple-selection.

REF :: handouts Page No. 287

 

 

QNo.9   pointer arithmetic ?

Answer:-

Pointer Arithmetic deals with performing addition and subtraction operations on pointer variables.

  • increment a pointer ( ++ )
  • decrement a pointer ( -- )
  • Address in pointer is incremented or decremented by the size of the object it points to (char = 1 byte, int = 2 bytes, ...)

REF :: handouts Page No. 21

 


QNo.10 what is Bind Function?

Answer:-

The bind function is used on an unconnected socket before subsequent calls to connect or listen functions.

REF :: handouts Page No. 364

 

QNo.11 what is the purpose of Pager control?

Answer:-

A pager control is a window container that is used with a window that does not have enough display area to show all of its content.

REF :: handouts Page No. 305

 

QNo.12 what is the Mean by Resource definition Statement?

Answer:-

The resource-definition statements define the resources that the resource compiler puts in the resource (.Res) file. After the .Res file is linked to the executable file, the application can load its resources at run time as needed.

REF :: handouts Page No. 213

 

QNo.13 why static variables are not destroyed when function returns

Answer:-

The static variable is not destroyed on exit from the function; instead its value is preserved, and becomes available again when the function is next called.

REF :: http://www2.its.strath.ac.uk/courses/c/subsection3_6_4.html

 

QNo.14 Some usages of Dialog?

Answer:-

The following sections discuss how to use both types of dialog boxes.

1.      Modal Dialog Boxes

2.      Modeless Dialog Boxes

 REF :: handouts Page No. 243

 

 

 

 

QNo.15 How Transfer-Encoding is implemented in Exchange-2000.

Answer:-

Routing group boundaries and SMTP target destinations determine how Exchange 2000 Server encodes mail. Exchange 2000 will encode as quoted-printable or 7-bit or Transport-Neutral Encapsulation Format (TNEF) when sending between two servers /recipients in different routing groups, and to the Internet.

Exchange 2000 Server will encode in Binary or Summary TNEF when sending to a recipient/server in the same routing group.

REF :: http://support.microsoft.com/kb/836555

 

QNo.16 what is the purpose of Hot Key?

Answer:-

A hot key is a key combination that generates a WM_HOTKEY message, a message the system places at the top of a thread's message queue, bypassing any existing messages in the queue

REF :: handouts Page No. 199

 

QNo.17 Unregister the Class function

Answer:-The process must destroy all windows using the class before the .dll is unloaded and call the UnregisterClass function.

REF :: handouts Page No. 76

 

QNo.18 What happen if we use DEFwinPRoc instead of dialog procedure in dialog.

Answer:-

if you call any function that results in your dialog procedure receiving a window message, the nested window message could overwrite the return value you set using DWL_MSGRESULT.

REF :: handouts Page No. 130

 

QNo.18 If you include CS_DBLCLKS in your window call style, the windows procedure receives which message for double click. (Specify exact sequence).

Answer:-

An application-defined window does not, by default, receive double-click messages. Because of the system overhead involved in generating double-click messages, these messages are generated only for windows belonging to classes that have the CS_DBLCLKS class style. Your application must set this style when registering the window class. For more information, see Window Classes.

REF :: handouts Page No. 208

 

QNo.19 Enumeration increase level of abstraction?

Answer:-

The enum declaration creates a new integer type. By convention the first letter of an enum type should be in uppercase. The list of values follows, where the first name is assigned zero, the second 1, etc.

REF :: handouts Page No. 36

 

QNo.20 Provide the Description of EDIT Control given below

Answer:-

EM_CANUNDO
EM_GETTEXTLIMIT
EM_GETHANDLE

 

EM_CANUNDO

Returns TRUE if the edit control operation can be undone.

EM_GETTEXTLIMIT

The size can be up to a predefined limit of approximately 32 kilobyte (KB) for single-line edit controls. Because this limit can change, it is called a soft limit

EM_GETHANDLE

Returns a handle identifying the buffer containing the multiline edit control's text. It is not processed by single-line edit controls.

REF :: handouts Page No. 277

 

QNo.21 What is mutex object?

Answer:-

The CreateMutex function creates or opens a named or unnamed mutex object.

REF :: handouts Page No. 346

 

QNo.22 how variables can share their resources across multiple process?

Answer:-Variables can be shared across multiple processes by making the separate data section as following.

#pragma data_seg( [ [ { push | pop }, ] [ identifier, ] ] [ "segment-name" [, "segment-class" ] )

Specifies the data segment where initialized variables are stored in the .obj file. OBJ files can be viewed with the dumpbin application. The default segment in the .obj file for initialized variables is .data. Variables initialized to zero are considered uninitialized and are stored in .bss.

REF :: handouts Page No. 330

 

QNo.23 Scope of variables in DLL file?

Answer:-

Variables defined in DLL have scope in memory until the DLL is loaded. After unloading, the variable scope is vanished. Locally defined variables are accessed within the DLL only. The variables that are set to export variables can be accessed outside the DLL if the DLL is statically linked.

REF :: handouts Page No. 329

 

QNo.24 the column was given about Status code of HTTP, Bad request, Request not found etc we have to match the column according to the correct status code number

Answer:-

Request line is followed by 2 Carriage-Return /Line-feed sequences.

 

 






 

Content-type: text/html

Content-Length:2061                                     Headers delimited by CR/LF sequence

 

Crlf Actual data follows the headers

REF :: handouts Page No. 382

 

QNo.24 if variables declared as export?

Answer:-

Variables declared and initialized in a scope are deleted when execution leaves that scope

REF :: handouts Page No. 66

 

QNo.25 about keyboard accelerator (5)

Answer:-

A keyboard accelerator, also known as a shortcut key, is a keystroke or combination of keystrokes that generates a WM_COMMAND message. Keyboard accelerators are often used as shortcuts for commonly used menu commands, but you can also use them to generate commands that have no equivalent menu items. Include keyboard accelerators for any common or frequent actions, and provide support for the common shortcut keys where they apply.

REF :: handouts Page No. 220

 

 

QNo.26 Can macro takes two arguments. Explain it with example (5)

Answer:-

  1. Function-like macros can take arguments, just like true functions. To define a macro that uses arguments.
  2. you insert parameters between the pair of parentheses in the macro definition that make the macro function-like. The parameters must be valid C identifiers, separated by commas and optionally whitespace.

REF :: handouts Page No. 47

 

QNo.27 There are three types of assertion. write any two names

Answer:-

  1. Preconditions

Specify conditions at the start of a function.

  1. Post conditions

Specify conditions at the end of a function.

  1. Invariants

Specify conditions over a defined region of a program.

REF :: handouts Page No. 49

 

QNo.28 Explain CGI

Answer:-

CGI is Common Gateway Interface. Win32 executable execute by the server. All browser request data is available at stdin (read using scanf() etc.) and all output sent to stdout (output using printf etc.) is sent to the browser instead of the server screen.

REF :: handouts Page No. 396

 

QNo.29 purpose of using of REbar control

Answer:-

Rebar controls act as containers for child windows. An application assigns child windows, which are often other controls, to a rebar control band.

REF :: handouts Page No. 305

 

QNo.30 two macro names that can message map functionality

  1. __FILE__

This macro expands to the name of the current input file, in the form of a C string constant. This is the path by which the preprocessor opened the file, not the short names specified in #include or as the input file name argument.

 

  1. __LINE__

This macro expands to the current input line number, in the form of a decimal integer constant. While we call it a predefined macro, it's a pretty strange macro, since its "definition" changes with each new line of source code.

REF :: handouts Page No. 41

 

QNo.31 Difference between shortcut key and system menu

Answer:-

Shortcut key

  1. A keyboard accelerator, also known as a shortcut key
  2. Include keyboard accelerators for any common or frequent actions, and provide support for the common shortcut keys where they apply.

System menu

  1. The GetSystemMenu function allows the application to access the window menu (also known as the system menu
  2. Menu items on the window menu send WM_SYSCOMMAND messages

REF :: handouts Page No. 241

 

 

QNo.31 difference between send message () and post message ()

Answer:-

send message ()

post message ()

  • SendMessage control is not returned to the calling application until the window that the message was sent to has completed processing the sent message,
  • calls the window procedure for the specified window and does not return until the window procedure has processed the message.
  • SendMessage is a synchronous function.
  • PostMessage control is returned to the calling application immediately, regardless of weather or not the sent message has been processes.
  •  Sends a message in the message queue associated with the thread and returns without waiting for the thread to process that messaage.
  • PostMessage is a Asynchronous function

REF ::http://wiki.answers.com/Q/What_is_the_difference_between_PostMessage_and_SendMessage

 

QNo.31 Two disadvantages of thread

Answer:-

  1. Threads major disadvantage is that they make the system slow because thread uses the time sharing concept that is another name multitasking.
  2. A multitasking operating system divides the available processor time among the processes or threads that need it.

REF :: handouts Page No. 334

 

 

QNo.32 in my application, we are enable enumeration variable to findResource but not found? What I do for this behavior

Answer:-

FindResource replacement and how to change control style more then once in Application. As deeper we're digging in Silverlight 2.0, we finding more and more WPF things and we're really missing in Silverlight. One of such things is FindResources.

 

In WPF I had Visual and Logical tree, so I was able to travel the tree to find resource I need. Let's see an example of the application. We have one resource defined in App level

Configuration Cod:-

<Application.Resources> 
        <Style TargetType="Button" x:Key="green"> 
            <Setter Property="Background" Value="Green"/> 
        </Style> 
</Application.Resources>

Another resources are defined in different levels of Page

<UserControl.Resources> 
        <Style TargetType="Button" x:Name="red"> 
            <Setter Property="Background" Value="Red"/> 
        </Style>        
    </UserControl.Resources> 
    <Grid x:Name="LayoutRoot" Background="White"> 
        <Grid.Resources> 
            <Style TargetType="Button" x:Name="blue"> 
                <Setter Property="Background" Value="Blue"/> 
            </Style> 
        </Grid.Resources> 
        <Button Content="Click me" Click="Button_Click"> 
            <Button.Resources> 
                <Style TargetType="Button" x:Name="yellow"> 
                    <Setter Property="Background" Value="#FFFFFF00"/> 
                </Style> 
            </Button.Resources> 
        </Button> 
    </Grid

 

REF :: http://dedjo.blogspot.com/2008_03_01_archive.html

 

QNo.33 List box styles pointer arithmetic

Answer:-

List box styles

Window styles that control the appearance and operation of a list box

List box items are sorted, arranged in multiple columns, drawn by the application, and so on.

 

Pointer Arithmetic

Deal with performing addition and subtraction operations on pointer variables.

REF :: handouts Page No. 21 ,287

 

QNo.34 Define pager and list-view 

Answer:-

Pager:-

A pager control is a window container that is used with a window that does not have enough display area to show all of its content

List-view 

A list-view control is a window that displays a collection of items. The control provides several ways to arrange and display the items.

REF :: handouts Page No. 305

 

QNo.35 GetParent Syntax?

Answer:-

HWND GetParent

(

HWND hWnd   // handle to child window

);

REF :: handouts Page No. 186

 

QNo.36 what is the purpose of Bind Function?

Answer:- The bind function associates a local address with a socket. The bind function is used on an unconnected socket before subsequent calls to connect or listen functions. It is used to bind to either connection-oriented (stream) or connectionless (datagram) sockets. When a  socket is created with a call to the  socket function, it exists in a namespace (address family), but it has no name assigned to it. Use the  bind function to establish the local association of the socket by assigning a local name to an unnamed socket.

REF :: handouts Page No. 377

 

 

QNo.37 what is the purpose of List View Control?

Answer:-

  1. List View is another useful control in windows systems.
  2. List view control list the items in its window. These items can be selected and clicked on each click list box send notification message to its parent window.
  3. List View control makes data binding easier than previous controls. It has included styling with CSS, flexible pagination, and sorting, inserting, deleting, and updating features.

REF :: handouts Page No. 298

 

QNo.38 what is a custom resource?

Answer:-

Resource is binary data that you can add to the executable file of a Windows-based application. A resource can be either standard or defined. The data in a standard resource describes an icon, cursor, menu, dialog box, bitmap, enhanced metafile, font, accelerator table, message-table entry, string-table entry, or version information. An application- defined resource, also called a custom resource, contains any data required by a specific application.

REF :: handouts Page No. 213

 

QNo.39 Differentiate between Simple Windows Programs & Dynamic Link Library programs?

Answer:-

A DLL (Dynamic Link Library) is a file that can be loaded and executed by programs dynamically. Basically it's an external code repository for programs. Since usually several different programs reuse the same DLL instead of having that code in their own file, this dramatically reduces required storage space. A synonym for a DLL would be library.

 

DLL does not have main function but exe has main function

Here DLL is in process component, both component and consumer will share same memory and Exe is out process component, it will run in its own memory.

An exe is an executable program. A DLL (Dynamic Link Library) is a file that can be loaded and executed by programs dynamically. Basically it's an external code repository for programs. Since usually several different programs reuse the same DLL instead of having that code in their own file, this dramatically reduces required storage space. A synonym for a DLL would be library.

DLL file it is usually the file contains information about programs. EXE is file which can be run and reading a information from DLL and other files to execute program.

REF :: http://wiki.answers.com/Q/What_is_the_difference_between_an_EXE_and_a_DLL

 

QNo.40 what are the three conditions of sending WM_Paint Message?

Answer:-

When a minimized window is maximized, Windows requests the application to repaint  the client area. The WM_PAINT message is sent when the system or another application makes a request to paint a portion of an application's window. The message is sent when the UpdateWindow or RedrawWindow function is called, or by the DispatchMessage function when the application obtains a WM_PAINT message by using the GetMessage or PeekMessage function.

REF :: handouts Page No. 65

 

 

QNo.40 Define the names of resource-definition statements' categories?

Answer:-

The resource-definition statements can be divided into the following categories:

  • Resources 
  • Controls 
  • Statements 

REF :: handouts Page No.214

 

QNo.41 Write down any three parameter of send function?

  1. The flags parameter can be used to influence the behavior of the function beyond the options specified for the associated socket.
  2. Calling  send with a zero  len parameter is permissible and will be treated by  implementations as successful
  3. addr: Optional pointer to a buffer that receives the address of the connecting entity, as  known to the communications layer.

REF :: handouts Page No.383

  

QNo.41 briefly explain Checkbox?

Check Boxes

A  check box consists of a square box and application-defined text (label), an icon, or a  bitmap, that indicates a choice the user can make by selecting the button. Applications  typically display check boxes in a group box to  permit the user to choose from a set of  related, but independent options. For example, an application might present a group of  check boxes from which the user can select error conditions that produce warning beeps. A check box can be one of four styles: standard, automatic, three-state, and automatic  three-state, as defined by the constants BS_CHECKBOX, BS_AUTOCHECKBOX,  BS_3STATE, and BS_AUTO3STATE, respectively. Each style can assume two check  states: checked (a check mark inside the box) or cleared (no check mark). In addition, a  three-state check box can assume an indeterminate state (a grayed  box inside the check  box). Repeatedly clicking a standard or automatic check box toggles it from checked to  cleared and back again. Repeatedly clicking a three-state check box toggles it from  checked to cleared to indeterminate and back again.   When the user clicks a check box (of any style), the check box receives the keyboard  focus. The system sends the check box's parent window a WM_COMMAND message containing the BN_CLICKED notification code. The parent window doesn't acknowledge this message if it comes from an automatic check box or automatic three-

state check box, because the system automatically sets the check state for those styles.  But the parent window must acknowledge the message if it comes from a check box or  three-state check box because the parent window is responsible for setting the check state for those styles. Regardless of the check box style, the system automatically repaints the check box once its state is changed. 

REF :: handouts Page No.282

 

QNo.42 Write down the basic socket operation.

Answer:-

The following are the basic operations performed by both server and client systems.

1.  Create an unbound socket 

2.  Binding Server

3.  Connecting Client

4.  Listen 

5.  Accept 

6.  Send 

7.  Receive 27.7 Windows Socket Library

REF :: handouts Page No.358

 

QNo.43What is mean by process 2marks

Answer:-

When you tell your computer to run a program, a new process is created which runs the code in that program. A process is an instance of a program

REF :: http://wiki.answers.com/Q/What_is_meant_by_process_in_computer_science

 

 

QNo.44 MIME meant?

Answer:-

MIME stands for Multi-purpose Internet Mail Extensions. 

MIME contains encoding features, added to enable transfer of binary data, e.g. images

(GIF, JPEG etc.) via mail. Using MIME  encoding HTTP can now transfer complex binary data, e.g. images and video.

REF :: handouts Page No.380

 

QNo.45 MIME define "Resource Only DLLs?

Answer:-

Resource Only DLL contains only resource of different language and local types. Resource only DLLs do not contain Entry Point or any DllMain Function.

Use of resource-only DLL is for internationalization

REF :: handouts Page No.322

QNo.46 How can I return multiple values from a function? Illustrate the concept using C++

                code (5 marks)

you can only return 1 variable using "return". there is a way to do what you want though. basically you pass the address of the "two" and "five" variables.
example:
int n, two, five;
fcnName(n, &two, &five) //no need to return anything
{
//your function code
}

 

QNo.47 If you include CS-DBLCLKS in your window call style, the windows procedure receives which message for double click. (Specify exact sequence)

Answer:-

CS_DBLCLKS class style. Your application must set this style when registering the window class. For more information, see Window Classes.

A double-click message is always the third message in a four-message series. The first two messages are the button-down and button-up messages generated by the first click. The second click generates the double-click message followed by another button-up message. For example, double-clicking the left mouse button generates the following message sequence:

REF :: handouts Page No.208

 

QNo.48How do I restrict my window so it can't be resized larger or smaller than a certain size? 

Answer:-

 

You restrict your window's size by handling the WM_GETMINMAXINFO message. Your handler receives a pointer to a MINMAXINFO struct, which you fill in with the minimum and/or maximum size for your window. Here is an example that keeps the window between 100x150 and 600x400 pixels in size.

 Collapse | Copy Code

LRESULT OnGetMinMaxInfo ( WPARAM wParam, LPARAM lParam )

{

MINMAXINFO* pmmi = (MINMAXINFO*) lParam;

 

  pmmi->ptMinTrackSize.x = 100;

  pmmi->ptMinTrackSize.y = 150;

  pmmi->ptMaxTrackSize.x = 600;

  pmmi->ptMaxTrackSize.y = 400;

 

  return 0;

}

In MFC, your OnGetMinMaxInfo() handler is passed a MINMAXINFO* directly, but otherwise the code is the same.

REF :: http://www.codeproject.com/Articles/1248/The-Code-Project-Visual-C-Forum-FAQ#ui_minmaxinfo

 


--
Zindagi mein 2 Logo ka buhat khayal rahkoooo
Ist woh jiss ney tumhari jeet ke Liye buhat kuch hara hoo
(Father)
2nd woh jiss ko tum ney har dukh me pukaara hoo (Mother)
Regards,
Umair Saulat Mc100403250

--
--
-------------------------------------------------------------
"VU CLUB" | Learning and Entertainment |
-------------------------------------------------------------
 
For study material join VU Club at:
http://vuclub.net & http://vuforum.net
 
To post to this group, send email to:
vu-club@googlegroups.com
 
For more options, visit this group at
http://groups.google.com/group/vu-club?hl=en?hl=en
 
Join us on Facebook:
http://www.facebook.com/#!/groups/190713217644560/
---
You received this message because you are subscribed to the Google Groups "VU CLUB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vu-club+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment