Tuesday, September 23, 2025

vc++

Unit-1
Unit Name

I. Each Question Carries 1 Mark.

1) VC++ is ________________.
a) A Package b) A Language c) An Application Framework d) None

2) VC++ is product of ___________
a) Microsoft b) Sun Micro c) IBM d) None

3) VC++ is having _____________editions
a) One b) Two c) Three d) None

4) ATL Stands for___________________.
a) Active Template Library b) Archive Transaction Library
c) Auto Transmission Library d) None

5) The area on the left side of developer studio, is the key to navigate the various pieces and parts of development projects.
a) Workspace pane b) Out pane c) Navigation pane d) None

6) ________________Allows to find and edit each of resource in the application.
a) Class view b) File view c) Resource View d) None

7) _______________Allows to view and navigate all the files of application
a) Class view b) File view c) Resource view d) None

8) Every Application project needs its own ___________________in VC++.
a) Directory b) Project workspace c) File d) None

9) Windows and other plat forms supports_______________API.
a) win32 b) win16 c) both d) None

10) How many steps are there to create an application through wizard.
a) 5 b) 7 c) 8 d) None

11) ________________allows to select multiple items.
a) Combo box b) List box c) None d) None

12) A combo box is a combination of __________,___________.
a) Combo box, list box b) Edit box, list box c) list box, group box d) None

13) A mnemonic is the ________________character.
a) Underlined b) bold c) both d) None

14) To add a Member variable MFC is providing_______________-.
a) MFC ATL Wizard b) class wizard c) both d) None

15) A Command Button is having by default_________________messages
a)BN_CLICKED,BN_DOUBLECLICKED b)BN_SELECT, BN_DBSELECT
c) Both a & b d) None

16) Update Data (TRUE) is used for get the _______________from the screen.
a) Old values b) Current values c) Both a & b d) None

17) ________________ member function is used for to enable or disable all controls.
a) Disable Enable() b) Enable Window() c)Both a & b d) None

18) A Mouse is having _________________messages
a) 10 b) 9 c) 8 d) None

19) Online Dialog() is a member function of___________________.
a) CWinDialog b) C dialog c) CDailogWindow d) None

20) ______________________ is Message Handler, which is going to use to handle a cursor.
a) C Cursor b) HCURSOR c) Both a & b d) None


21) HCURSOR is ________________.
a) Structure b) Class c) Union d) None

22) Set Cursor() member function requires __________________ message handler.
a) WM_CURSOR b) WM_SETCURSOR c) Both d) None

23) Set Icon() allows to set __________________ Icons.
a) Big, small b) only Big c) Only small d) None

24) The Set Timer() member function is having the following series of arguments
a) Clock Timer, No. of Events to be triggered , Address of callback
b) Address of callback, clock timer, No of Events to be triggered, Clock Timer
c) None

25) Which is the function to stop the timer.
a) Stop Timer() b) KillTimer c) StopperTime() d) None

26) How many timer one can run at the same time in an application.
a) Only One b) Only Two c) More than one d) None

27) Every application project needs its own project _____________.
a) Class View b) File View c) None

28) Every Dialog box starts with OK and cancel button but you can add as many of your own as you want.
a) True b) False c) Both a & b d) None

29) __________are used to select only one of a number related options.
a) Checkboxes b) Radio Buttons c) Both d) None

30) ________________action check boxes enables or disables the controls dealing with displaying the user message.
a) Enable Window b) Enable Message c) Disable Window d)Destroy Window


Each Question carries 2 Marks

1) A) Workspace is having _______________views after creating an application.
a) Class, Resource, File b) Class, Edit, File c) File, Code, Class d) None

B) _________________Allows to navigate and manipulate source code.
a) Source View b) Class View c) Resource view d) None

2) A) A ________________is used for to display compiler warnings, error messages, variables with their current values.
a) Work Space b) Out Pane c) Editor Ares d) None

B) Every Dialog box starts with ________, __________buttons.
a) Ok, Cancel b) Yes, No c) Ok, Cancel, Ignore d) None

3) A) Update Data() member function takes ____________.
a) Only One Argument b) Only Two Arguments c) Nil d) None

B) ______________are used to select only one of a number of related options.
a) Radio buttons b) Check boxes c) Edit boxes d) None

4) A) A_____ member function allows to open an other applications (like .exe files).
a) Win Exe() b) Win Exec() c) Open Exec() d) None

B) The Track Popup Menu, member of C menu function takes ________________.
a) Only Five b) Only Four c) Only Three d) None

5) A) __________is used to convert current position to a screen position.
a) Client To Screen (&m_ pPoint) b) ScreenToClient(&m_pPoint)
c) Both d) None



6) A) The standard toolbar contains most of the standard tools
a) True b) False c) Both a & b d) None

B) The application icon can be edited to display an image to represent the application
a) True b) Flase c) Both a & b d) None

7) A) Many window application will find buttons, checkboxes, text fields etc,. which are knows controls.
a) True b) False c) Both a & b d) None

B) A combination of edit and text box is called as list box
a) True b) False c) Both a & b d) None

8) A) A drop-down list box that contains list of items which are added
a) False b) True c) Both a & b d) None

B) A mnemonic is specified by placing an ampersand in front of the character while typing caption value.
a) True b) False c) Both a & b d) None

9) A) Every control is required a variable to interact with it
a) True b) False c) Both a & b d)None

B)The Update Data function take the data in the variables for updating
a) True b) False c) Both a & b d) None

10) A) We use Show Window() function to display or hide a specified window
a) True b) False c) Both a & b d) None

B) GetDlg Item() passed ID of the controls and returns object of that control.
a) True b) False c) Both a & b d) None

11) A) SW_SHOW allows to display a window in normal mode
a) True b) False c) Both a & b d) None

B) Win Exec ( ) requires two arguments such as filename, show mode
a) True b) False c) Both a & b d) None

12) A) The user may not interact with mouse and keyboard
a) True b) False c) Both a & b d) None

B) if( (n Flags &MK_LBUTTON)==MK_LBUTTON) it checks if left mouse button is clicked or not
a) True b) False c) Both a & b d) None

13) A) SetIcon(m_hIcon,1) to set small icon
a) True b) False c) Both a & b d) None

B) set Icon(m_hIcon,0) to set big icon
a) True b) Flase c) Both a & b d) None

14) A) Is char=char (n Char) it converts the key pressed to a character
a) True b) False c) Both a & b d) None

B) Load Standard Cursor() allows to load only standard cursors from operating system.
a) True b) False c) Both a & b d) None

15) A) AfxGetApp( ) provides all functions of current application
a) True b) False c) Both a & b d) None

B) To edit cursor we use WM_SETCURSOR
a) True b) False c) Both a & b d) None

16) BOOL C mouseDlg :: On Set Cursor(CWnd *p,UINT h,UINT msg) {} The third parameter tells how many times that windows thinks the key has been pressed. The process works by loading the cursor into memory.
a) True b) False c) Bo0th a & b d) None

17) A) When the user changes the cursor, default processing by passed and FALSE is returned.
a) False b) True c) Both a & b d) None
B) ________specifies to place WM_TIMER event in the application message queue.
a) NULL b) Reference Value c) Both a & b d) None



18) void CMouseDlg::OnTimer(IDEVENT)
{}
IDEVENT describes which timer triggered this event.
a) True b) False c) Both a & b d) None

19) Set Timer(ID_CLOCK,1000,NULL)
i) The second argument is tells us ho often event has to be triggered.
ii) The third argument is the address of an optional callback function.
a) True,False b) False, True c) True,True d) None


Each Question carries 4 Marks

1) VC++ does not support
i) Active Template Library
ii) MFC data binding
iii) Microsoft Transaction server
a) Only i & ii b) only iii c) Only iii, i d) None

2) i) Class view allows to navigate and manipulate your source code
ii) Resource view allows finding and editing each of resources in the application
iii) File view allows you to view and navigate all files of application
a) Only i & ii b) Only ii c) Only iii d) only i & ii & iii

3) Arrange the following statements to create simple application.
i) Generating project workspace
ii) Creating application framework using application wizard
iii) Rearranging the dialog created by application wizard to resemble the design we want
iv) Adding Finishing touches to the application
v) Adding the c++ code to show the greeting to the user.
a) i, ii, iii, iv, v b) i, ii, ii, v, iv c) iii, v, i, iv, ii d) None

4) i) Appwizard makes skeleton of the application and windows programs.
ii) Appwizard makes DLLs, Activex controls, console applications
iii) Appwizard makes libraries; make file, Internet server extensions and filters and more within short period.
a) Only i & iii b) only i, ii, iii c) only iii d) None

5) i) Many of the controls are built into the operating system itself.
ii) Check boxes are used to set options on or off.
iii) Every dialog box start with OK & NO buttons
iv) A combo box is a combination static text and edit box
a) Only i & ii b) Only ii & iii & iv c) Only iii & I d) None

6) Arrange the following steps that can be used to specify the tab order to move around the window
i) Select either the dialog window or one of the controls on the window in the editing area of the developer
studio
ii) Choose Layout Tab order from the menu. By turning on the tab order
iii) Using the mouse, click each of the number boxes in the order user have to navigate the window. The
controls will renumber themselves to match the new order
iv) To return to the layout edit, select layout/tab order once again
a) only i, iii, iv, ii b) all c) iv, ii, i d) None

7) Which are the following statements are true
i) A mnemonic is specified by placing an ampersand (&) in front of the character while typing the caption value.
ii) OnInitDialog() function return data type is BOOL
iii) The UpdateData function takes the data in the variables and updates the controls with the variable values.
iv) All controls are themselves windows
a) only i, iv b) only iii, iv c) only i, ii, iii d) All

8) Match the following descriptions
SET A SET B
i) WM_LBUTTONDOWN a) A key has been pressed down
ii) WM_LBUTTONUP b) The left mouse button has been pressed
iii) WM_KEYDOWN c) The Left mouse button has been released
iv) WM_KEYUP d) A key has been released
a) i-b, ii-c, iii-a, iv-d b) i-a, ii- b, iii- c, iv- d c) i- d, ii- a, iii-c, iv-b d) None




9) Which of the following code is true to draw a pixel on window when u move a mouse pointer.
i) void CmouseDlg::OnMouseMove(UINT nFlags, Cpoint point) { SetPixel(point.x, point.y, RGB(0,0,0)); }
ii) void CmouseDlg::OnMouseMove(UINT nFlags, Cpoint point) { CpaintDC dc(this); dc.SetPixel(point.x,
point.y, RGB(255,0,0)); }
iii) void CmouseDlg::OnMouseMove(UINT nFlags, Cpoint point) { CclientDC dc(this);dc.SetPixel(point.x,
point.y, RGB(0,0,0)); Cdialog::OnMouseMove(nFlags,point);}
a) only ii, iii b) only iii c) only i, iii d) None

10) Which of the following statement are true void CmouseDlg::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
i) The First argument is the character code of the character.
ii) The Second argument is the number of times key is pressed.
iii) The third argument tells how many times that window thinks the key has been pressed
a) only i true b) only i, ii true c) only i, ii, iii are true d) None

11) Which of the following statements are true.
i) The Timer events are placed only in the application event queue if that queue is empty and the application is
idle.
ii) Windows places timer event messages in the application event queue if the application is already busy.
iii) Windows places only a single timer message in the event queue.
a) only i b) only i, iii c) only i, ii, ii d) All

12) Which of the following statements are true MessageBox(“msg”,”msg”, msg);
i) The argument being the message to be displayed to the user.
ii) The second argument, being displayed in the title bar on the message box
iii) The third argument can be used to specify the buttons and icons to be presented to the user beside the
message.
a) only i b) only i, ii c) only iii, ii d) All

13) Which of the following statements are true
i) To update the window , it executes UpdateData(0)
ii) The method DoModal, does not waits for the user to click one of the two buttons on the dialog.
iii) Pull_down menu is common in windows based applications.
a) only i, iii b) only ii c) only i, ii,iii d) None

14) Which of following statements are true
i) Standard pull down menu, which is the submenu that opens to the right of menu entry and is similar to pull
down menu
ii) Cascading menu, which pops up in the middle of the application area, floating freely above the application
work are
iii) Context menu or popup menu, this menu drop down below the category, with number of menu entries to
trigger various functions
a) only i,ii,iii b) only ii c) only i, iii d) None

15) Find out the following code output
void CmenuDlg::OnOK()
{
Cstring str=”Acme “;
MessageBox(str=” “,””);
}

i) it displays message box with message
ii) it gives compile time error
iii) it gives run time error
iv) only message box with out message

a) only i b) only ii, iii c) only iv d) None















Key for 1 mark





1 c 2 a 3 c 4 a 5 a
6 c 7 b 8 b 9 a 10 c
11 b 12 b 13 a 14 b 15 a
16 b 17 b 18 b 19 b 20 b
21 a 22 b 23 a 24 a 25 b
26 c 27 c 28 a 29 b 30 b





Key for 2 Marks





1 A) a B) b 2 A) b B) a 3 A) a B) a 4 A) b B) a 5 A) a
6 A) a B) a 7 A) a B) a 8 A) b B) a 9 A) a B) a 10 A) a B) a 11 A) a B) a 12 A) b B) a 13 A) b B) b 14 A) a B) a 15 A) a B) b 16 a 17 A) b B) a 18 a 19 c






