Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
366 views
Java Solved Question Paper 2nd
Previous year question paper solved questions with handwritten answers for BBA CA 5th sem Pune University
Uploaded by
sarthakkamble910
AI-enhanced title
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Java Solved Question paper 2nd For Later
Download
Save
Save Java Solved Question paper 2nd For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
366 views
Java Solved Question Paper 2nd
Previous year question paper solved questions with handwritten answers for BBA CA 5th sem Pune University
Uploaded by
sarthakkamble910
AI-enhanced title
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Java Solved Question paper 2nd For Later
Carousel Previous
Carousel Next
Save
Save Java Solved Question paper 2nd For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 14
Search
Fullscreen
* Question Paper- 02. Q 4. Answer any Eight: a) What is a java program structure? > To wate a Sava program, we first define dasses_ Pd then put them together [pamumentation Section | <2--- Suggested | Package Statement. <----- Optional Pare | Import Statements | g----- Optronal | | aberfince Statements | <----- Optional _ 7 | class Definitions <---= Ophonal | Main method class <---- Essential —b) Deine this keyword a a _—>_The “this! is_used inside the method or_construchr-te refer tts ___own object ie. this_is always a reference -te-the object of the _carrect class’ -type- “ed Explain in detail the data types in java Q— — The data types of java areas allows: 3) Primvbive types G) byte —L) Float. (i) Short. (viJ_ double. (ii) int (iJ boolean list long Luin) chav: 2) Reference Data Types. + Referonce data -lypes are made by-the logical grouping of Ihe logical grouping © primitive data ‘lypes Ce ne * Arrays, classes, enum eke. are Lhe example of reference data ypeWhat is an Interface Q | An interface in Java_is a blueprint of ‘static constants and abstract_metheds— only: erface- A A class can implements mere dhan_one_inter ws ie | Apter face is nok a class but a set of requirements Ir the class a class: Tt hae (What is the use of Reader a +) Input stream is cimilar to. rea Istream_1s_ similar -ty vrrter classes Ieecies mere gee to read the characters fiom thefile [Mavitee which can be_used to usr the coolants “te-the le (© Whi method ig used te specify containers layout wrth syrte, | 7) Flowlayoat Manager te method is used ty spect fy containers layouk: | Syntac:- Container container > new Container || container. settayout Crew Plowlayout UJ: nd llriter class 2 der. classes and output which are designed br (9) What_is the default layout for frame and Panel 9 —> +The default layout managers for IFrame Cequivalent te Framed | and Pane) Cequivalent t» Panel) are: 7“ +f TFrame: The default layout manager for a TPrame is 4 Border Layout. — be piety + TPanel: The default layout _managet_ “fora TPanel is Flow Lays (J. Explain Modifiers and Access Contrals. used io java. +) Modifiers are keqwords tbat Modify the behaviaur_of classes, _methods and variables: + Access Modifiers: Public, prvake, protected and default i Access Controls determine the aceassibility of classes, imethods .and variables contyals :. Public. Access... Private Access, and default Acess Access Protected fice exceptions ava Uibsanes sdhich exploins (i) Ust_and explain any 2 ine butt Jions are_available ind \lariow built-in exce 3 Array SadexOut oF Bound Pracp on, Null Pointer Exceptinn. the ~—_ These_eacep’ the error. situation exception, Pilenlotfound Exception, . “ ClasstlotfoundException, ToExceptien. pions are Artthr ae 9 ek Content Pane () : zy Explain the purpose __— > The _getContentPane U_is method of the TErame. and __ classes Ets maxy- _purpese_isto “Return the contents __ of the finme_or dialog? The content pane 1s the area here _add_compenents, suchas, buttons, labels. tert fields. and cther ayraphical user interface (G05) _ rae 9 ane Q.2. Attempt any POUR:- a a) Explain in detail the features of Tava. tc _ Following are the list of features of Java: 1) Simple» Tava is. a.simple language: There. aie various Conepts Hat make. the Java asa simple language 2) Secures Tava is aimed tv be. used in networked oF eee environments Java does not allocate direct pointer AD. MENON]. 4) Portatle +” » 1s port } ey me mraoalts JA was an. important. goal of ! nies L be portable. so-\bat as new architectures Cdue to { a operating. ayslem, or both) are developed « the. Jiawa j a could be .perted tp then 4 ss . wi T°. - ae Onented: Toa is.on Aruely object-oriented langurge: cot java is an object: Java has a wide variety of classes aa _ uct 7 rt ° be cause it. pr a robust Langlais 2 ee Sava. dove v | many Safequards th ensure. rel in not allow pointer which avoids secunty oe a e). Mulkthreaded «Java wae designed me toe tl wodd requirement of Creating interactives ne , | : roultrthreaded programming, pro grars -that do many things i pregrams- Tava supports which allows you to wate Simultaneous! y- a er a 3) Ah tere-tlearal AL central issue Pir_the Tava designe | was that of code lenge ty and portability. One ofthe “resin s_cthat_ne_guraniee _ _reain problems faang programmers E_Ne- ‘exists! thab if you write a preqram-ctoday, tt call nun 4 _teommarnw. een _on the Same machine —________- _4)_ nterpreted.- Taya enables she creation of Cress platfirm 1 programe by compiling. infe.ao iotermediate Tepresentaben * Eeatted Tava bytecode. ie ie Fa) High Performance = The java bytecode was carefully designed __[go-that it would be easy +t» translate directly vot mitre machine code for vert high performance by Using a just i dime compiler 19), Distributed - Tava factlities the building of Aistubuted applica _ bya. collection of classe for use in networked application Tava is designed for -the th diskibuled environment of the . Eorernet: : v) | Dynamics Tava language \s capable of dynamically link in in new class libranes, methods and objecks Java is imberpreted, 4 Java 1s an extremely dynamic \angquages at runtime. () What. are the rales ‘for_ method Overloading and methed overriding 2. Explain it with example. I =. 4Method Overriding Method Overloading - ~a)| To method overriding. the signaliie Tn method. overloading, we have of overriding _pethed_rnust be Same_jmore Ahan one-fnclions. with the ‘las overridden method: Fn other words, Jsame Same but orth defferent / iYhe_ number of orguments their _|sets of argument Ly pes in jypes.and the onley_rust be Same different order \.n__both- overtiding_and overridden 4 ix 6 Wels be The return type of. overloaded functions may be same or different: [he return type of both overriding and_overtid den enethed must beSame _3) [Th is an example of run-time Bt ig.an_exampe of comple= Lime | polymorphism po paly mor phism: drat © 4) [You cannot make overriding ‘method Overloaded funchons.can have less_ public. than -lhe overridden metal | drferent actess modifies: (J piteane betseen interface qad_ahsleact clas. Seed Interface Abstract _class- J 3k supports _mulbple Toberrtance: {Sn this multiple inherttane ts.net Supported 3) [Only static_and Final voriables — Finel, non-final, static & non-state at used variables can be used mplementation of abstract |Tmplementation of interface 1s eee . De ae - Class members ke private ee By default members.7¢ public as can : ere a Keyword is Used to }" extends"! keyword ig used 0 r extend an ahstine close |except) an. haodliy | | Explain the concept of exception an Exception: An “exception isan ee dicrupts De parm Flow of a program's execution: It is usually cause ri __|.an_errar suchas ing to divide by zero» accessing-a- le that doesn't exist. or other unexpected _ cond tions ~~ [Enceplion Hardling = Exceptien- bandhing- references of respending to. exceptions. ip_a_controlled ae ae of allowing the programs. crash or bebave sopredictably, | Non handling Jets devel ers_wrvle code to handle errats _ exception handling Ie velop aches provides. by the programming. language Su Baal black : - = e) What are the drfferent types of streams 9 Expla Topust streams = purpesete read_data fro a Source ____ Details: These streams are _used +to_read_data From_various __}oput sources such a files, keyboarck. and network Cnne: ‘Output sbreams « purpsse te wie data too destination. = __Such_as_-files, display er_network connections. Bt 3) | Byte streams: purpese- to handle tow binary data: | Details» These Streams. operate. row byte and are_used fir i reading and twirling binary. data. _ 4), character Streams purpose to handle text deta | Details « character stream. work worth characters. rather “than bits i making them more Suitable -fr reading and writing text == sit data in_vattous._characler_ encoding. 5). Buffered Streams = purpose~ 0 | rena.n.cépiiy, fetuct | Ss purpese- Lo Improve perfor e_by te the pumber_of I/O opesators pe ee | write data_in_larger chunks which reduce the number of i Thi Jcally involves using Speci ; gracefully This typically tpv 4 Pe Cg edch onl “| Details: These streams are used +> write data te destinatisns L i ctals: Buffered Streams use an ‘inbshndl buPforsto read ‘nd S clinteractsens. wrth. “the underlying data seurce oF devhinadian @.3(a) Inte a java program tv dis play alternate character fion a Java. pe play given String: : class. Albe1nate characlers i e Public static ueid main Cshing args al? ‘ ~ Sting. input= “abe defghiyk z _ printAernate Characters Goputd: — __—_} a lt | a public _static_voi psinkAlhernate Charnes. (Shing args Je ik Cstre = Null J str_is Empty UJ f an rintla (The Input string is empty of Now); Ent Jon For Cok leo, icstr length Os. ie z System. out proto C str. char AL _ System. out: pantln (b) Write Jaya pragram te calculate area of Circle, Triangle & . Rectangle. Cuse method ovelpadine ‘ TY public. dasa. Areacalculadoe . public double calewatoy Nea. Celoubte dius t tedurn Math PI radius * yadiva’, ¥ fablic double CalcalatorAtea (double 7c heights = boolean’. Iangle t 4 Cictriomle ) t ; return, 0:5 baset heights spublie=¢ brow naw Sllegal rqunant Bmplion (Inuit. paramebersster triangle aret: caloulation:’d: 3 ublic stobte_vold maa (string args 1) i Arse CalcalatorRadtus= 5=8; tls AreaCaleulator Calcalator = net: freaCalealedoe °° doable cirtuleRadius = 8:0, leRad | double ciraletrea = calcalator: calealaborhrse Core _ wus), System-out printla( “Area of cirde: “+ circ efrea.* | double rectanglelenglh. > 4°. double rectangle! dth= 6-0: z nets are Calealator colewlate Area (rectangle a length, reclangle width), = | S jotem-oxt: priate (” Prea_of he redangle:# reckanglees doable trangleBase= 3 0; = double triangle Height = 4:0, ti double Was nica: calculator, calculator Criang!eBass a = LlangleHeight: tue); _|Systero-out printle (* prea_of the triangle vt Lriangl eftrea): ae (Write a java program display ASCEE values of the charatts from a File. 2 =? {import java: lo BufferedReader, import Java-lo- FileReader; ‘\mpert je io. LOExceplion., ublic class Asclivaluesfiun file I public stalic veld main (sting args ost | string Flepath = “\nput-tert"; a Any ( Baflered Reader bre new Buffered Reader Ciao AleRades a (Blepatbh))% e i 4 int ch;while (€chs brread OS 420 z ystem. out: print (" characles.:"+Cchor) cha” ASCTF yalae x : F catch (TOEKeptio e) f : System: out println (" pp_errorccurd while Tedding -the fle +t _e. getislessages QO): (a) Witte _java_program to display moultiplication of 4 given num \nto the list box by clicking on buttr,. E Amport java Bwing-*; ee import java. “3____ _Amport java. aust - event. Action Event; — Lm port java awk event: ActionListener; ; __-publiic_class_multiplication TableApp extends Frame ¢ “private Test Field_nu mber-Held:, a pavate —TButwn_displayBu-tton; — vate Tlist_< String> tablelist; _ public MultiplicalionTable App Qt _ sefTille ("Multi plicationtablerpp"S: a we Q Prame- EX1T-oN-CLOSE J) ; 300,400); setSize TPanel_ panel = new j pane (J; panel. setLayoul Crew Grid Layout (s1)J; number field = new: ITertfield QO; displayButtn> new Button ("Display "ds DefaultLisLModel
labdtlodel = new Default List. Nlodel <> 5 - tgdldict = new: jlist <> Cable mode), A DisplayButton:add Action Listener Chew, Reionbishener Jt e @® Override” 1c public void action Performed.CAclionEvent ¢ Jz Lablewlodel clear): String pumberTopul= number field get Text Ui t CoumberTaput-): t ay y \nt number: Joteger pass 2 “2 "+ result Lf for Cink ie tics toy 1H \nt_vesult= number * 15 - table Model-aad Element Coumbex +,"2¢ 14 catch (number frmal Exception ox) t - lable (lode! add Element (° Tovalid_input pleace entero valid nombers J a anel-add (numborfield J: - ane! add_ (display Button); panel add( new-EScrlipane (table Uist); odd Cpanel , ng args ds 3 1% public. static veld main Cshis Cun Swing vtillies Jovokelaler Mult plicalionTable Apps app» ew. moultiplicationTabl eApe (2s app out Visible Clrue Js we} x wwclassmate What. is collection Q Explain. collection -Frame work in Asbailal “The_collection_is a group of _ objects stored in_ Single unit tohich canbe operated upen_as_ a_single entity collection Framework prrvides a set of interfaces 4 dasses for handling cllech ons of _ objects: tes Tnterfaces 2 "Collections The rook interface in the csllection va herd The main methods include add O.remove (J oo + Lisk: Extends collection and epee an eee collection. of Sequence Er, Arraylist . Unkedlist is Set = Extends collection and represents a collect: on thak [ 7 doesn't ollow duplicale element Lx: Hashset,Treeset . Tmplements “+ Arraylist = Atteszable array implements of Usk. a + Linked list Tnglements List and Deque using a. doubly inkelist - + Masel: Implements set using a hash table _ + TreeseL: Tmplements sek using a red- black tree _t HashMap = Tmplements_ Map_using a_ Bach tables | oe _Agorethms = The collection framework includes al gorthms that operate _on_collechon, such_as_sorti, Key Features = © Unified Architecture. 2) Ce - __@ 5 Performance ae aS. searching. — :Swing ts a. Java Foundabion classes LY a tas : | Swing libraries for creating cam? Swing components. are light-weight and_ provide better. level and fee! {consisten Poundalion ANT 1s a Java « AWT libraries. for creating ical 4 Abi vebuil n pal AIT Components. are heavy- and_depend_.of he nadiverys #1 welght Vow $ feel $$" ldlrite a Java pro femstreng or nob | import javawtsl: Scanner; ¢ public class Armstrang Number _ public static ald main | System: out: println “Er __num= scan: nertint UW: demops pumps 2 while (temp. tro) | tems emp fa lo; H —yes= rest (rem® rem® tem): R temps temp 1:10), | ie Coume = ree else \ystam. out print ( "\n frmstrong Number "} ram > check whether given oumber ts Use Static keyword. static int num temps mee rem’ a) tring args CIS | Scanner sean > MewScanner CSsysteminds 1 the number:"'J. : f _l Siystem- out prnele (\n Net an Armstrong Number:"J;(a Dake a java_program bs copy only Non numenc data from ‘one file ts_another file. : _Amport java.io BufferedReader; mee __\mport java.io 3ufferedIerbers . Amport_java- -io: File Readers _import joven ti. ltt Tats java io FOBxception, ublic class _copyAlon Numberic Data o ablic eaedla main (Shing “aigs eel 3 Cargs length |=: gts oh a, ss ge -favacepy Numberic Date ___ = er), if | System: out puntln(“y 7
You might also like
The Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good Life
From Everand
The Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good Life
Mark Manson
4/5 (6388)
Principles: Life and Work
From Everand
Principles: Life and Work
Ray Dalio
4/5 (634)
The Gifts of Imperfection: Let Go of Who You Think You're Supposed to Be and Embrace Who You Are
From Everand
The Gifts of Imperfection: Let Go of Who You Think You're Supposed to Be and Embrace Who You Are
Brene Brown
4/5 (1160)
Never Split the Difference: Negotiating As If Your Life Depended On It
From Everand
Never Split the Difference: Negotiating As If Your Life Depended On It
Chris Voss
4.5/5 (983)
The Glass Castle: A Memoir
From Everand
The Glass Castle: A Memoir
Jeannette Walls
4/5 (8302)
Grit: The Power of Passion and Perseverance
From Everand
Grit: The Power of Passion and Perseverance
Angela Duckworth
4/5 (633)
Sing, Unburied, Sing: A Novel
From Everand
Sing, Unburied, Sing: A Novel
Jesmyn Ward
4/5 (1254)
The Perks of Being a Wallflower
From Everand
The Perks of Being a Wallflower
Stephen Chbosky
4/5 (10337)
Shoe Dog: A Memoir by the Creator of Nike
From Everand
Shoe Dog: A Memoir by the Creator of Nike
Phil Knight
4.5/5 (933)
Her Body and Other Parties: Stories
From Everand
Her Body and Other Parties: Stories
Carmen Maria Machado
4/5 (887)
The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers
From Everand
The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers
Ben Horowitz
4.5/5 (361)
Hidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space Race
From Everand
Hidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space Race
Margot Lee Shetterly
4/5 (1007)
Steve Jobs
From Everand
Steve Jobs
Walter Isaacson
4/5 (3237)
Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
From Everand
Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
Ashlee Vance
4.5/5 (581)
The Emperor of All Maladies: A Biography of Cancer
From Everand
The Emperor of All Maladies: A Biography of Cancer
Siddhartha Mukherjee
4.5/5 (297)
A Man Called Ove: A Novel
From Everand
A Man Called Ove: A Novel
Fredrik Backman
4.5/5 (5058)
Angela's Ashes: A Memoir
From Everand
Angela's Ashes: A Memoir
Frank McCourt
4.5/5 (943)
The Art of Racing in the Rain: A Novel
From Everand
The Art of Racing in the Rain: A Novel
Garth Stein
4/5 (4346)
The Yellow House: A Memoir (2019 National Book Award Winner)
From Everand
The Yellow House: A Memoir (2019 National Book Award Winner)
Sarah M. Broom
4/5 (100)
The Little Book of Hygge: Danish Secrets to Happy Living
From Everand
The Little Book of Hygge: Danish Secrets to Happy Living
Meik Wiking
3.5/5 (458)
Brooklyn: A Novel
From Everand
Brooklyn: A Novel
Colm Toibin
3.5/5 (2091)
Yes Please
From Everand
Yes Please
Amy Poehler
4/5 (1993)
Devil in the Grove: Thurgood Marshall, the Groveland Boys, and the Dawn of a New America
From Everand
Devil in the Grove: Thurgood Marshall, the Groveland Boys, and the Dawn of a New America
Gilbert King
4.5/5 (278)
The World Is Flat 3.0: A Brief History of the Twenty-first Century
From Everand
The World Is Flat 3.0: A Brief History of the Twenty-first Century
Thomas L. Friedman
3.5/5 (2283)
Bad Feminist: Essays
From Everand
Bad Feminist: Essays
Roxane Gay
4/5 (1077)
The Woman in Cabin 10
From Everand
The Woman in Cabin 10
Ruth Ware
3.5/5 (2780)
A Tree Grows in Brooklyn
From Everand
A Tree Grows in Brooklyn
Betty Smith
4.5/5 (2032)
The Outsider: A Novel
From Everand
The Outsider: A Novel
Stephen King
4/5 (2839)
The Sympathizer: A Novel (Pulitzer Prize for Fiction)
From Everand
The Sympathizer: A Novel (Pulitzer Prize for Fiction)
Viet Thanh Nguyen
4.5/5 (141)
A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
From Everand
A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
Dave Eggers
3.5/5 (692)
Team of Rivals: The Political Genius of Abraham Lincoln
From Everand
Team of Rivals: The Political Genius of Abraham Lincoln
Doris Kearns Goodwin
4.5/5 (1912)
Wolf Hall: A Novel
From Everand
Wolf Hall: A Novel
Hilary Mantel
4/5 (4087)
On Fire: The (Burning) Case for a Green New Deal
From Everand
On Fire: The (Burning) Case for a Green New Deal
Naomi Klein
4/5 (76)
Fear: Trump in the White House
From Everand
Fear: Trump in the White House
Bob Woodward
3.5/5 (830)
Manhattan Beach: A Novel
From Everand
Manhattan Beach: A Novel
Jennifer Egan
3.5/5 (906)
Rise of ISIS: A Threat We Can't Ignore
From Everand
Rise of ISIS: A Threat We Can't Ignore
Jay Sekulow
3.5/5 (144)
John Adams
From Everand
John Adams
David McCullough
4.5/5 (2544)
The Light Between Oceans: A Novel
From Everand
The Light Between Oceans: A Novel
M L Stedman
4.5/5 (813)
The Unwinding: An Inner History of the New America
From Everand
The Unwinding: An Inner History of the New America
George Packer
4/5 (45)
Little Women
From Everand
Little Women
Louisa May Alcott
4.5/5 (2369)
The Constant Gardener: A Novel
From Everand
The Constant Gardener: A Novel
John le Carré
4/5 (277)