Key for 4 marks



1 D 2 D 3 B 4 B 5 A 6 B 7 D 8 A 9 B 10 C 11 B 12 D 13 A 14 D 15 C 16. A









nit-2

1) The windows operating system gives a number of preexisting dialog boxes known as _______________.
a) Dialog Boxes b) Message Boxes c) Edit Boxes d) None

2) Basically menus can be classified under __________categories.
a) Only One b) Only Two c) Only Three d) None

3) By default windows based applications are having __________________menu
a) Standard Pull down b) Cascading c) Popup or context d) None

4) Basically A keyboard shortcuts, or accelerators are having __________________combination.
a) Multiple Keys b) Single Key c) None

5) How many steps are there to add Context Menu.
a) One two steps b) only six steps c) Only eight steps d) None

6) The editor area is basically the entire developer studio area that is not occupied
a) Panes b) menus c) Tool bars d) All

7) A_______________is base class of MFC
a) Cdialog b) Cobject c) CDC d) None

8) API stands for
a) Application programming interface
b) Active programming interface
c) Automation programming interface
d) None

9) A_____________ contains information about attributes of device
a) Device Context b) Logical Context c) Both d) None

10) CclientDC, CpaintDC, CwindowDC, CMetafileDC are derived from
a) HDC b) CDC c) DDC d) None

11) The Create Font() member function takes ______________
a) Only 10 Arguments b) Only 13 arguments c) Only 14 arguments d) None

12) Default tool bar can be identified by
a) IDR_TOOLBAR1 b) IDR_MAINFRAME c) IDR_TBAR d) None

13) Wizard creates by default __________________ object for application.
a) Def app b) the App c) None

14) String table is used for
a) To maintain resource id’s information b) To maintain class view information
c) To maintain file view information d) None

15) _____________message raises when right mouse button has been double-clicked.
a) WM_RBUTTONDBLCLK b) WM_RBUTTONDBLCLICKED
c) WM_RBDOUBLECLK d) None

16) _______ message raises when left mouse has been released
a) WM_LBUTTONREL b) WM_LBUTTONUP c) WM_LBUTTONEXIT d) None

17) __________ message raises when key has been pressed down.
a) WM_KEYPRESS b) WM_KEYDOWN c) Both d) None

18) _______________member function is used to get the current time.
a) GetTimeNow() b) GetCurrentTime() c) Now() d) None

19) Reset Content() is used for _____________.
a) To reset the values b) To Clear the values c) Both d) None

20) What is the use of the following statement m-fSampFont.Detach()
a) To release the current font b) To create new font
c) Both d) None


21) ___________ is used to set the font.
a) Add Font(&font) b) SetFont(&font) c) AttachFont(&font) d) None

22) ________ specifies the output quality and how carefully the GDI must attempt to match the logical font attributes to the physical font output.
a) CLIP_MASK b) PROOF_QUALITY c) OUT_PRECIS d) None

23) The DoModal() waits for the user to click one of the two buttons on dialogs box.
a) OK & No b) Yes & Cancel c) ok & cancel d) None

24) Basically menu’s can be classified into ___ categories
a) 1 b) c) 3 d) None

25) The Hotkeys are ________ that are underlined in each menu entry.
a) Letters b) Numbers c) Special Chars d) None

26) Adding function to the menu it we use _________
a) COMMAND b) UICOMMAND c) ID_COMMAND d) None

27) LOGFONT is a___________
a) Structure b) Class c) Data Type d) None

28) ENUMLOGFONTEX is a___________
a) Structure b) Class c) Data Type d) None

29) ResetContent() is used to ________
a) to set contents b) to make ascending order c) to clear contents d)None

30) which is list box notify handler
a) LBN_SELCHANGE b) LBS_CHANGE c) CBS_CHANGE d)None


2-marks

1) The following statement m_1Menu=GetMenu() ; is used for
a) To get a pointer to the window menu
b) To get a pointer to the first sub menu
c) To get a pointer to the parent window
e) None

2) A) Dialog boxes are divided into ___________categories.
a) Only One b) Only Two c) Only Three d) None

B) The resource compiler creates….
a) Executable (.res) files b) Object (.obj) files c) Script (.rc) files d) None

3) A) Mainly the device context used two resources to perform most of ___________
a) Drawing, graphic functions b) graphic, device functions
c) None

B) What is the constant value for OEM_CHARSET
a) 0 b) 2 c) 255 d) None

4) A) which is class to create font
a) C Font b) LOGFONT c) HFONT d) None

B) _____________Makes the pop_up menu triggered from the left mouse button.
a) TPM_RIGHTBUTTON b) TPM_LEFTBUTTON c) TPM_LBUTTON d) None

5) A) __is the primary resource tool for drawing any kind of line onscreen.
a) Cbrush b) Cpen c) Cline d) None

B) ____________specifies to draw a dotted line
a) PS_DOTTED b) PS_DOT c) PS_DASDOT d) None

6) A)________allows to create brushes which define filling of areas.
a) CRBrush b) Cbrush c) both d) None

B)What is Use of the following statement m_bmpBitmap.Attach(hBitmap)
a) To Attach the currently loaded bitmap to the bitmap object
b) To Remove current bitmap from bitmap object
c) None

7) The device context is one , which contains information about ____
a) System b) Window c) both d) None

8) The Bitmap will take
a) 8 – by 8 pixels b) 8 by 8 square c) both d) None

9) Cbitmap class requires ___________structure
a) HBITMAP B) CBITMAP C) Both d) None

10) CpaintDc calls automatically BeginPaint and EndPaint
a) True b) False c) Both a & b d) None


4 Marks Questions


1) To display TrackPopuMenu we use the following code is
i) void CmenuDlg::OnContextMenu(CWnd * pwnd, Cpoint point)
{ CMenu *m ; CPoint px; px=point; ClientToScreen(&px);
m=GetMenu(); m=m->GetSubMenu(0);
m->TrackPopupMenu(TPM_CENTERALIGN,px.x, px.y, this, NULL);
}
ii) void CmenuDlg::OnContextMenu(CWnd * pwnd, Cpoint point)
{ CMenu *m ; CPoint px; px=point; ClientToScreen(&x);
m->TrackPopupMenu(TPM_CENTERALIGN,px.x, px.y, this, NULL);
}
iii) void CmenuDlg::OnContextMenu(CWnd * pwnd, Cpoint point)
{ CMenu *m ; px=point; ClientToScreen(&x);
m=GetMenu(); m=m->GetSubMenu(0);
m->TrackPopupMenu(TPM_CENTERALIGN,px.x, px.y, this, NULL);
}
a) only i b) only i, iii c) only ii d) None

2) Which of the following statements are true
i) The fourth argument of Track Popup Menu function is a pointer to the window that receives the menu
command messages.
ii) By passing Null argument as a last parameter through Track Popup Menu we can close popup menu
when we click out side of that.
iii) Enum Font Proc is used to receive the list of fonts.

a) only i b) only i, ii c) All d) None

3) Which of the following statements are true
i) The EnumFontFamiliesEx function is used to receive the list of fonts
ii) The EnumFontProc is used to request the list of available fonts.
iii) On Creation of callback function, it must be defined as an independent function..
a) only i b) only ii c) only iii d) All

4) Which of the following statements are true
i) FONTENUMPROC is structure, which contains the information about devices contexts
ii) LOGFONT is structure , which contains the information about the fonts that has to be listed.
iii) EnumFontFamiliesEx function takes 6 arguments
a) only i b) only ii c) only iii d) None

5) Match the following descriptions with A & B
SET A SET B
i) FW_DONTCARE d a) it specifies the pitch and family of the font.
ii) OEM_CHARSET c b) it specifies how closely the output must
match the requested font height, width,
orientation, escapement
iii) OUT_RASTER_PRECIS b c) it specifies the font character set
iv) FIXED_PITCH a d) it specifies the font weight

a) i-d, ii-c, iii-b, iv-a b) i-a, ii-b, iii-c, iv-d c) i-d, ii-a, iii-c, iv-b d) None


6) Which of the following statements are true
i) C pen, the instance of this class is used to specify the color and width for drawing lines on screen.
ii) C brush, allows to create brushes which define filling of areas.
iii) C bitmap class is using the resource ID of the bitmap
iv) Group box control allows to set group of control like radio, check buttons
a) only i, ii, iii, iv b) only ii, iv c) only i, iii d) None

7) Which of the following code is true to attach the image to bigmap
i) HBITMAP hbitmap= LoadImage(AfxGetInstanceHandle(), filename, image_bitmap, 0,0,
LR_LOADFROMFILE, LR_CREATEDIBSECTION); M_bitmap.Attach(hbitmap);
ii) HBITMAP hbitmap= LoadImage(AfxGetInstanceHandle(), filename, image_bitmap, 0,0,
LR_LOADFROMFILE, LR_CREATEDIBSECTION);M_bitmap.Detach(hbitmap);
iii) HBITMAP hbitmap= LoadImage(AfxGetInstanceHandle(), filename, image_bitmap);
M_bitmap.Attach(hbitmap);
iv) HBITMAP hbitmap=(HBITMAP):: LoadImage(AfxGetInstanceHandle(), filename, image_bitmpa, 0,0,
LR_LOADFROMFILE, LR_CREATEDIBSECTION); M_bitmap.Attach(hbitmap);
a) only i , iv b) only ii, iii c) only iv d) None

8) What is output of the following code
M_dlg is instance variable of CDialog
BOOL CgraphicsDlg::OnInitDialog()
{
Cdialog::OnInitDialog();
UpdateData(0);
M_dlg.Create(IDD_HAI_DLG, this);
M_dlg.ShowWindow(SW_SHOW);
return 1;
}
i) it displays DoModal dialog box and closes automatically
ii) It displays domodal dialog box , it waits for user to click a button
iii) it displays Modeless dialog box , it waits for user to click a button
iv) it displays Modeless dialog box , closes automatically
a) only ii b) only iii c) only iv d) only i

9) Which of the following statements are true
i) Whenever a window needs to be redrawn, it calls OnPaint() member function
ii) OnPaint() is member function of CclientDC class
iii) OnPaint() function explicitly calls Invalidate()
iv) ON_WM_PAINT is message handler of OnPaint()
a) only i, ii, ii b) only i, iii, iv c) All d) None

10) What is use of the following code
void CgraphicsDlg::OnLButtonDown()
{
UpdataData(1);
m_dlg.Invalidate();
}
i) It terminates the window
ii) It displays error for user i.e. the window is not valid.
iii) It Repaints the window
a) only i, ii b) only ii c) only iii d) None

11) Match the following color description with A & B
SET A SET B
i) RGB(0,0,0) a) Black
ii) RGB(255,255,255) b) White
iii) RGB(0,255,255) c) Cyan
iv) RGB(255,0, 255) d) Magenta
v) RGB(255,255,0) e) Yellow

a) i-a, ii-b, iii-c, iv-d, v-e b) i-e, ii-d, iii-c, iv-b, v-a c) i-a, ii-e, iii-c, iv-b, v-d d) None

12) Which of the following statements are true
i) Cpen mypen(PS_SOLID, 1, RGB(255,0,0));
ii) Cbrush mybrush(HS_DIAGCROSS, RGB(255,255,0));
iii) Cbrush mybrush(RGB(192,192,192));
iv) Ellipse function draws a only ellipse
a) only i, ii, iii b) only ii, iii, iv c) only ii, iv d) None


13) Which of the following statements are true
i) CfileDialog file(1,”.bmp”,bitmap,OFN_HIDEREADONLY,szFilter)
ii) CDC dc; CpaintDC *pc; dc.CreateCompatibleDC( pc)
iii) Pc->StretchBld(10,10,5,5,2)
iv) ShowBitmap(&dc);
a) only i, ii b) only iii, iv c) only iv d) None

14) If (dilaog.DoModal()==IDOK)
a) it displays only dialog box b) it capture the result
c) both d) None

15) I) bitmap.Detach() to detach the bitmap
ii)bitmap.DeleteObject() to remove the current bitmap select which are the true statements
a) I b) ii c) Both d) None


One Marks Answers



1 B 2 C 3 A 4 B 5 B
6 A 7 B 8 A 9 B 10
11. 12. 13 14 A 15 A 16 B 17 B 18 B 19 B 20 B
21 A 22 B 23 C 24 C 25 A
26 A 27 A 28 A 29 C 30 A




Two Marks Answers




1 a 2 A) b B) b 3) A) a B) b 4 A) a B) b 5 A) b B) a 6 A) b B) a 7 a 8 C 9 a 10 a




4 Mark Questions




1 A 2 C 3 C 4 D 5 A
6 A 7 A 8 B 9 B 10 C 11 A 12 A 13 D 14 C 15 C






Unit 3

VC ++ BITS
ACME COLLEGE OF IT
MALAKPET, HYDERABAD
_____________________________________________________________

Each Question carries 1 mark


1) An ActiveX control is a_____________________
a) Hardware component b) software component c) both d) None

2) An ActiveX used to be called____________
a) OLE 2.0 b) OLE 2.1 c) OLE d) None

3) The ActiveX technology is built on top of Microsoft ________ technology
a) COM b) ECOMM c) Both d) None

4) I Dispatch is an
a) Interface b) function c) Procedure d) None

5) An ActiveX server can also be an ___________
a) ActiveX Container b) ActiveX Server c) Both d) None

6) Internet Explorer is implemented as an_____________
a) ActiveX Server b) ActiveX Container c) interface d) None

7) ActiveX controls can not run on their own and must be embedded within ______
a) ActiveX Container b) ActiveX Server c) Both d) None

8) I dispatch is also known as __________
a) Interaction Dispatch b) Disp interface c) Internet Disp d) None

9) The Container provides _______Idispatch interfaces to the control.
a) Only One b) Only Two c) Only Three d) None

10) To interaction between the ActiveX container and an ActiveX control takes place through ____________Idispatch interfaces.
a) Only One b) Only Two c) Only Three d) None

11) To Register a control with operating system what type of coding is used
a) c:\windows|system>regsvr32 myctl.ocx b) c:\windows|system>regsvr32 myctl.exe
c) c:\windows|system>regs myctl.ocx d) None

12) what is the memberfunction to get the number of columns from flexgridcontrol
a) GetCols() b) GetTotCols() c) GetNumCols() d) None

13) To Redraw back on flex grid_____is used
a) SetDraw(position) b) SetRedraw(FALSE) c) SetRedraw(1) d) None

14) ___________provided the functionality of a edit box control. Can be used to implement simple text_editor functionality.
a) Clist View b) CtreeView c) CeditView d) None

15) A____________class dynamically sizes itself to accommodate the number of items placed in it.
a) CobArray b) Carray c) both d) None

16) ___________ is the class that displays visual representation of the document for user.
a) Cdocument b) Cview c) ClistView d) None

17) SDI stands for_____________
a) Single Document interface b) Serial Document interface c) both d) None

18) CsingleDocTemplate class is used to create_________.
a) MDI b) SDI c) None


19) A______class is used to create multiple document.
a) CmultiDocTemplate b) CmdiDocTemplate c) CmultipleDocument d) None

20) SetModifiedFlag() is used to make a document as ______________
a) Exe file b) Res file c) Directory d) None

21) To capture the mouse we use
a) SetCapture() b) GetCapture() c) LoadCapture() d) None

22) PaintBrush applicatin is a example for________
a) MDI b) SDI c) Both d) None

23) To get a pointer to the Document object we use
a) Get Document () b) GetObjDocument() c) SetDocument() d) None

24) The MessageMap for menu item is____________
a) ON_MENUITEM b) ON_COMMAND c) both d) None

25) The MessageMap for OnLButtonDown function is __________
a) ON_LBUTTONDOWN b) ON_WM_LBUTTONDOWN c) None

26) The Message Map for OnTimer function is _____________
a) ON_WM_TIMER b) WM_TIMER c) None

27) Cbitmap class allows to load __________dynamically from files on the system disk.
a) bitmap images b) jpg files c) mpeg files d) None

28) The Invalidate() is member function of______________
a) CWnd b) Cbitmap c) CcpaintDC d) None

29) ___________is message handler of OnCreate() member function
a) ON_CREATE b) WM_CREATE c) ON_WM_CREATE d) None





Key for 2 Marks

1) A) What is use of the following statement object. Serialize (array)
a) Pass the serialization on to the object array b) To create an object
c) None

B) Serialize function requires the address of _______________ as argument
a) C Archive b) Cob Array c) both d) None

2) A) To implement serialization we use
a) DECLARE_SERIAL,IMPLEMENT_SERIAL b) BEGIN_SERIAL, END_SERIAL
c) Both d) None

B) IMPLEMENT_SERIAL requires ________________arguments
a) Only One b) Only Two
c) Only Three d) None

3) A) To check or uncheck a menu item we use
a) GetCheck() b) SetCheck() c)PutCheck() d) None

B) OLE stands for
a) Object Linking Embedding b) Object Linking electronics
c) None


4) A) COM stands for
a) Component Object Model b)Component Object Module c) None

B) To Create Tool Bar we use
a) C tool Bar b) C tool c) C tool Menu d) None

5) A)___________allows to create a tool bar that can have multiple rows of buttons
a) TBSTYLE_BUTTONS b) TBSTYLE_WRAPABLE c) Both d) None

B) _____________message handler places a border on the bottom edge of the tool bar when the top of
the toolbar is not docked
a) TBSTYLE_BORDER_BOTTOM
b) CBRS_BORDER_BOTTOM
c) None

6) A) ______ toolbarfunction enables the toolbar for docking with the frame window.
a) EnableDock() b) EnableDocking() c) EnableWindow() d) None
B) CtoolBar is derived from a) Cwnd b) CframeWnd c) Cbrush d) None
7) A)______function is used to hide the tool bar. a) HideControlBar() b) ShowControlBar() c) Both d) None
B) ShowControlBar() requires __________arguments a) Only one b) Only two c) Only Three d) None

8) A) COLORREF is a structure data type for ______________function
a) RGB() b) BGR() c) Both d) None

B) ______________is used to control the behaviour of toolbar butons
a) GetButtonStyle() b) SetButtonStyle() c) Both d) None

9) A) To get the index of tool bar butons we use.
a) IndexButtonToolBar() b) CommandToIndex() c) None

B) To pass the address of the tool bar we use
a) ToolBarAddBar() b) DockControlBar() c) None

10) A) To load a toolbar we use
a) GetToolBar() b) ReceiveToolBar() c) LoadToolBar() d) None

B) ______class allows to get the rectangular co ordinates
a) CCRect b) Rect c) Crect d) None

11) A) LoadString is member function of
a) ClistBox b) CcomboBox c) Cstring d) None

B) SetButtonInfo member function takes _________arguments
a) 1 b) 2 c) 4 d) None

12) A) To add horizontal scrollbar to the window we use
a) WS_HSCROLL b) WS_HORIZSCROLL c) None

B) ON_CBN_SELCHANGE is message handler of ____________
a) ClistBox b) CcomboBox c) Both d) None

13) A) To get the index of current selected item from the combo box we use
a) SetCurSel() b) GetCurSel() c) CurIndexSel() d) None

B) What is the use of the following statement
Cview *v=GetNextView(position)
a) To get a pointer to the view in that position
b) To Read document information from that position
c) Both
d) None




14) A) OnDrarw() is member function of ________
a) Cview b) Cdocument c) Both d) None

B) 143.BEGIN_MESSAGE_MAP() requires ________arguments
a) 1 b) 2 c) 3 d) None

15) A) BEGIN_MESSAGE_MAP(___,____) is having the series of parameters
a) Derived b) Base c) Both d) None

B) BEGIN_MESSAGE_MAP(), END_MESSAGE_MAP should be defined in
a) header file b)source file c) Both d) None

16) A) DECLARE_MESSAGE_MAP is declared in.
a) header file b) source file c) None

B) To Create a label control we use
a) Edit Box b) Combox Box c) StaticText d) None

17) A) To Create a Edit box we use
a) Cedit b) CeditBox c) Both d) None

B) To Create a ProgressBar we use
a) CprogressBar b) CprogressCtrl c) None






4 Marks
1) Which of following statements are true
i) An activex control is a software component that can be plugged into many different programs and used
as if it were a native part of program.
ii) ActiveX used to be called OLE 2.0 , whicn as MS technology for combining two or more applications to
make them work as one
iii) The activex technology defines a layer that is built on top of COM, what interfaces various objects
should support, and how different type of objects should interact.
iv) Automation enables an application embedded within another application to activate itself and control its
part of the user interface or document.
a) only i, iv b) only iii, ii c) only iv d) All the above

2) Which of the following statements are true
i) Idispatch allows to the automation, which consists of a pointer to a table of available methods that can
be run in the Activex control or embedded application.
ii) The Container provides three Idispatch interfaces to the control
iii) The first Idispatch interface argument is used by control to trigger events in the container application.
a) only i, ii b) only ii, iii c) only i, iii d) None

3) i) Some activex servers are also applications that can run on their own.
ii) Before adding the active x control to the window, control has to be registered with both windows and
visual c++
iii) The cells in the flexgrid control are numbered sequenctially from left to right, top to bottom.
a) only i, iii b) only ii, iii c) only i, ii, iii d) None




4) Match the following descriptions with A & B
SET A SET B
i) CeditView a) It provides scrolling capabilities to a Cview class
ii) CtreeView b) it provides character and paragraph formatting
functionality
iii) ChtmlView c) The base class for views containing controls.
Iv) ClistView d) it provides the functionality of edit box
a) i-a, ii-b, iii-c, iv-d b) i-b, ii-d, iii-c, iv-a c) i-c, ii-a, iii-d, iv-b d) None

5) Which of the following statements are true
i) Each catch section specifies the type of exception it handles.
ii) A try section can be placed around the code
iii) GetSize() is member function of CobArray class
iv) Adding the functionality to save and restore the drawings known as serialization
a) only i, iii b) only ii, iv c) only i, ii, iii d) All

6) which of the following statements are true
i) An MDI application uses a window_in_a_window style, where there is a frame window around one or
more child windows.
ii) Architecturall, an MDI application is similar to an SDI application.
iii) ON_COMMAND_RANGE,ON_UPDATE_COMMAND_UI_RANGE , are standard message map entries,
but the class wizard does not support.
iv) When using the ON_COMMAND_RANGE message map entry, the event message ID is automatically
passed as an argument to the event handler fuction.
a) only i, iv b) only iii, ii c) only i, ii, iii d) All

7) Which of the following statements are true
i) A tool bar is small band attached to the window frame or dialog that is floating independent of the
application frame.
ii) We can display a tool bar top of the window only
iii) The LoadToolBar, requires the ID for the toolbar that is to be created
a) only i, ii, iii b) only ii c) only iii d) None

8) Match the following descriptions with A & B

SET A SET B

i) TBSTYLE_ALTDRAG a) it creates a tool tip control that can be used
to display descriptive text for the window
ii) TBSTYLE_FLAT b) it Button text appears to the right of the
bitmap image
iii) TBSTYLE_LIST c) creates a flat toolbar. Button text appears
under the bitmap images
iv) TBSTYLE_TOOLTIPS d) allows the user to move the tool bar by
dragging it while holding down the Alt key

a) i-a , ii-b iii-c iv-d b) i-d, ii-c iii-b d-a c) i-a, ii-d, iii-c iv-b d) None

9) Match the following descriptions with A & B

SET A SET B

i) CBRS_BORDER_TOP a) Places a border on the top edge of the
toolbar when the top of the toolbar is not
docked
ii) CBRS_BORDER_FLYBY b) Causes status bar message text to be
updated for the toolbar buttons at the
same time as the tooltips
iii) CBRS_GRIPPER c) Causes a gripper to be drawn on the
toolbar
iv) CBRS_TOOLTIPS d) Causes ToolTips to be displayed for
the toolbar buttons

a) i-a, ii-b, iii-c, iv-d b) i-d, ii-c, iii-b, iv-a c) i-a, ii-d, iii-c, iv-b d) None






10) Which of the following statements are true.
i) TBSTYLE_CHECK creates a button that acts like a checkbox, toggling between the pressed and
un pressed state
ii) TBSTYLE_NOPREFIX, the button text will not have an accelerator prefix associated with it
iii) TBSTYLE_GROUP, creates a button that remains pressed until another button in the group is pressed
iv) TBSTYLE_SET, creates a seperator, making a small gap between the buttons on either side.
a) only i, iv b) only iii, ii c) All d) None

11) Match the following descriptions with A & B
SET A SET B

i) CBS_HASSTRING a) The owner of the list box is responsible for
drawing the list box contents. The
contents of the list are variable in height
ii) CBS_OEMCONVERT b) The owner of the list box is responsible for
drawing the list box contents. The list box
items consist of strings.
iii) CBS_OWNERDRAWFIXED c) Text entered in the edit control is
converted from ANSI to the OEM character
set & then back to ANSI.
iv) CBS_OWNERDRAWVARIABLE d) The owner of the list box is responsible for
drawing the list box contents. The contents
of the list are fixed in height.
a) i-a, ii-b, iii-c, iv-d b) i-b, ii-c,iii-c,iv-d c) i-d, ii-c, iii-b, iv-d d) None




Key For 1 Mark


1 b 2 a 3 a 4 a 5 a 6 a
7 a 8 b 9 b 10 c 11 a 12 a
13 b 14 c 15 a 16 a 17 a 18 b
19 d 20 c 21 b 22 b 23 a 24 b
25 b 26 a 27 a 28 a 29 c




Key For 2 marks


1. A) a B) a 2.A) a B) c 3. A) b B) b 4. A) a B) a 5. A) b B) b 6. A) b B) a
7. A) b B) c 8. A) d B) b 9. A) b B) b 10. A) c B) c 11. A) c B) c 12. A) a B) b
13. A) b B) a 14. A) a B) b 15. A) c B) b 16. A)a B) c 17. A) a B) b



Key for 4 marks


1. D 2. C 3.C
4. D 5. D 6. D 7. A
8. B 9. A 10. C 11. A





Unit 4

One Marks Questions

1) DAO stands for
a) Data Active Object b) Data Access Object c) both d) None

2) ADO stands for
a) Active Data Object b) ActiveX Dynamic Object c) ActiveX Data Object d) None

3) Serialisation is having two parts they are___________
a) Serialisation, de_serialization b) Serialisation, Un serialization
c) None

4) When application data is stored on the system drive in the form of a file, then it’s called
a) Serialization b) De_Serialisation
c) Un Serialisation d) None

5) When the application state is restored from the file, then it’s called
a) Serialisation b) De_Serialisation c) Un Serialisation d) None

6) Serialisation in visual c++ application is accomplished through the____
a) C serial b) CD serial c) C archive d) None

7) The C archive class is designed to act as an_____________ stream for a C file Object
a) Input b) Output c) both d) None

8) The C archive class can not exist without a _____________class object.
a) C archive b) C file c) C data d) None

9) Is Storing() or Is Loading() are Member function of _________
a) C file b) C data c) C archive d) None

10) ADO objects are divided into ___________types.
a) 1 b) 2 c) 3 d) 6

11) ___________is not a object of ADO .
a) Connection b) Command c) Field d) None

12) _____________object used for establishing and maintaining a connection to a database
a) Connection b) Record set c) Field d) None

13) ____________ object willl have error information from the database.
a) Data Error b) Error c) Error Data d) None

14) To Execute SQL statements we use
a) Run SQL object b) Command object c) Execute SQL object d) None

15) _______object is used for passing variables and for calling stored procedures.
a) Procedure b) parameter c) Stored Data d) None

16) ________object represents a single column in the Record Set and contains the column name, data value.
a) Column b) Row Column c) Field d) None

17) A Field Object always contain a ___________data type value.
a) Int b) Static INT c) variant d) None

18) A link between vc++ and database
a) ODBC b) OLE c) ActiveX d) None

19) ________allows to import active x DLL
a) #import b) #include c) #elf d) None

20) ActiveX files are having an _____________extention name
a) .exe b) .res c) .ocx d) None




21) To Initialize COM environment for the application we use
a) Co Initialize (NULL) b) Com Initialize() c) Init Com Env() d) None

22) To shut down the COM environment by calling the ____________function.
a) Shutdown() b) Init Shut Down() c) Co Un initialize() d) None

23) Connection PTR is used to____________
a) to create a connection to the database b) to close the connection
c) None


Key Form I mark

1.B
2. C 3. A 4. A 5. B
6. C 7. C 8. C 9. C
10. D 11. 12. A 13. B
14. B 15. B 16. C 17. C
18.A 19.A 20. C 21. A
22. C 23. A



Each Question carries 2 Marks

1) A)ODBC is __________
a) An Interface b) A Structure c) Macro d) None

B) A______ class contains the database connection information.
a) C Database b) C record Set c) Both d) None

2) A) A_______class will run the query and maintain the set of records that are return by the database
a) C Database b) C record Set c) Both d) None

B) ____allows only to read_only set of records that can only be scrolled from the first to the last record
a) C record Set :: forward Only b) C record set :: Dina set
c) C record Set ::dynamic d) None

3) A) _____is used to move a specific number of records from the current record or from the first record in the set.
a) Move Previous b) Move To c) Move d) None

B) ____function return the number of records in the record set
a) Get Count() b) Get Count Record() c) Get Record Count() d) None

4) A) The Set Absolute Position function takes _________
a) 1 argument b) 2 arguments c) 3 arguments d) None

B) _____allows to moves the specified number of rows from the current row.
a) SQL_FETCH_NEXT b) SQL_FETCH_NOROW c) SQL_FETCH_ABSOLUTE d) None

5) A) ____allows to return the current SQL query to refresh the record set.
a) Refresh() b) Re Query() c) Re SQL() d)Re Retrieve()

B) What is the use of the given following statement.
CrecordSet *p=OnGetRecordSet()
a) To get a pointer to the record set b) To get a pointer to the record view
c) To get a pointer to the database d) None

6) A) _______technology was intended to be much more than simply a way of getting data into and out of databases.
a) ODBC b) DAO c) OLEDB d) None

7) A) PCH stands for
a) Precompiled header file b) Post compiled header file c) Both d) None

B) The ID of MB_OK
a) IDOK b) IDYES c) Both d) None

8) A) MB_ABORTRETRYIGNORE displays ______buttons on message box
a) yes, no, ignore b) ok, no, ignore c) abort, retry, ignore d) None

B) _________Dialog box does not allow to remove with out access
a) Do Modal b) Modeless c) None

9) A) To display Modal dialog box we use
a) Do Modal() b) Create Dialog() c) Both d) None

B)____raises when context menu button is pressed
a) WM_CONTEXTMENU b) ON_CONTEXTMENU c) None

10) A) A ______class allow to invoke menu member functions
a) HMENU b) C menu c) Both d) None

B) Load Menu() is used for
a) To Load a Menu b) To Load Popup menu c) None

11) A) What is the use of the following statement
menu.GetSubMenu(0)
a) To get the first sub menu b) To get the second sub menu
c) None

B) _________ is used to add menuitems, popupmenu’s to the menu bar
a) AppendMenuItem() b) AddMenuItem() c) AddPopupmenu() d) None

12) A) All menu’s in menu bar index starts with ____
a) 1 b) 0 c) 3 d) None

13) A) OnNewDocument()is a function of
a) Cdocument b) Cview c) Both d) None

B). OnNewDocument() function return type is ________
a) BOOL b) Boolean c) Cdocument d) None

14) A) CADORecordBinding does not have ___________
a) Constructor b) Destructor c) Both d) None.

B) What is use of given statement
Carchive &ar<a) To Write b) To Read c) Both d) None

15) A) SetIndicators() is member of function of_____,which is going to use to add panes.
a) CtoolBar b) CstatusBar c) Cmenu d) None

16) A) CMDIChildWnd is derived from ______
a) CchildFrame b) CMDIChild c) CframeWnd d) None

B) CreateInstance() is used to pass the UUID of the ____________object.
a) Connection b) RecordSet c) Field d) None

17) A) CommandText is a property of ___________object
a) RecordSet b) Command c) Connection d) None

B)______class will have only series of macros, along with number of variables.
a) CADORecordBinding b) CADORecordVtr c) CADORecord d) None

18) A) IADOAecordBinding is__________
a) an interface b) memberfunction c) Structure d) None

B) BEGIN_ADO_BINDING,END_ADO_BINDING are used to access
a) data values b) interfaces c) database objects d) None

19) A) BEGIN_ADO_BINDING is macro, which takes the _______ as its only parameter.
a) class name b) function name c) None

B) ADO_FIXED_LENGTH_ENTRY is _________
a) a macro b) a structure c) a class d) None


20) A) ADO_NUMERIC_ENTRY allows____________fileds.
a) Text b) Variant c) Numeric d) None

B) _Variant is ___________data type
a) variant b) Numeric c) character d) None

21) A) UUID stands for
a) Universal Unique Identification b) User unique Identification
c) None

B) CADORecordBinding is a class, which in defined in the _________header file.
a) afxado.h b) afxwin.h c) icrsint.h d) None

22) A) The set of macros are closed by the ______________
a) CLOSE_ADO_MACROS b) END_ADO_BINDING c) END_ADO_MACROS d) None

B) varchar is nothing but
a) variable_length character string b) variable fixed character string
c) character string d) None

23) A) ActiveConnection is a property of
a)__ConnectionPtr b) __CommandPtr c) __RecordSetPtr d) None

B) ADO is intended to use in _______________scripting languages.
a) Sun Micor b) Microsoft’s c) AT&T d) None
24) OnDraw() member function takes ________class object.
a) CDC b) Cpoint c) Cbitmap d) None


Key for 2 marks

1 A) a B) a 2 A) b B) a 3 A) c B) c 4) A) a B) d 5 A) b B) a
6 A) c 7 A) a B) a 8 A) c B) a 9 A) a B) a 10 A) b B) a
11 A) a B) a 12 A) b 13 A) a B) a 14 A) d B) a 15 A) a
16 A) b B) a 17 A) b B) a 18 A) a B) a 19 A) a B) a 20 A) c B) a
21 A) a B) c 22 A) b B) a 23 A) a B) b 24 A) a





PART -C
Each Question carries 4 Marks

1) which of the following statements are true.
i) The GetNextView, returns a pointer to the view specified by the position
ii) The Status bar can be provided about what the user is doing, where in the document user is editing
iii) ON_COMMAND() requires two arguments
iv) The SetIndicators function is called on the statusbar to add panes as they are defined in the indicators
table.
a) only i, iv b) only ii, iv c) i, ii, iii d) all

2) which of the following statements are true
i) vc++ provides five different technologies for using and accessing database.
ii) Carchive uses c++ streams to enable efficient data flow to and from the file that is the storage of the
application data.
iii) Serialization is having combination of five parts.
a) only i, ii, iii b) only i, iii c) only ii d) None

3) which of the following statements are true
i) Passing the serialization object that is used to write to or read from the file.
ii) A serialization function can be placed in any classes
iii) The DECLARE_SERIAL macro takes a single argument, the class name.
a) only i, ii b) only ii, iii c) only i, ii, iii d) None

4) which of the following statements are true
IMPLEMENT_SERIAL(CmyClass, Cobject, 1)
The above arguments are determines

i) First : the class name, as in the DECLARE_SERIAL macro
ii) Second: argument is the name of the base class, from which class is inherited
iii) Third: Version number that can be used to determine whether a file is the correct version for reading
into the application.
a) only iii b) only ii c) only i d) All

5) which of the following statement are true
i) when creating a form based application, it is assumed that application will not hold multiple record in the
form .
ii) The GetFirstViewPosition function is used to get the position of the view object
iii) When opening an existing data set, there should be add new records
a) only i, ii b) only ii c) only ii, iii d) None

6) Which of the following statements are true
i) IsBOF returns TRUE if the current record is the first record in the set
ii) IsEOF returns TRUE if the current record is the last record in the set
iii) Requery returns the current SQL query jto refresh the record set
iv) The Move function will take two arguments
a) only i, iv b) only iii, ii c) All d) None

7) Match the following descriptions
SET A SET B
i) SQL_FETCH_RELATIVE a) Moves to the previous row
ii) SQL_FETCH_PRIOR b) move the specified number of rows
iii) SQL_FETCH_LAST c) moves to the last row
iv) SQL_FETCH_ABSOLUTE d) move the specified number of rows from
the start of the set of rows
a) i-a, ii-b, iii-c, iv-d b) i-b, ii-a, iii-c, iv-d c) i-d, ii-a, iii-c, iv-b d) None

8) which of the following statements are true
i) The connection object is having the information of database connectin,database location,user
id,password before opening the connection.
ii) The error object will have the error information from the data base, whenever database error occurs
iii) The Record Set object contains a set of records from the database the Parameter object is used for
passing variables and for calling stored procedure.
a) only i, ii, ii b) only iv c) All d) None

9) Which of the following statements are true
i) The #import pre_compiler directive is used to import any .exe files
ii) Before using any of the ADO objects, the COM environment has to be initialized
iii) The ADO_FIXED_LENGTH_ENTRY macro is used for any database fields that are not fixed in size.
a) only i, ii, iii b) only i, iii ) only ii d) None

10) Which of the following code is true to import ADO DLL
i) #import “c:\program Files\Common Files\System\ADO\msado15.dll”
ii) #import “c:\program Files\Common Files\System\ADO\msado15.dll”
rename_namespace{ “ ADOCG”} rename (“EOF”, “EndOfFile”)
using namespae ADOCG
iii) #import “c:\program Files\Common Files\System\ADO\msado15.dll”
rename_namespace{ “ ADOCG”} rename (“EOF”, “EndOfFile”)
using namespae ADOCG
#include “icrsint.h”
iv) #define INITGUID
#import “c:\program Files\Common Files\System\ADO\msado15.dll”
rename_namespace{ “ ADOCG”} rename (“EOF”, “EndOfFile”)
using namespae ADOCG
#include “icrsint.h”

a) only i, ii b) only iv c) only iii d) None


1. D 2. C 3.C 4. D
5. A 6.C 7 A 8.C
9. C 10.B

Tuesday, May 26, 2020

Monday, October 15, 2012

c++


Introduction To OOP

1)     Functions are also called as __________.
a) Subroutines                       b) subprograms                     c) Procedures                       d) All      

2)     POP stands for _______
a) Procedure Oriented Programs                                        b) Program oriented procedure          
c) Procedural oriented programs                                        d) None

3)     OOP stands for _______
a) Object oriental programming                                         b) Object oriented programming
c) Optical Object programs                                                  d) None

4)     ____ is  a feature which we can change the data structure of an object without affecting the
operation of the program.
a) Data encapsulation           b) Data abstraction/hiding    c) Reusability                         d) None

5)     _________ is generally shorter because objects are small and contain independent code.
a) Application debug            b) Application implementation             c) Application testing          d) None

6)     C++ was developed by _________.
a) Denis Ritchie                     b) Bjarne Stroustrup             c) James Gosling                  d) None

7)     It was developed in which year ____
a) 1980                                    b) 1986                                   c) 2000                                    d) 1886

8)     ______ was the first release of C++.
a) 1.0                                       b) 1.1                                       c) 1.2                                       d) 2.0

9)     It was released by ________ company.
a) Microsoft                            b) AT&T                                  c) IBM                                     d) Oracle

10)   C++ is superset of _____.
a) C                                         b)  Java                                   c) VB                                       d) None

11)   _____ is said to be an instance of a class.
a) Variable                              b) Object                                 c) Both a & b                          d) none

12)   ______ is single unit of data and functions that operate on the data.
a) Object                                 b) Class                                  c) Both a & b                          d) None

13)   ________ describes the data and its behavior or functionality.
a) Object                                 b) Class                                  c) Both a & b                          d) None

14)   The method of ________ is the process of dividing into subclasses.
a) Inheritance                        b) Polymorphism                   c) Both a & b                          d) None

15)   A _______ is a data type defined by user describing the data it represents.
a) Object                                 b) Class                                 c) Both a & b                          d) None

16)   In inheritance  the main class is said to be ____
a) Parent class                       b) super class                        c) Base class                        d) None

17)   The concept of _____ provides an important extension to the idea of reusability.
a) Inheritance                        b) Polymorphism                   c) Both a & b                          d) None

18)   ______ allows to create multiple definitions for operators and functions and at run – time depending on the context a particular definition will be used.
a) Inheritance                        b) Polymorphism                   c) Both a & b                          d) None

19)   ___________ is a kind of polymorphism.
a)Overloading                       b) Overriding                         c) Both a & b                          d) None

20)   _____ is a feature by which the operators +,-,etc., can be made to work with our class.
a) Operator overloading      b) Function overloading      c) Both a & b                         d) None

21)   The extension of C++ is _____.
a) C                                         b) CPP                                    c) .CP                                      d) None


22)   On compilation, of C++ source code we get ____ file.
a) . CPP                                  b) .EXE                                    c) .OBJ                                   d) None

23)   On linking, of C++ source code we get ____ file.
a) . CPP                                  b) .EXE                                   c) .OBJ                                   d) None

24)   ________ functions saves memory space as the code is not repeatedly compiled.
a) Normal                                               b) Inline                                 c) Static                                  d) None

25)   The local variables are stored in ______
a) Data segment                    b) Stack Segment                 c) Hash Segment                   d) None

26)   The static and global variables are stored in ______
a) Data segment                    b) Stack Segment                  c) Hash Segment                   d) None

27)   The “ #include” is said to be a ___________
a) Empty statement                                b) preprocessor directive     c) Pragma                               d) None

28)   ____ is the object used to display information on standard output device.
a) cin                                      b) printf                                   c) cout                                    d) None

29)   >> is said to be _____ operator.
a) Insertion                            b) Extraction                          c)  Put                                     d) None

30)   << is said to be _____ operator.
a) Insertion                            b) Extraction                          c) get                                      d) None

31)   ______ is the manipulator.
a) endl                                    b) setw                                    c) Both a & b                          d) None

32)   _____ is the maximum number of characters in a variable name.
a) 5                                          b) 32                                        c) 256                                      d) 1024

33)   ________ is a fixed value throughout the program.
a) Variables                            b) Constants                          c) Both a & b                          d) None


34)   ____ is exponent form
a)  –14E-2                               b) –14-E+2                              c) –14-E2                                                d) None

35)   ________ specifies what the variable name is and what type it will hold.
a) Data Type                          b) Data Declaration                               c) Both a & b                          d) None

36)   An array is collection of _____ data.
a) Homogeneous                  b) Heterogeneous                 c) Both                                    d) None

37)   The position in array is represented by ____
a)  Subscript                           b) Indicator                            c) Both                                    d) None

38)   The index of an array starts with __
a) 1                                          b) 0                                          c) –1                                        d) None

39)   The maximum number of dimensions depends on ____.
a) Interpreter                          b) Compiler                            c) Operating system                             d) None

40)   ________ defines the set of all names that will be permissible values of the type.
a) Structures                           b) Enum                                  c) Both                                    d) None

41)   ______ is a datatype which is used to define heterogeneous set of data types.
a) Structures                           b) enum                                  c) Array                                   d) None

42)   The assignment statement is called ____ statement.
a) Static                                  b) Dynamic                             c) Put                                      d) None

43)   ____ is modulus operator.
a) /                                           b) ^                                          c) %                                       d) &

44)   Type _____ is implicitly done.
a) Casting                              b) Conversion                       c) Both a& b                           d) None

45)   Type _____ is explicitly done.
a) Casting                              b) Conversion                       c) Both a & b                          d) None

46)   The conditional operators return _____
a) true, false                           b) 0, 1                                      c) yes, no                                               d) None

47)   The set of compound statements enclosed within {  } is said to be _____.
a) Group                                 b) Block                                  c) Stack                                  d) Heap

48)   ____ is said to be statement terminator.
a)  .                                          b)  ;                                          c)  :                                          d)  –

49)   _____ is said to be unconditional branching.
a) If                                          b) Switch                                               c) Goto                                   d) None

50)   The loops perform the task until expression evaluates to ______.
a) true                                     b) false

51)   In ____ loop , the statements are to be executed atleast once for condition to be verified.
a)  While                                 b) DO.. WHILE                       c) For                                      d) None

52)   The functions associated with a class are called.
a) functions                            b) procedure                          c) methods                            d) All

53)   The _____ feature ties data and procedures logically together.
a) data hiding                        b) data encapsulation           c) Both                                    d) None

54)   The ____ feature is that the data is concealed within a class.
a) Data Hiding                       b) Data Abstraction                                c) Both                                    d) None

55)   The ____ refers to calls to member functions.
a) Messages                          b) Overloading                      c) Both a & b                          d) None

56)   The default access specifier for structures is _____
a) Public                                 b) Private                                                c) Protected                           d) None

57)   The default access specifier for class is ___
a) public                                 b) private                                               c) friendly                                               d) None

58)   Automatic initialization is carried out using a special member function called the ____.
a) Starter                                 b) Initialiser                            c) constructor                        d) None

59)   _______ is invoked when the compiler returns to the calling function.
a) Constructor                       b) Destructor                          c) Both a & b                          d) None

60)   _____ is said to be scope resolution operator.
a)              :                              b)  ::                                         c)  ?:                                        d) None

61)   _____ is said to be scope conditional operator.
a)  :                                          b)  ::                                         c)  ?:                                        d) None

62)   If a data item in a class is defined as ____, then only one such item is created for entire class.
a) Private                                                b) Static                                 c) Extern                                 d) None


Two mark Questions                                                                                                          


1)     Which of the following are true for POP:
      1) Data is given secondary status.
                      2) There is data-hiding concept
                      3) More emphasis is on doing things by functions
                      4) There is data-encapsulation concept
                      a) I, ii                                 b) I, iii                                      c) ii, iv                                     d) None

2)     Which of the following are true for OOP.
                      i) Data is given primary status
                      ii) There is data-hiding concept
                      iii) More emphasis is on doing things by functions
                      iv) There is data-encapsulation concept
                      a. I, ii only                        b. ii, iii, iv                                                c) I, ii, iv                                  d) None
3)     In which of the two categories OOP fall:
                      a) Increased programming, decreased maintenance cost
                      b) Decreased programming, increased maintenance cost
                      c) Increased speed, decreased maintenance cost
                      d) None

4)     Which of the following are principles of Inheritance.
                      i) Each subclass shares common characteristics
                      ii) Each subclass can have its own particular characteristics.
                      a) I only                            b) ii  only                                                c) Both I, ii                            d. None

5)     The term ____ and ____ are used interchangeably.
                      a) Overloading, polymorphism                                     b) Overloading, inheritance
                      c) Reusability, inheritance                                                              d) Reusability, Polymorphism

6)     The functions are overloaded means:
i) Their names are different
ii) They can have same number of arguments, but data types different
                      iii) They can have different number of arguments
                      iv) They have same names
                      a) I, iii                                                b) ii, iii, iv                                               c)  All                                      d) None

7)     Specify the order in which the source code is converted to executable file.
i) Source text file           
ii) Verify         
iii) Link                          
iv) Compile   
                        v) Testing      
                        vi) Execute
                      a) I, iv, iii, vi                      b) ii, iv, iii, vi                               c) iv, I, ii, v                          d) ii, iii, iv, v

8)     Which of the following are valid access specifiers for members of the class:
                      i) Global                          
                      ii) Private         
                      iii) auto                            
                      iv) extern         
                      v) protected
                      vi) public                         
                      vii) static                                           viii) final
                      a) ii, iv, v, viii                    b) ii, vi, v                                 c) I, iii, vi, v                             d) All
                               
9)     What is the range of integer values
                      a) –32768,32767               b) 0, 32768                              c) 32768,0                               d) None

10)   Which of the following are true for structures:
                      i) The template must be terminated with semicolon
                      ii) The tag-name can be used to declare structure variables.
                      iii) The structure members cannot be initialized inside the template
                      a) I only                            b) ii, iii                                     c) All                                      d) ii only

11)   Which of the following are valid expressions:
                      i) A signed or unsigned variable
                      ii) A signed or unsigned constant
                      iii) Variables connected by ,(comma) operator
                      iv)  A variable or constant in parenthesis
                      a)  I, ii, iv                           b) I, iv only                             c) All                                       d) None

12)   ______ are the statements used only within a loop.
                      a) Break                            b) Continue                            c) Exit                                    d Both a,b

13)   Match the access specifiers:
                      1) Private                                          I) can be accessed outside the class
                      2) Public                                           ii) can be accessed only by parent and child classes
                      3) Protected                                     iii) can be accessed only within the class
                      a) 1- I, 2- ii , 3 – iii            b) 1- iii, 2- I , 3- ii                   c) 1- ii, 2- iii, 3- I                     d) 1-iii, 2- ii, 3 – I

14)   Which of the following are true for constructors:
                      i) They have same name as that of the class
                      ii) they have (~) preceding the name.
                      iii) They are automatically called at the time of creating the object
                      iv) They cannot be overloaded.
                      a) I, iii                                                b) I, ii                                       c) ii, iv                                     d) iii, iv

15)   Which of the following are true for destructors:
                      i) They have same name as that of the class
                      ii) they have (~) preceding the name.
                      iii) They are automatically called at the time of creating the object
                      iv) They cannot be overloaded.
                      a) I, ii, iii                            b) I, ii                                       c) ii, iv                                     d) iii, iv

Four mark Questions                                                                                          


1)     Which of the following are the features of C++
                i) Multiple inheritance                                                           ii) Implicit support for abstract classes
                iii) pointers to class members                                                              iv) Operator overloading    
                a) All                                       b) I, ii only                              c) I, iii, iv                                 d) None

2)     Match the following:
                                Escape Sequence                                                 Character
                1) \a                                                                         I) Tab
                2) \x add                                                                 ii) bell(beep)
                3) \t                                                                          iii) backslash
                4) \\                                                                          iv) Hexadecimal representation
                                                                                                v) Backspace
a) 1- ii; 2- iv; 3- I; 4- iii           b) 1 – iii; 2- iv ; 3- v; 4 – I       c) 1- v; 2- iv; 3- I; 4- iii           d) None

3)     What is the O/P:
      struct ss
                {
                                int sno,age;
                                float fee;
                                char name[30];
                };
void main()
{
      cout<
}
a) 36                                        b. 38                                        c) 30                                        d) 4

4)     Give the o/p:
        void main()
                {
                                int I=10;
                                cout<<++I<<”\t”<
                }
 a)  12      11       10                                 b) 11   11    11                         c) 10   10    10                         d) 11   10   10


5)     Arrange the operators from higher at top to lowest is bottom:
i)  *,-,/,%,+                              
ii) < , >, ==, !=, >=, <=             
iii) ?:                       
iv) (  )                     
v) &&, ||                  
vi) !, ++, - -, -                          
vii) =,+=,-=,*=,/=,%=               

a) ii, iv, iii, I, vii, v, vi                             b) iv, vi, I, ii, v, iii, vii                              c) iv, vi, ii, I, v, vii, iii                           d) I, iii, ii, v, vi, vii, ii, iv

6)     What does the following program do :
                void main()
                {
                                char x;
                                cout<<”\n enter a character “;
                                cin>>x;
                                switch(x)
                                {
                                                case ‘A’: case ‘a’:
                                                case ‘E’: case ‘e’:
                                                case ‘I’: case ‘i’:
                                                case ‘O’: case ‘o’:
                                                case ‘U’: case ‘u’:
                                                                cout<<”\n vowel”; break;
                                                default:
                                                                cout<<”\n consonant”’;
                                }
                }
a) Accepts a character and displays Vowel or consonant
b) Accepts a string and checks characters which are vowel or not
c) Error
d) None

7)     Give the O/P:
       for(I=0;I<5 o:p="o:p">
                                {
                                if(I==3) continue;
                                cout<<”\n”<
                }
a) 1   2   4  5                            b) 0  1  2 4  5                           c) 0 1  2   3   5                         d) 1  2  3  5

8)     Give the O/p :
     class myclass
                                {
                   int num;
   public:
                   myclass(){num=0;}
                   myclass(int n){num=n;}
                  void sh(){
                  cout<<”\n num=”<
                };             
    void main()
  {
      num n1, n2(30);

     n1.sh();
     n2.sh();
 }
a) num = 0   num = 30            b) num=”  “   num=30             c) num=junkvalue num=30    d) error


9)     Give the O/p :
     class myclass
                                {
                                int num;
                public:
                myclass(int n){num=n;}
                void sh(){
                  cout<<”\n num=”<
                                };             
    void main()
    {
      num n1, n2(30);
     n1.sh();
     n2.sh();
    }
a) num = 0   num = 30            b) num=”  “   num=30             c) num=junkvalue num=30       d) error

10)   Discuss the O/P:
         class try
                {
                   int id,tot;
                     public:
                                try(){tot=0; tot++; id=tot;}
                                void print()
                                {
                                    cout<<”\n id is “<
                                }

                };
                void main()
                {
                                try ss1,ss2;
                                ss1.print();
                                ss2.print();
                }
a) id=1  count=1                     b) junk values                        c) Error                                   d) None

11)   Discuss the O/P:
         class try
                {
                   int id;
                                static int tot
                                public:
                                try(){ tot++; id=tot;}
                                void print()
                                {
                                    cout<<”\n id is “<
                                }
                                static void printcount()
                                {
                                  cout<<”\n number of instances “<
                                }

                };
int try::tot=0;
                void main()
                {
                                try ss1,ss2;
                                try::printcount();
                }
a) 1                                          b) 2                                          c) 0                                          d) None



12)   What does the following program do:
                void main()
                {
               
                int c;
                for(c=65;c<=122;c++)
                {
                                if(c>90 && c<97 o:p="o:p">
                                                continue;
                  cout<
                }
                }
a) Displays numeric set        b) displays alphabet set       c) displays char., set            d) Error

13)   What does the following program do:
       void main()
                {

                   int n[10],I,j,temp;
                  cout<<”\n Enter 10 numbers:”;
                  for(I=0;I<10 o:p="o:p">
                                cin>>n[I];

   for(I=0;I<9 o:p="o:p">
    {
      for(j=I+1;j<10 j="j" o:p="o:p">
      {
                if(n[I]>n[j])
                {
                                temp=n[I];
                                n[I]=n[j];
                                n[j]=temp;
                }
                }
    }
    for(I=0;I<10 o:p="o:p">
    cout<<”\n”<

                }
a) Displays the entered numbers in ascending order
b) Displays the entered numbers in descending order
c) Both a & b                                         
d) None

14)   Which of the one is the correct logic for reversing the string:
i)  void main()                                                        ii) void main()
                    {                                                                               {
                    char ss[80];                                                             char ss[80],ss1[80];
                                                                                                      cout<<”\n enter a string”;                  
                     cout<<”\n enter a string:”;                                                      cin.getline(ss,80);
                     cin.getline(ss,80);                                                  strcpy(ss1,ss);
                     int l=strlen(ss);                                                        strrev(ss1);
                     for(l=l-1;l>=0; l- -)                                                     cout<<”\n reverse is “<
                     cout<
                    }

a) I only                                  b) ii only                                 c) Both I, ii                             d) None


15)   What is the O/P of :
          class A
                   {
                                int a;
                                A()
{a=0;}
                              public:
                                void show()
                                {
                                   cout<<”\n a=”<
                                }
                };
                void main()
                {
                                A ss;
                                ss.show();
                }
  a) 0                                        b) Junk value                         c) error                                  d) None

16)   Match the following:
                                                Operators                                                               Category
1)     ++                                            A) binary
2)     +=                                            B) ternary              
3)     ?:                                             C) unary
a) 1- A, 2- B, 3- C                  b) 1- C, 2- A, 3- B                   c) 1- C, 2- B, 3- A                   d) a. 1- B, 2- A, 3- C



*************************



                                                            Key for One mark

1          d          2          a          3          b          4          b          5          c         
6          b          7          b          8          c          9          b          10        a
11        b          12        a          13        b          14        a          15        b         
16        c          17        a          18        b          19        c          20        a
21        b          22        c          23        b          24        b          25        b
26        a          27        b          28        c          29        b          30        a
31        c          32        b          33        b          34        a          35        b
36        a          37        a          38        b          39        b          40        b
41        a          42        b          43        c          44        b          45        a
46        b          47        b          48        b          49        c          50        a
51        b          52        c          53        b          54        a          55        a
56        a          57        b          58        c          59        b          60        b

 

 

 

Key for two marks questions


1          b          2          c          3          a          4          C         5          a
6          b          7          a          8          b          9          a          10        c
11        a          12        d          13        b          14        a          15        a

 

 

 

 

Key for four marks questions


1          c          2          a          3          b          4          a          5          b
6          a          7          b          8          a          9          d          10        a
11        b          12        b          13        a          14        c          15        c
16        b






UNIT II- Operator Overloading and Inheritance

One mark questions:

1)     ________ are those that have been redefined within a C++ class.
a) Method Overloading                b) Operator Overloading      c) Both a & b                          d) None

2)     The internal call to an object ss++ will be made as _______
a) ss. operator++( )                               b) ss. operator++(0)             c) ss. operator++(1)                              d) None

3)     _______ is a special pointer that points to the current object.
a) This                                    b) new                                     c) Both                                    d) None

4)     To prevent the member wise copy, it is necessary to provide the ______.
a) Copy Constructor                             b) Constructor                       c) Operator Constructor       d) None

5)     ______ provides explicit conversion between datatypes.
a) Conversion                       b) Casting                              c) Both                                    d) None

6)     Operator int( ) is said to be ___________.
a) Conversion Function               b) Casting Function                              c) Both                                    d) None

7)     To convert from basic to Object we use ______ in the class.
a)  Conversion Function      b) Constructor                      c) Both                                    d) None

8)     To convert from Object to basic we use ______ in the class.
a) Conversion Function       b) Constructor                       c) Both                                    d) None

9)     Functions with same name but differing in their signatures is said to be ____.
a) Operator Overloading      b) Function Overloading     c) Both                                    d) None

10)   The process of creating new classes from already existing classes is said to be ____.
a)  Inheritance                       b) Polymorphism                   c) Exceptions                        d) None

11)   The access specifiers used while inheriting is used for ________.
determining availability of base class members to derived class
determining availability of derived class members to base class
determining availability of base class members to subclass class
determining availability of super class members to derived class

12. A member function in the base class can be used by the objects of the derived class ,this is
      said to be __________.
    a. Accessibility                                   b. Reusability                         c. Both a & b                           d. None

13. ___ member can be accessed by the classes derived from the base class.
    a. private                                                            b. public                  c. protected                           d. None

14. ______ inheritance does not change the specifiers of base class members.
    a. private                                                            b. public                 c. protected                            d. None

15. ______ inheritance changes the specifiers of base class members to private of derived class.
     a. private                                                           b. public                  c. protected                            d. None

16. ______ inheritance changes the specifiers of base class members to protected of derived class.
    a. private                                                            b. public                  c. protected                           d. None

17. We cannot create an instance of _________ classes
   a. virtual                                                               b. abstract                              c. protected                            d. None

18. A class derived from more than one class is said to be _______.
   a. Multilevel                                         b. Hierarchical                       c. multiple                              d. Both b & c

19.Inheritance is ________ relationship.
    a. kind- of                                           b. has a                                   c. Both                                    d. None

20.containership is ________ relationship.
   a. kind- of                                            b. has a                                  c. Both                                    d. None

Two mark Questions                                                                                                          


1. Which of the following operators cannot be overloaded:
      i) ++                   ii)  ::                         iii) ?:                        iv) .                          v) +                          vi) >>
    a. ii, iii, iv                            b. ii, iii, iv, vi                                           c. All                                        d. None

2. When converting class to class we need _____ in destination class and ______ in source class
    a. conversion function, constructor                                b. constructor, conversion function  
    c. nothing, conversion function                      d. constructor, nothing

3. Which of the following are the precautions while overloading:
                      i)use similar syntax
                      ii) Avoid ambiguity
                      iii) Not all operators can be overloaded
    a. I only                                              b. ii , iii                                    c. All                                                       d. None

4. Which of the following is advantages of Inheritance:
                      i) Code reusability
                      ii) The protection is decreased
                      iii) We can add data and functions to class without affecting the base class.
      a. I, iii                                                                b. ii, iii                                     c. All                                        d. None

5. The accessibility can be done by :
                      i) calling the base class functions in derived class
                      ii) substituting base class constructors
                      iii) substituting base class member functions
                      iv) Hiding the base class members
   a. I,ii,iii                                                                 b. ii, iii                                    c. All                                        d. None

6. Which of the following statements are true for method overriding:
                      i)Functions must have same name
                      ii) Functions may be in same class
                      iii) Functions must have same parameters
                      iv) Functions must be in base and derived class
     a. I, iii, iv                                            b. I, iii                                      c. I,iv                                       d. All

7. Which of the following statements are true for method overloading:
                      i)Functions must have same name
                      ii) Functions may be in same class
                      iii) Functions must have same parameters
                      iv) Functions must be in base and derived class
    a. I, iii, iv                                             b. I, ii                                      c. I,iv                                       d. All

8. Which of the following are true to prevent objects of the derived class calling the base class
    function.
  i) Make a dummy function in derived class of the same name and structure and give an error
     message whenever called
  ii) Make the derived class private
 a. only I                                                                 b. only ii                 c. Both I,ii                              d. None

9. Which of the following are true about abstract classes:
                      i) We can create an instance of this class.
                      ii) We cannot create an instance of this class
                      iii) They must contain atleast one virtual function
                      iv) They must contain atleast one pure virtual function
                      v) They are used only for deriving other classes
                      vi) The derived class must override all the pure virtual functions
  a. ii, iv v, vi           b. ii, iii, iv, v, vi                                       c. All                                        d. I, iii,iv,v


Four mark Questions                                                                                          


1. Explain the O/P
class A
                {
                    int a;
                  public:
                                A(int h=0) {  a= h;}
                                Void show( ) { cout<<”\n a=”<
                                Void operator++( ){ ++a; cout<<”\n ++ no arg called”;}
                                Void operator++( int g){ ++a; cout<<”\n ++ one arg called”;}
               
                };
                void main( )
                {
                A ss(100);
                ++ss;
getch();
                }
    a. ++ no arg called                                            b. ++ one arg called              c. Both a & b                           d. None

2. Explain the O/P

                class A
                {
                    int a;
                  public:
                                A(int h=0) {  a= h;}
                                Void show( ) { cout<<”\n a=”<
                                Void operator++( ){ ++a; cout<<”\n ++ no arg called”;}
                                Void operator++( int g){ ++a; cout<<”\n ++ one arg called”;}
               
                };
                void main( )
                {
                A ss(100);
                ss++;
getch();
                }
   a. ++ no arg called                                             b. ++ one arg called             c. Both a & b                           d. None

3. When is the copy constructor called in the following prog:-
     class string
                {
                   char  ss;
                public:
                                string(char *s=NULL){ strcpy(ss,s);}
                                string(string &s){ ss=strdup(s.ss); cout<<”\n copy called”;}
                                void disp( ) { cout<<”\n ss=”<
                                string& operator=(string &s)
                                                {
                                                   ss=strdup(s.ss); cout<<”\n assignment called”;
                                                                return (*this);                            
                                                }
                };
void main( )          
{
1.             string ss1(“ACME”),ss2;
2.              ss2=ss1;
3.             string ss3(ss2);
4.             string  ss4=ss1;
}

 a. at line nos., 3,4 b. at line nos., 2,3,4                               c. at line no., 3 only              d. line no. 2

4. When is the assignment operator method called in the following prog:-
     class string
                {
                   char *ss;
                public:
                                string(char *s=NULL){ strcpy(ss,s);}
                                string(string &s){ ss=strdup(s.ss); cout<<”\n copy called”;}
                                void disp( ) { cout<<”\n ss=”<
                                string& operator=(string &s)
                                                {
                                                   ss=strdup(s.ss); cout<<”\n assignment called”;
                                                                return (*this);                            
                                                }
                };
void main( )          
{
1.             string ss1(“ACME”),ss2;
2.              ss2=ss1;
3.             string ss3(ss2);
4.             string  ss4=ss1;
}

a. at line nos., 3,4  b. at line nos., 2,3,4                               c. at line no., 2,4     d. line no. 2

5. What is the output:-
                const int MAX= 10;
                class stack
                {
                                protected: int st[MAX},top;
                                public:
                                                stack() { top= -1; }
                                                void push(int var)( st[++top]=var; }
                                                int pop( ) { return st[top--]; }
                };
                class stack2:public stack
                {
                public:
                                                void push(int var)(
                                                       if(top+1
                                                                stack::push(var);
                                                 else
                                                     {cout<<”\n Error: stack is full”; exit(1);}
                                                }
 int pop( ) {
                if(top>=0) return stack::pop( );
                else
                                {cout<<”\n Error : stack empty”; exit(1); }
}
                };
void main( )
{
      stack2 ss1;
ss1.push(10);
ss1.push(11);
ss1.push(12);
cout<<”\n”<
cout<<”\n”<
cout<<”\n”<
cout<<”\n”<
}
a. Error                                   b. 10  11   12  error:stack is empty      c. None                   d. 10 11 12

6. What is the o/p:
                class A
                {
                                public:
                                  void show(){
                                                cout<<”\n class A”;}
};
                class B
                {   public:  void show(){
                                                cout<<”\n class A”;}
};
                class C: public A, public B {  };
                void main( )
                {
                                C ss;
                                ss.show();
                }
a. class A                                                b. class B                                c. Error                  d. None

7. What is the o/p:
                class A
                {
                                public:
                                  void show(){
                                                cout<<”\n class A”;}
};
                class B
                {   public:  void show(){
                                                cout<<”\n class A”;}
};
                class C: public A, public B {  };
                void main( )
                {
                                C ss;
                                ss.A::show();
                                ss.B::show();
                }
a. class A                                                b. class B                                c. Error                                   d. Both a & b

8. What is the O/p:
                class string
                {
      char *ss;
                public:
                                string(char *s=NULL){ strcpy(ss,s);}
                                ~string( ){ delete ss;}
                                int operator==(string &s)
                                {
                                                int a;
                                                if(strcmp(ss,s.ss)==0)
                                                                return 1;
                                                else
                                                                return 0;
                                }
                                void disp(){ cout<
                };
                void main()
                {
                                string s1(“ACME”),s2(“ACME”);
                                clrscr();
                                s1.disp();
                                s2.disp();
                                if(s1==s2)
                                                cout<<”\n both are equal”;
                                else
                                                cout<<”\n both are not equal”;
                }
 a. both are equal                                   b. both are not equal             c. Error                   d. None

9. What is the o/p:
                class A
                {
                                int a;
                                public:   A(int h=0){  a=h;}
                                                void show(){ cout<<”\n a=”<
                };
                class B: public A
                {
                                int b;
                                public:   B(int h=0){  b=h;}
                                                void show(){ cout<<”\n b=”<
};
void main()
{
                B ss(20);
ss.show();
}
a) a= 20                                   b) b=20                                   c) Both a & b                          d. None
               
10.What is the O/p
                class A
                {
                                int a;
                                public:   A(){ a=0;}
A(int h){  a=h;}
                                                void show_a(){ cout<<”\n a=”<
                };
                class B: public A
                {
                                int b;
                                public:   B(){ b=0;}
B(int h){  b=h;}
                                                void show_b(){ cout<<”\n b=”<
                };
                void main()
                {
                                B ss,ss2(10);
                                ss.show_a();
                                ss.show_b();
                                ss2.show_a();
                                ss2.show_b();
                }
 a) a=0  b=0  a= 0  b= 10         b) a=0  b=0  a=10  b= 10         c) Error                                   d. None

11.In the below program Whish statement must be used instead of ? do that the
   O/P is a=10 b=10
                class A
                {
                                int a;
                                public:   A(){ a=0;}
A(int h){  a=h;}
                                                void show_a(){ cout<<”\n a=”<
                };


                class B: public A
                {
                                int b;
                                public:   B(){ b=0;}
   ?  {  b=h;}
                                                void show_b(){ cout<<”\n b=”<
                };
                void main()
                {
                                B ss2(10);
                                ss2.show_a();
                                ss2.show_b();
                }
i. B(int h)                ii. B(int h):A(h+2)   iii. B(int h):A(a)                      iv B(int h):A(h)       v)B(int h):A(1)

a. Only I                                  b. ii, iv, v                                c. ii, iii, iv, v                            d. iv, ii

12. What is the order of constructors called in the below program:
     class A
                {
                                public:
                                                A() { cout<<”\n constructor A called”; }
                                                ~A() { cout<<”\n Destructor A called”; }
                };
     class B: public A
                {
                                public:
                                                B() { cout<<”\n constructor B called”; }
                                                ~B() { cout<<”\n Destructor B called”; }
                };
     class C: public A
                {
                                public:
                                                C() { cout<<”\n constructor C called”; }
                                                ~C() { cout<<”\n Destructor C called”; }
                };
     class D: public B, public C
                {
                                public:
                                                D() { cout<<”\n constructor D called”; }
                                                ~D() { cout<<”\n Destructor D called”; }
                };
                void main()
                {               D ss;       }
                i) constructor C called
                ii) constructor A called
                iii) constructor D called
                iv) constructor B called
a. ii, iv,  I, iii                                            b. ii, iv, ii,  I, iii                       c. iii, I, iv, ii                             d. iii, I, ii, iv, ii


13. What is the order of destructors called in the below program:
     class A
                {
                                public:
                                                A() { cout<<”\n constructor A called”; }
                                                ~A() { cout<<”\n Destructor A called”; }
                };
     class B: public A
                {
                                public:
                                                B() { cout<<”\n constructor B called”; }
                                                ~B() { cout<<”\n Destructor B called”; }
                };
     class C: public A
                {
                                public:
                                                C() { cout<<”\n constructor C called”; }
                                                ~C() { cout<<”\n Destructor C called”; }
                };
     class D: public B, public C
                {
                                public:
                                                D() { cout<<”\n constructor D called”; }
                                                ~D() { cout<<”\n Destructor D called”; }
                };
                void main()
                {               D ss;       }
                i) Destructor C called
                ii) Destructor A called
                iii) Destructor D called
                iv) Destructor B called
a. ii, iv,  I, iii                                            b. ii, iv, ii,  I, iii                        c. iii, I, iv, ii                             d. iii, I, ii, iv, ii






                                                                                Answers
One mark
1. b      11.a
2. b      12.a
3. a      13.c                 .
4.a       14.b
5.b       15.a
6.a       16.c
7.b       17.b
8.a       18.c
9.b       19.a
10.a     20.b

two marks
1. a
2. b
3. c
4.a
5.b
6.a
7.b
8.c
9.a

four marks
1. a      11.b
2. b      12.b
3. a      13.d
4.d
5.b
6.c
7.d
8.a
9.b
10.a

UNIT III- Templates, Pointers and Graphics
One mark questions:

1. ____ is a  variable that holds the address of a data item.
    a. reference                                         b. pointers                                             c. Both a& b                            d. None

2.Graphics mode require a graphics monitor and _______.
   a. CGA                                 b. EGA                                                    c. VGA                                    d. All

3. To include a user-defined header file you use ____.
    a.  “  “                                  b. < >                                                       c. Both                                    d. None

4. Templates are also known as ___________.
   a. abstract data types                         b. Parameterized data types                c. Both a & b                           d. None

5. When the class derives another class,  ______ template is written for derived class.
    a. different                                          b. same                                   c. Cannot be done                                d. None

6.Addresses are basically starting with _______
    a. 0                                                      b. 1                                                          c. –1                                        d. None

7.If  640K memory then ___ is max address.
   a. 0                                       b. 65535                                 c. 65534                  d. 65536

8. _______ operator is used to allocate memory.
   a. malloc( )                                          b. new                                    c. Both a & b                                           d. None

9. ______ operator is used to deallocate memory
  a. free ( )                                               b. delete                                 c. Both                                                    d. None

10. At the ___________ data structure is concerned with the actual storage location of data and
     the relationship of different data items.
 a. Physical level                   b. Logical level                      c. Both                                                    d. None

11. At the ____ data structure is concerned with the defined data relationships.
   a. Physical level                 b. Logical level                     c. Both                                                    d. None

12. Data structures have _______ levels.
    a. 1                                                      b. 2                                         c. 4                                                          d. 0

13. Inside the class, we can create _____ of its own type but we cannot create ___ of its own
     type.
  a. Object, Pointer                 b. Pointer, Object  c. array, object                                       d. None

14. How do you declare array of pointers.
a.   *p                                                      b. (*p)[2]                  c.  *p[2]                                  d. None

15. How do you declare pointer to pointers.
  a. **p                                                     b. (*p)[2]                  c. *p[2]                                                    d. None

16. What is the meaning of **p ____
  a. the address of a pointer is a pointer to a integer
    b. the address of a pointer is a pointer to a pointer      c. Not available                                     d. None

17. ____  function erases the text window.
    a. clrscr( )                                           b. cleardevice( )                     c. Both                                                    d. None

18. _____ header file is included for working with graphics.
    a. stdio.h                                            b. graphics.h                        c. windows.h                                         d. None

19. _____ function positions the cursor within the text window.
    a. move( )                                           b. gotoxy( )                           c.moveto( )                                             d. None

20. _____ function releases the memory of graphics system.
   a. close ( )                                           b. closegraph( )                     c. Both a & b                                           d. None

21. ____ function fills a bounded region with color.
   a. setcolor( )                                       b. floodfill                              c. fillcolor( )                                           d. None

22. The viewports arguments are given in _____ coordinates
    a.  absolute screen                            b. graphics                             c. Cartesian                                            d. None

23. If the value of the setviewport “clip” argument is set to ___, then all drawings will be clipped
     the current viewport.
 a. 0                                                         b. non- zero                          c. Both                                                    d. None

Two mark Questions                                                                                                          


1. Turbo C++ graphics functions can be categorized as
    a) text mode only              b. graphics mode only                         c. Both text and graphics    d. None

2. Which of the following are true for template classes:-
                      i) Use the statement “template ”  before the class
                      ii) Use the statement “template ”  before the main( )
                      iii) T stands for new class
                      iv) T is name given instead of the data type for declaring private variables of the class.
    a) I, iii                                                  b. I, iv                                                     c. ii, iii                                     d. ii, iv

3. Which of the following are advantages of “new” operator:
                      i) It is superior to malloc in C
                      ii) Its return value needs to be casted
                      iii) it returns a pointer to appropriate data type
   a. I,ii                                                     b. I , iii                                                    c. All                                        d. None

4. Which of the following is true for “delete” operator.
i) It deletes the pointer that points to it
ii) It does not change the address value in the pointer
iii) The address is no longer valid
iv) the memory it points to holds the same value as before.
    a. ii, iii                                                 b. I, ii, iii                                  c. All                                        d. None

5. Which of the following is true about linked list:
                      i) It is a  data structure
                      ii) Each element is said to be a node
                      iii) Every element (node) contains data and pointer to next location
                      iv) the last node pointer contains NULL
   a. only ii, iii                                         b. Only I, iv                                             c. All                                       d. None

6. Which of the following are advantages of using linked list
i) It can be allocated when required
ii) It has fixed memory allocation
iii) It is more flexible storage
     a. I, iii                                                 b. ii. iii                                                     c. All                                        d. iii

7. Which of the following operations can be performed with single linked list:
                      i) create list                      ii) insert                                  iii) delete                iv) change             
                                                v) move forward                                    vi) move backward
  a. I, ii, iii, v                            b. I, ii, iii, iv, v                                        c. All                                        d. None

8. Which of the following can be performed with double linked list
                      i) create list                      ii) insert                                  iii) delete                                iv)change
                                                v) move forward                                    vi) move backward
  a. I, ii, iii, v                            b. I, ii, iii, iv, v                                         c. All                                       d. None

9. Which of the following are the valid attributes for the fillstyle patterns:
                      i) SOLID_FILL  ii) SOLID_LINE       iii) SLASH_FILL                      iv) HATCH_FILL
                                                v) USER_FILL                                        vi) DOT_FILL
    a. I, iii, iv, v                                         b. I, iii, iv, v, vi                                        c. All                                        d. None

10. Which of the following are valid values for settextjustify vertical alignments:
                      i) LEFT_TEXT  ii) CENTER_TEXT                 iii) RIGHT_TEXT   
                                                iv) BOTTOM_TEXT                               v) TOP_TEXT
    a. I, ii, iii                                              b. ii, iv, v                                                c. All                                        d. None

11. Which of the following are valid values for settextjustify horizontal alignments:
                      i) LEFT_TEXT  ii) CENTER_TEXT                 iii) RIGHT_TEXT   
                                                iv) BOTTOM_TEXT                               v) TOP_TEXT
    a. I, ii, iii                                              b. ii, iv, v                                 c. All                                        d. None

Four mark Questions                                                                                          


1. In which of the following areas pointers are used:
                i) Accessing array elements
                ii) Passing address arguments to functions when the function needs to modify the original
               arguments
                iii) passing arrays and strings to functions
                iv) obtaining memory from the system- Dynamic memory allocation.
                v) creating data structures such as linked list
   a. ii, iii, iv                                             b. I, ii, v                                   c. All                                                       d. None

2. Read the program
                template
                class stack
{
                T st[MAX];
                Int top;
Public:
                stack(){ top= -1;}   
                void push(T var){ st[++top]=var; }
                T pop( ){ return st[top--]); }
                };
                void main( )
                {
                                ?  ss;
               
                                ss.push(‘G’);
               
                }
      To create an object which can take characters what statement should be replaced for ?
a. stack                                                   b. stack                  c. stack                       d. None

3. Match the following:
1) cleardevice ( )                   I) positions the cursor at a position in graphics screen
2) clrscr( )                                              ii) clears the graphical screen
3) gotoxy( )                                            iii) positions the cursor in text window
4) moveto ( )                                          iv) clears the text window
   a. 1- ii, 2- iv, 3- iii, 4- I              b. 1- iii, 2- iv 3- ii, 4 – I    c. 1- I, 2- ii, 3- iii, 4- iv  d. 1- iv, 2- iii, 3- ii,4-I

4.Which of the following is the correct syntax of circle()
                 a. circle( int col, int row, int radius)
                b. circle( int row,int col, int radius)
                c. circle( int col, int row,int radius, int color)
                d. circle(int row, int col, int radius, int color)

5. Match the functions with number of their arguments
                1) line( )                  I) int col, int row, int haxis, int vaxis
                2) arc( )                                   ii) int col, int row, int stangle, int e_angle,int hor_rad,int ver_rad
                3) ellipse( )                             iii) int col,int row, int stangle, int eangle, int rad
                4) fillellipse( )                         iv) int col,int row,int col, int row
a. 1-ii, 2-iv, 3- iii, 4- I              b. 1-iii, 2- iv,3- ii, 4-I               c. 1-I,2-ii, 3-iii, 4- iv                d. 1-iv,2-iii, 3- ii,4-I

6.Match the functions with their functionality
1) getx( )                 I) returns the number of pixels in each row
2) getpixel( )                          ii) returns the x coordinate
3) getmaxx( )                          iii) plots the pixel at the specified location
4) putpixel( )                          iv) returns an integer representing the colour of the pixel
   a. 1- ii, 2- iv, 3- I, 4- iii            b. 1-I, 2-ii, 3- iii, 4- iv           c.1- iii, 2- I, 3-iv, 4- ii              d. 1- iv,2- iii, 3- ii, 4- I

7. Match the functions with their functionality
                1) detectgraph( )   I) It initializes the graphics system
                2) initgraph( )                        ii) releases memory of graphics system
                3) cleardevice( )                    iii) checks the system for graphics
                4) closegraph( )                    iv) clears the graphics window and places the cursor in (0,0)
a. 1-ii, 2- iv, 3- I, 4- iii             b. 1-1, 2-ii, 3- iii, 4- iv             c. 1- iii, 2- I, 3- iv, 4- ii           d. 1-iv, 2- iii, 3-ii, 4- i





                                                                                Answers
                One mark
1. b          11.b         21.b        
2. d          12.b         22.a        
3. a          13.b         23.b        
4.b           14.c        
5.a           15.a        
6.a           16.b        
7.b           17.a        
8.b           18.b        
9.b           19.b        
10.a         20.a        
                two mark
1. c          11.a        
2. b                         
3. b                         
4.a                          
5.c                          
6.a          
7.b          
8.c          
9.a          
10.b        
four  mark
1. c                         
2. b                         
3. a                         
4.a                          
5.d                          
6.a          
7.c          





UNIT IV- Files and Streams,polymorphism and virtual function


One mark questions:

1. A ____ is a general name given to a flow of data.
   a. bits                                                   b. stream                                c. Both a & b                                           d. None

2. Each stream is associated with a ______.
   a. Object                                              b. class                  c. Both                                                    d. None

3. ____ is base class for all the iostreams.
   a. Object                                              b. iostream                             c. ios                                                      d. None

4. _______ is a technique that allows the user considerable flexibles in the way programs are
   used.
   a. Overloading                   b. redirection                        c. Both                                    d.Overriding

5. Each file in C++ is an object of a ________
    a. stream class                   b. bits class                            c. abstract                                               d. None

6. ____ means existing in effect but not in reality.
   a. abstract                                            b. virtual                 c. Both                                                    d. None

7. _______ are used when invoking a program from DOS.
    a. command line arguments    b. parameters                  c. instructions                                        d. None

8. _____ class includes all functions for input of data.
   a. ofstream                                          b. ifstream                              c. stream                                 d. None

9. _____ class includes functions for output of data.
   a. ofstream                                          b. ifstream                               c. stream                                 d. None

10. For working with files _____ header file is included.
   a. stream.h                                          b. fstream.h                           c. Both                                                    d. None

11. fstream.h incorporates _______ header file.
   a. stream.h                                          b. graphics.h                         c. iostream.h                                         d. None

12. ______ are those files created by storing a block of memory.
   a. ASCII                                                b. binary                 c. non-ASCII                          d. Both b & c

13. ___ are those files created by storing each character.
    a. ASCII                                               b. binary                 c. non- ASCII                                         d. None

14. The opening of files is automatically done by ____.
    a. constructor                    b. initialiser                            c. Both                                                    d. None

15. EOF stands for ___
a. end of fstream                    b. end of file                          c. extra out file                                       d. None

16. The ___ method of fstream class can open the file for reading/writing binary or text file.
 a. constructor                                       b. open( )                              c. Both                                                    d. None

17. The parameters to read( ) are an pointer to the block and ____.
    a. filename                                          b. sizeof  the  block                              c. Both                                    d. None

18. Each file object is associated with two integer values called ______
    a. get pointer, put pointer b. show pointer, write pointer              c. read, write                          d. None

19. The pointers specify the ____ number in the file.
    a. byte                                 b. bit                                                        c. file number                         d. None

20. The ____ functions are not part of the class but yet can access the private members of the
     class.
     a. virtual                                             b. static                                                   c. friend                 d. None

21. Static polymorphism is also said to be ______ time polymorphism
     a. compile                                         b. interpreting                                        c. run                                      d. None

22. Dynamic polymorphism is also said to be ___ time Polymorphism
    a. compile                                          b. interpreting                                        c. run                                     d. None

23. Dynamic polymorphism is also said to be ____ binding
    a. early                                                b. late                                                     c. Both                                    d. None

24. Static polymorphism is also said to be ___ binding
     a. early                                               b. late                                                      c. Both                                    d. None

25. catch( ) is called as __________.
     a.. exception handler                       b. throwing exception                           c. Both                                    d. None

Two mark Questions                                                                                                          


1. Which of the following functions belong to ifstream
                      i) get( )                              ii) gets( )                 iii) getline( )                           iv) read( )
                                                v) write( )                                vi) put( )
  a. I, ii, iii, iv                           b. I, iii, iv                                c. v, vi                                                     d. All

2. Which of the following functions belong to ofstream
                      i)get( )                               ii) gets( )                 iii) getline( )                           iv) read( )
                                                v)write( )                                 vi) put
  a. I, ii, iii, iv                           b. I,iii, iv                  c. v, vi                                                    d. All

3. Which of the following are functions in fstream for binary reading and writing
                                i) get(  )                   ii) gets( )                 iii) getline( )                           iv) read( )
                                                v) write( )                                                vi) put( )
    a. iv, v                                                 b. I,ii,iii                                    c. v, vi                                                     d. All

4. Which of the following are true for friend functions:
                      i) They do not belong to the class
                      ii) They belong to a class
                      iii) they are not transitive
                      iv) friendship can be inherited
   a. ii, ii, iv                                              b. I, iii, iv                                c. All                                                        d. None

5. seekg is for ____ and seekp is for _____
    a) getpointer, putpointer    b) putpointer,getpointer     c) None

6. What is the prototype of the overloaded >> operator.
  a. istream& operator>>(istream&, datatype&);     b. ostream& operator<<(ostream&, datatype&);
  c. istream& operator<<(istream&, datatype&);      d. None

7. The feature of OOPs overrules the  data – hiding concept are:
                      i) public members of a class
                      ii)friend functions and friend classes
   a. only I                                               b. only ii                                 c. I, ii                                      d. None

8. Which of the following are true for polymorphism
                      i) The ability to access different implementations of a function using the same name
                      ii) They overrule the concept of data-hiding
                      iii) There are two types of polymorphism : Dynamic & Static
  a. only I                                                b. I,iii                                                      c. All                                        d. None

9. Which of the following is true for pointers to classes:
    i) A pointer to base class can point to base class object as well as derived class object
    ii) A pointer to derieved class can point to only its own object
 a. Only I                                                 b. Only ii                                 c. Both                                   d. None

10. Which of the following are true for virtual functions:
     i) The structure of virtual function in the base class and in the derived class is identical
     ii) The keyword “virtual” is given only to base class function
     iii) The “ virtual” keyword  must be used even when redefining the function in the derived class
    a. Only I,ii                           b. only I, iii                                             c. All                                        d. None

11. Give the syntax of declaring pure virtual functions:
    a. virtual void fun()=0                        b. pure virtual void fun( ){ }   c. virtual void fun( ){ }           d. None

12. Which of the following is true for pure virtual functions.
                      i) There is no implementation in the base class
                      ii) They are always initialized with 0
                      iii) The class containing this function becomes an abstract class
                      iv) when deriving the child class must override these functions.
   a. only ii, iii                                         b. I, iv                                                      c. All                                       d. None

13. Which are the key words used in exception handling in C++:
                                i) try                                        ii) throw                                  iii) throws               iv) catch
     a. I, ii, iv                             b. I, ii                                       c. All                                                        d. None


Four mark Questions                                                                                          


1. Which of the following is a valid program to open the file and write the contents to the file.
i) void main( )
                                {
                                                ofstream outfile(“out.txt”);
                                                outfile<<”Creating an ASCII file”<
                                                outfile<<”C++ is said to superset of C”<
                                }
                ii) void main( )
                                {
                                                ifstream outf(“out.txt”);
                                                outf<<” Creating an ASCII test file<
                                                outf<<” C++ is superset of C”<
                                }
                iii) void main( )
                                {
                                                ofstream outf;
                                                outf<<”\n This is an ASCII file”;
                                                outf<<”\n C++ is superset of C”;
                                }
                iv) void main( )
                                {
                                                ofstream outf(“out.txt”);
                                                char text[]=” this is text line”;
                                                int I=0;
                                                while(text[I])
                                                   outf.put(text[I++]);
                                }

a. only ii                                 b. I,iii                                                       c.  I,iv                                     d. None

2. Match the modes with their description:
                1) in                                        I) Opens the file for writing
                2) out                                      ii) Open file for binary data
                3) ate                                       iii) opens the file for reading
                4) binary                 iv) erase file before reading or writing
   a. 1- iii, 2- I, 3- iv, 4- ii             b. 1- ii, 2-I, 3- iv, 4- iii           c. 1-I, 2- ii, 3- iii,4- iv            d.1- iv,2-iii, 3- ii, 4-1

3. What is the O/p:
                void main( int argc,int *ss[])
                {
                                int sum=0;
                                if (argc<3 o:p="o:p">
                {
                  cout<<” Enter atleast two integers”; exit(0);
                }
                else
                {
                                for(I=1;I
                                cout<<” sum of the numbers is :”<
                }
                }
                c:\> ss     10  20  30  40  50
 
a. 0                                          *b. 150                                                     c. Error                                                   d. None

4.Give the O/P
                class vehicle
                {               public:
                void message(){ cout<<”\n vehicle message”;}
                };
                class car:public vehicle
                {  public:
                  void message ( ) { cout<<”\n car message”;}
                };
                void main()
                {               vehicle *v;
                                v=new vehicle();
                                v->message();
                                v=new car( );
                                v-> message( );

                }
a. vehicle message , car message       b. vehicle message, vehicle message                c. Error   d. None

5.Give the O/P
                class vehicle
                { public:
                virtual void message(){ cout<<”\n vehicle message”;}
                };
                class car:public vehicle
                { public:
                  void message ( ) { cout<<”\n car message”;}
                };
                void main()
                {  vehicle *v;
                                v=new vehicle();
                                v->message();
                                v=new car( );
                v-> message( );
                }
 a. vehicle message , car message      b. vehicle message, vehicle message c. Error   d. None

6.Give the O/P
                class vehicle
                {               public:
                virtual void message()=0;
                };
                class car:public vehicle
                {               public:
                  void message ( ) { cout<<”\n car message”;}
                };
                void main()
                {               vehicle *v;
                                v=new vehicle();
                                v->message();
                                v=new car( );
                                v-> message( );
                }                                                                                                   
a. vehicle message , car message b. vehicle message, vehicle message      c. Error d. None

7. Which of the following is a valid program to open the file and read the contents to the file.
i) void main( )
                                {               ifstream infile(“out.txt”);
                                                char buff[80];
                                                while(infile)
                                                {               infle.getline(buff,80);
                                                                cout<
                                                }
                                }
ii) void main( )
                                {               ofstream infile(“out.txt”);
                                                char buff[80];
                                                while(infile)
                                                {               infle.getline(buff,80);
                                                                cout<
                                                }
                                }
                iii) void main( )
                                {               ofstream outf;
                                                outf<<”\n This is an ASCII file”;
                                                outf<<”\n C++ is superset of C”;
                                }
                iv) void main( )
                                {               ifstream outf(“out.txt”);
                                                char c;
                                                while(outf)
                                                {
                                                   outf.get(ch); cout<
                                }

a. only ii                                 b. I,iii                                                       c.  I,iv                                     d. None

8. Read the below program:
                const int MAX=3;
                class stack
                {               int st[MAX],top;
                                public: class range{ };
                                stack(){ top=-1;}
                                void push(int var)
                                {               if(top>=MAX-1)       throw range();
                                                st[++top]=var;
                }
                int pop()
                {               if(top<0 o:p="o:p" range="range" throw="throw">
                                return st[top--];
                }

                };
void main()
                {               tack ss1;
                                try
                                {               s1.push(11);
                                s1.push(12);
                                                s1.push(24);
                                cout<
                                cout<
cout<
cout<
               
                }catch(stack::range)
                                {
                                cout<<”\n stack is full or empty”;
                                }
cout<<” arrived after catch”;
                }
  events :
i)The member function throws an exception                      ii) Code is executing normally outside a try block
iii) control transfers to the exception handler                   iv) control enters the try block
v) A statement inside try block  causes an error in the member function

State the correct order of the events given
 a. ii, iv, v, I, iii                                                        b. iii, iv, v, I, ii                         c. ii, iv, i, v, iii         d. ii, iv, v, I, iii