SCJP Mock Exam 3

合集下载

Sun认证Java程序员SCJP考试科目

Sun认证Java程序员SCJP考试科目

Sun认证Java程序员SCJP考试科目Sun认证Java程序员(SCJP)考试科目通过SUN任何一门专业认证后,考生将收到SunMicrosystems 总公司寄发的资格证书及徽章,并有权将通过Sun认证的标记印在个人名片上,作为个人技术能力的肯定。

以下是店铺整理的关于Sun认证Java程序员(SCJP)考试科目,希望大家认真阅读!考试方式:全英文试题,以电脑作答,在授权的Prometric考试中心参加考试考试科目:Sun Certified Programmer for Java 2 Platform 1.2 考试编号:310-025考试题型:59道选择题及简答题及格标准:答对61%(36题)以上时限:120分钟费用:1500元考试科目:Sun Certified Programmer for Java 2 Platform 1.4 考试编号:310-035考试题型:59道选择题及简答题及格标准:答对61%(36题)以上时限:120分钟费用:1500元考试科目SCJP的四个科目310-025、310-035、310-055、310-056的区别如下:Sun Certified Programmer for Java 2 Platform 1.2(310-025)表明你掌握了JDK1.2的'知识。

Sun Certified Programmer for Java 2 Platform 1.4(310-035)表明你掌握了JDK1.4的知识。

Sun Certified Programmer for the Java 2 Platform, Standard Edition 5.0(310-055)表明你掌握了JDK1.5的知识。

Sun Certified Programmer for the Java 2 Platform, Standard Edition 5.0 Upgrade Exam(310-056)是从JDK1.2或JDK1.4升级到JDK1.5的考试。

ccsk mock exam V2.1

ccsk mock exam V2.1

1. A key element of the "Store" phase of Data Security Lifecycle is:A. Asset ManagementB. Crypto-shredding (对应destory)C. ClassifyD. Application SecurityE. Rights Management2. In incident response, which of the following cloud provider technology implementation can impede investigations?A. Choice of firewall systemB. SecurityInformation Event Management (SIEM) toolsc. P r oprietary log formatsD. Encrypted custome r dataE. Virtualizati on environment snapshots3. What capabilities can a cloud pavider delive r to suppo rt offline analysis of potential incidents?A. Enc r ypted customer dataB. VPN capabilitiesC. Defense in depth st r ategiesD. Snapshots of customer's entire virtual envi r onmentE. Regular audits stipulated in se r vice level agreement4. An impo r tant consideration when perfo r ming a remote vulnerability test of a cloud-based application is toA. Schedule vulne r ability test at nightB. Obtain contractual permission fo r testC. Use application layer testing tools exclusivelyD. Use network laye r testing tools exclusivelyE. Use techniques to evade cloud provider's detection systems5. What is benefit of federation of identity in a Cloud environment?A. Enabling allied enterprises to authenticate, provide single or reduced Sign-On(SSO)B. Provides granula r a pplication entitlementsC. Simplifies the secure and timely management ofon-boa r ding (p r ovisioning) and off-boarding(dep r ovisioning) ofuse r S in the cloudD. Allows transmission of use r info r mation f r om a PolicyInfo r mation Point (PIP) to a Policy Decision Point (PDP)E. Enfo r ces the policy decision at the Policy Enfo r cement Point (PEP)6. p r ominent r ecommended standards to enable federation of identity in cloud envi r onments includeA. OpenlDB. KerberosC. SAML and WS-Fede r ationD. X.509E. 5507. A key element of the "Create" phase of the Data Security Lifecycle isA. ClassifyB. Rights ManagementC. Application 5ecu r ityD. Enc r yptionE. Crypto-Shredding8. A cloud deployment of two or more unique clouds is known as:A. Inf r astructures as a 5e r viceB. A Community CloudC. A Hybrid CloudD. A Private CloudE. Je r icho Cloud Cube Model9. ENl5A: because it is practically impossible to process data in encrypted form, customers should have the following expectation of cloudp r ovide r s:A. Provider shot」Id always manage custome r encryption keys with ha r dware security module(H5M) storageB. Provide r should immediately notify customer wheneve r data is in plaintext fo r mC. Provide r should be PCI compliantD. provider must be highly t r ustwo r thy and have compensating controls to p r otect custome r data when it is in plaintext fo r mE. Homomorphic encryption should be implemented where necessa r V10. How can key management be leve r aged to p r event cloud providersf r om inapprop r iately accessing customer data?A. Use strong multi-factor authenticationB. Seg r egate keys f r om the provider hosting dataC. Stipulate enc r yption in contract languageD. 5ecure backup p r ocesses fo r key management systemsE. Select cloud provide r s within the same country as customer11. W hich of the following is a consideration specific to the migration of virtual machine systems to new cloud providers?A. Loss of hypervisor accessB. Use of indust r y accepted VM hardening guidelinesC. Understanding what tool s a r e p r ovid e d fo r s e cu r e data transferD. Tr a ffi c fil te ring o n VM b ac kpl a n e o r En te r pri se Se rvi ces Bu s (E S B)E: Identification of provider-specific exte『isions to virtual machine environment12. H ow must performance monito r ing of Provide r s and testing fo r vulnerabilities be handled in a client-provider relationship?A. As long as the P r ovide r does not suffer a breach, it does not have top r ovide customers with visibility into vulnerability scan resultsB. providers who obtain "clean" scan r esults in r egular periodic testingenjoy a limited ”SafeHa r bor" from liability associated with a breach.C. The cloud services provider must contractually supply r esults of pe r iodic scan and vulne r ability testing to the customerD. The cloud services ag r eement must allow the cloud se r vices client O r designated third party to test for vulnerabilities in the system.E. The custome r must define acceptable levels of pe r fo r mance that provide r s must meet14.ENISA: Which of the following is among the vulnerabilities contributing to a high r isk r anking fo r Netwo r k Management?A. User provisioning vulnerabilitiesB. AAA vulne r abilitiesC. Hype r visor vu Inera bilitiesD. Inadequate physical security procedu r esE. System or 0/s vulnerabilities15.. The key po r tability objective(s) for lnfrast r uctu r e as a Service ( laaS) is/areA. p r ese r ving snapshots of virtual machine imagesB. Mig r ation of custom w r itten applications and achieving a successful data mig r ationC. Achieving a successful data migration onlyD. Migration of custom written applications onlyE. Getting new cloud p r ovide r to abso r b costs of t r ansition16.EN ISA: Which is not one of the ive key legal issues common across allscenarios?A. data p r otectionB. globalizationC. intellectual prope r tyD. p r ofessional negligenceE. outsourci ng se r vices and changes in cont r ol17.F r om a t r aditional s ecurity perspective, the inc r ease in centralization of data c r eates concern for an increase in which r isk?A. Lack of complianceB. DowntimeC. Account takeoversD. Identity theft巳I nsider abuse18. For cloud custome r s, a "Right to Audit" clause in the contract with you r cloud provide rA. is an undue burden upon internal audito r5B. is a prerequisite for engaging with cloud provide r SC r eplaces cloud p r ovide r certification r equi r ementsD. prevents a cloud provide r from igno r ing compliance requirementsE. should be obtained whenever possible19. Which attack su r faces, if any does virtualization technology introduce?A. The hype r viso rB. Virtualization management components apa r t from the hyperviso rC ”Network" attacks that communicate between different VMs over a shared physical ha r dware backplane,r athe r than a network.D. All of the above20. ENISA: in Infrastructure as a Service (laaS), who is responsible for guest systems monito r ing?A. Internet Se r vice Provider (ISP)B. Cloud Provide rC. CustomerD. Shared r esponsibilityE. Data Com门1issioner21. What is a key success facto r to suppo r t application security in infrastructure as a Service ( laas)environments?A. Limit use to private cloud delivery modelB. Use of structu r ed data tablesC. Realtime antivirus shieldsD. Use of SAML O r OpenIDE:tr usted virtual machine images22. Which of the following should be r eviewed as part of the vendor selection p r ocess, when conside r ing Providers?A. Willingness to allow the customer o r a third-party to audit the service.B. Fo r laas p r ovide r s only, the Provider 气inclusion of security into the softwa r e development lifecycle.C. Compatibility of provider's custome r support processes, procedures, tools and support hours with you r5D. A & CE. provider's app r oa c h to balancing damage cont r ol with evidence gather ing after a data breach23. In a c lient-p r ovide r r elati o n s hip, who i s r es po『isible for which po r tions ofdata classification?A. Client defines data classification; P r ovide r enforces theclient's requirements based on classificationB. p r o vid e r d e fin e s data cl as sification; Cli e nt enfo r c es th e p r ovide r'sr equir e m e nts based on c l ass i fica ti o nC. Client and provide r jointly define data classification policy; provider classifies data and enfo r ces the client’srequi r ements based on classification.D. Customer defines data classification; provide r encrypts data at rest and data in tra『1sit.E. provider enforces a "Default Deny All”policy fo r all but data owner and authorized personnel24. EN ISA: which is a potential security benefit of cloud computing?A. Mo r e efficient and timely system updatesB. Provider can obfuscate system 0/S and versionsC. Greater compatibility with custome r IT infrastructureD. ISO 27001 ce r tificationE. Lock-In25. Implementing security cont r ols that satisfy r egulatory r equirementsA. are assured by SAS 70 Type II auditsB. are p r ima r ily a custome r r esponsibility in laaS environmentsC. must be stated within the provide r cont r actD. a r e primarily a customer responsibility in Saas environmentsE. should be listed on the cloud p r ovide r roadmap26. What should be the subject of an organization's r isk analysis of a CloudService Provider?A. Alignment of the provider's r isk assessment strategy and processes withthe user'sB. The vendorC. The provider's ability to maintain current asset inventory and valuation informationD. Recent vulne r ability assessments and penet r ation tests.E. The ove r all service27. When r esponding to subpoenas and othe r legal requests, the cloud se r vice provider and custome r shouldA. unified processesB. identical access to custome r on-premise logfilesC. separate processes and p r ocedu r es to avoid conflicts of interestD. a protected VPN for exchanging legal documentsE. a single legal counsel rep r esenting both parties28. If a customer has a mandate to use a specific cloud provider which is lacking in appropriate redundancy capabilities including failover, the custome r mayA. Insist upon custom SLAs gua r anteeing redundancyB. Use a third party cloud brokering solutionC. Backup sensitive information ta a separate cloud provider nightlyD. Use a load bala r icing device at the customer's network perimete rE. Utilize cloud bursting29. In the CSA Reference Model, what do we call the laye r that differentiates Platfo r m as a Service ( PaaS) f r om Inf r ast r uctu r e a s a Service(laaS)?A. Virtual m ac hin esB. AbstractionC. Multi-TenancyD. RoutersE: Integration & Middlewa r e30. T r ue or False: With the common ca rr ier model of service delivery,the se r vice provider should no r mally have little o r no access to o r cont r ol ove r the custome r s' data or systems beyond the contracted level of management.A. TRUEB. False31. What best desc r ibes the tradeoff of lnfrast r ucture as a Service as compared to other cloud deploymentA. Lower initial cost and greate r security featuresB. G r eate r secu r ity featu r es and less extensibilityC. Lowe r initial costs and g r eate r long te r ms costsD. Less security features and greater extensibilityE. G r eate r initial costs and greater security features32. Which of the following is one of the five essential cha r acte r istics of cloud computing as defined by NIST?A. Multi-tenancyB. Measured se r viceC. Unlimited bandwidthD. Nation-state bounda r iesE. Hybrid clouds33. ENISA: "VM hopping" is:A. Instability in VM patch management causing VM r outing e r rorsB. lmprope r management of VM instances- causing customer VMs to be commingled with othe r custome r systemsC. Lack of vulnerability management standa r dsD. Using a comp r omised VM to exploit a hype r visor, used to take cont r ol of other VMsE. Looping within virtualized routing systems34. How can clients best add r ess a provider's use of virtualization technologies in the client's business continuity plan?A. Understand how VM images can be captu r ed and ported to new providers if needed.B. Ensure that the contract requires the Provider to achieve a specified business continuity objective .C. Ensure that the contract requi r es the Provider to conduct a Business Continuity Plan (BCP) test at least annually.D. Ensu r e that audito r s and security asse s s ors are familiar with Cloud and visualizati on challengeE. p r e f e r o p e n to prop r i e t a ry virtu a li za tion APl s fo r m a n a g e m e nt, se curity,a nd int e rop e r a bility35. Which practices will minimize softwa r e modification when po r ting Platform as a Service (PaaS)solutions?A. Use a common p r ogramming language th r oughoutB. Assure possibility of migration of backups, logs, metadata and test systems used by the providerC. Quality assu r a nce testing in the software development lifecycleD. Develop an architectu r e with abstraction to minimize direct access to proprieta r y modulesE. Well documented se r vice level agreements36. The key concern of data backup andr ecovery schemes is A Data should not becommingled with other customersB Assu r a nce that deleted data is in fact unrecoverableC Assu r ance that cloud provide r has multiple data centers fo r disaste rr ecove r VD Data aggregation should not cause breachesE They must prevent data loss, unwanted data ove r W r ite and destruction37 ENISA: An Open Standard that simplifies laaS virtual machine portability between provide r S isASAMLBOCCICS A J A C CD:DMTFE OVF38. ENISA: Licensing Risks r efer toA. Cloud provider may not have all approp r iate government operating licensesB. A traditional software licensing scheme may lead to high costs or lack ofcompliance in cloud systemsC. Risk that softwa r e company may go out of business, leading to expiration of licenses for mission critical softwa r eD. Use of country-issued drive r s licenses fo r use r identificationE. Cloud provider employees not maintaining operating system licensefiles39. What are six phases of the Data Security Lifecycle?A. Create,Classify,Use, Store, Retain. Dest r oyB. Create. Classify, Use,Store, Archive, Dest r oyc. C r eate, Sto r e, Use,Sha r e,A r c hive, Dest r oyD. Assign,Define,Create, Process, Sto r e, DestroyE. As s ign, Define, Store, P r oce s s, Tran s mit, Destroy40. ENISA: an underlying vulne r ability related to Loss of Governance isA. Lack of s upplie r r edundancyB. Uncl e a r a sse t owne r s hipC. Hyp e rvi so r vu In e r a bili t i esD. Lack of r eputational isolationE. Inadequate capacity planning41. Amazon Web Se r vices EC2 Secu r ity G r oups are an example of whichsecurity principle?A. Vetting of employeesB. Virtual Machine ha r deningC. Patch managementD. Compartmentalizati on/ IsolationE. De-pe r imeterisation42. When utilizing a public laaS network, which of the following is a typical Vulne r ability Assessment p r oblem to overcome?A. Tools like Nmap and Nessus a r e not compatible with public cloud configu r ationsB. Cloud provider may disallow or disrupt scanning activitiesC. Custome r cannot obtain physical access to scanning ta r getsD. Typical hype r viso r configu r ation obfuscates O/S fingerp r intingE. Scanning activity must occu r with SSL connections43. The key concern of data location is:A. Data should not be commingled with other customersB. Data is stored only in geographic locations permitted by regulationsC. Data is located only on r edundant storage subsystems with high MTBF(mean time between failures)D. Assu r ance that all data r equested by legal autho r ities has been retrievedE. Assu r ance that prohibited locations cannot access the data44. Which of the fol lowing is the best description of information riskmanagement?A. Assessi ng the r isks to data at r est and data in motionB. Aligning risk exposure to risk tole r anceC. Assessing and mitigating the gaps in info r mation p r otection between vendo r a nd userD. A continuous p r ocess fo r managing the r isks to information accuracy acco r ding to the r isk appetite of the information owner.E. A continuous p r ocess fo r managing the risks to information th r ough due diligence, compliance and business enablement45. Which of the following could be a area of plaintext exposu r e of data even when t r aditional data-in-transit, data-in-re s t and data archive encr yption is employed?A. Backup tapesB. Network trafficC. SCPD. Virtual machine swap filesE. RAID sto r age46. Th e c l o ud co n s um e r h as m o r e tact i ca l r es p o n s ibili t y fo r impl e m e ntin ga nd m a n ag in g sec u r i t ycontrols in which cloud deployment model?A. Software as a Se r viceB. Je r icho Cloud Cube ModelC. lnfrast r uctu r e as a Se r viceD. Security as a ServiceE. Platform as a Se r vice47. Storage as a Se r vice is considered a sub-offering ofA. HadoopB. Software as a Se r viceC. Securityas a ServiceD. Platform as a Se r viceE:Inf r astructure as a Se r vice48. What is the most common form of virtualization?A. Process virtual machine (VM) or application virtualizationB. Virtualized operating systemC. Emulation of the unde r lying raw hardware (native execution)D. p r esentation virtualizationE. Hypervisored o r virtual machine virtualization49. Cloud p r ovide r s can minimize risks of inside r abuse via whichr ecommended best practice?A. Compartmentalizati on of job dutiesB. Onsite inspection of cloud provider facilitiesC. Regula r ly tested disaste r recove r Y plansD. Well documented service level agreementsE. Minimizing use of thi r d party providers50. In an laaS environment with limited security solutions preconfigu r ed, how might one rest r ict administrative access, assuming SSH is used fo r system administrators?A. Whitelist a source IP I n etwork used by systems administ r ators for po r t 22B. Require hard to guess passwo r dsC. Limit inbound connections from systems within the same laaS p r ovide rD. Whitelist a source IP I netwo r k used by systems administrato r s fo r port 443E. Monito r syslog files daily1.Why is it important to be able to restoreB2.In order to validate the identityb3.If a customer has mandateb4.How can key managementb5.What of the following bestb6. D7.DENISA:which is not ident a8.How can virtual machineb9.The key concern of data backupe10.How can a customer besta11.What is resource poolinga12.D13.A cloud deployment of two orc14.Why should customers understandb15.ENISA: an example of a userC16.Which of the following entity groupingsC17.What are six phases of theC18.Which of the following are good practices for thirdD19.Criteria which may be used to createD20.What of the following is NOT a cloudC21.D22.A key element of the DestoryB23.ENISA: A key area of controls forC24.What is a benefit of federationA25.A lack of due diligence inA26.True or false with the common27.D28.Which practices will minimize softwareD29.ENISA: reason forA30.The key portabilityA31.How must performance monitoringC32.From a traditional securityB33.Who is responsible forB34.How is encryption35.A large enterprise seeking to useD36.ENISA which is a potentialA37.D38.As part of customer due diligenceE39.ENISA: isolation failure refersE40.ENISA: to mitigate credentialB41.D42.The key concern of data location isB43.ENISA: lock-in is ranked asB44.ENISA: VM hoppingD45.D46.Which of the following is an areaD47.ENISA:in infrastructure as a serviceC48.D49.Which of following is NOT50.D。

全国英语等级考试全真模拟卷第三级(附光盘)

全国英语等级考试全真模拟卷第三级(附光盘)

全国英语等级考试全真模拟卷第三级(附光盘)全文共6篇示例,供读者参考篇1National English Test Level 3 - A Student's ViewWow, the National English Level Test Level 3! That sounds like a really big deal. I remember when my teacher first told our class about it. We had just finished our English lesson, and she said we would be taking this important test soon. A bunch of my classmates got really excited, but I was a little nervous. Tests can be scary, especially really important ones!My teacher could see some of us were worried, so she explained what the test was all about. She said it's a way for students like us to show how good our English skills are. The test has listening, reading, writing, and speaking sections to check all the different things we've learned in English class.The listening part sounded kind of fun. The teacher said we'd hear conversations and stories, then have to answer questions about them. In class, we always enjoyed the listening exercises, especially the funny dialogues. My best friend Lily and I would try to imitate the voices and make each other laugh.Then there's the reading section, which is about understanding passages. That doesn't sound too bad, since we read lots of stories and articles for homework anyway. Though I'm a little slower at reading than some of my classmates. I'll have to practice more.Writing is one part I'm kind of nervous about. We'll have to write a short essay on a topic they give us. Essays are hard! You have to organize all your thoughts and make sure your grammar and spelling are perfect. Miss Lee has been helping us practice timed writings though, so that should help.The speaking section might be the trickiest for me. We'll have to answer questions and describe pictures out loud. I sometimes stumble over words when I get nervous. But Miss Lee said the test instructors are really nice, so maybe that will help me relax. Plus, we've done lots of partner speaking activities to prepare.To get ready, Miss Lee had us do some practice test materials. They came with a CD too, so we could listen to the audio at home. The practice tests showed us what types of questions would be on the real test. There were multiple choice questions, fill in the blanks, and short answers. It was good practice, but some of the questions were pretty hard!A couple weeks before the test, my parents got me some other sample test books from the bookstore to work through. I spent a lot of time reviewing vocabulary, grammar points, and doing listening exercises with my headphones on. The more I practiced, the more confident I started to feel.Finally, the day of the big test came! A bunch of kids from other schools came to take it too. We all had to sit at desks spread out in the school auditorium. It was a little intimidating with so many people around. The nice test teachers passed out the test booklets and CDs, then explained very clearly how everything would work.The listening section was just as I expected - we heard conversations and stories through headphones, then had to answer comprehension questions. I missed a few, but I tried my best. The reading passages were interesting topics like animals and sports, which made them easier to understand. Phew, made it through those two sections!We took a short break before starting the writing section. I had a hard time coming up with ideas for my essay at first, but then I remembered the tips for brainstorming from class. Once I got my thoughts sorted out, the actual writing went pretty smoothly. Hopefully I organised it well enough!Then came speaking time. The teachers called students one-by-one into another room to do the speaking section. When it was my turn, I felt a little shaky but took a deep breath. The test teacher was so friendly and encouraging, which helped me relax a lot. We talked about some pictures, answered hypothetical questions, and did a role-play. It wasn't as scary as I thought it would be.Phew, after the speaking part was done, the whole test was finally over! I felt so relieved, but also proud for giving it my all. It was tough, but our preparation in class with Miss Lee really paid off. I can't wait to get my results back and see how I did. Hopefully I score high enough to get that fancy certificate!I'd definitely recommend the National English Test Level 3 to other students. It's challenging for sure, but taking it was a great way to show off all the English I've learned so far. Plus, it helped me get much more confident at reading, writing, listening and speaking. Maybe I'll aim for Level 4 next year - gotta keep leveling up those English skills! If I can make it through that tough test, I'll be like a real pro. Just call me the English master!篇2My Big Day for the English Test!Hi there! My name is Emily and I'm a 5th grader. Today was a super important day because I took the National English Proficiency Test Level 3 exam! I've been studying really hard for months to get ready. My parents and teachers told me this test is a big deal and shows how good my English skills are. I was a little nervous, but also excited to show off what I've learned.The test had four sections - listening, reading, writing, and speaking. We started with the listening part first thing in the morning. The nice test proctor played audio clips from a CD and we had to mark our answers on a special bubble sheet. Some of the questions asked us to listen for specific details, while others wanted us to get the main idea. There were conversations between kids and adults as well as lectures on topics like animals and vacations. I tried my best to listen really carefully!After listening, we moved on to the reading section. This part had lots of different passages - stories, advertisements, instructions, and more. We had to read each one and then answer comprehension questions about things like the main idea, vocabulary in context, making inferences, and author's purpose. The passages covered all kinds of subjects that kids might be interested in like sports, science experiments, and school events. My favorite was the funny story about a boy and his pet frog!By the time the reading section was over, it was lunchtime. We got to go outside and run around for a bit to rest our brains. Some of my friends were feeling tired, but I had brought an energy bar that my mom packed to refuel. After our break, it was time to tackle the writing tasks.For the writing portion, we had two assignments. First, we had to read a short prompt about an everyday situation and write a response of 100-120 words giving our opinion and reasons. The prompt I got was about whether kids should have set bedtimes or be allowed to go to bed whenever they want. I wrote all about how a regular bedtime schedule helps kids get the sleep they need to stay healthy and do well at school.The second writing task was harder. We were given a topic and some guiding questions, and then had to write an essay of 200-250 words developing our ideas with examples and details. My topic was "An Activity I Enjoy," so I chose to write about my favorite hobby of playing soccer. I described the equipment and rules, explained why I like the teamwork and exercise, and gave an example of scoring an exciting goal during my last game. Organizing and developing an whole essay in English was definitely challenging, but I tried my best!Last but not least was the speaking section. One at a time, we went into a private room and spoke our responses into a recording device while the proctor gave us prompts from the test booklet. First, I had to describe a set of pictures that told a story, like making sure to hit all the key details in my narration. Then I had to listen to a prompt and give my opinion, using reasons and examples to back up what I said. Finally, I got a hypothetical situation and had to propose a solution, again supporting my ideas with clear explanations.Speaking in English without stopping to think too hard was probably the most nerve-wracking part! But I took a deep breath each time and just tried my best to respond naturally and completely. When I finally finished that last speaking task, I was so relieved and proud of myself for making it through such a long, challenging test.Overall, the whole experience of taking the National English Proficiency Test Level 3 was pretty intense! My brain definitely feels a little fried after concentrating so hard for hours. But I'm really glad I prepared as much as I did by practicing tests from previous years, working on skills with my English tutors, and staying after school for extra help. Thanks to all that hard work, Ifelt mostly confident going into each section, even if some parts were tougher than others.Now it's just a waiting game until I get my scores back in a couple months! I'm keeping my fingers crossed that I did well enough to prove my English abilities and get that certificate. No matter what though, I know I grew a lot as an English learner just by taking on this big challenge. Tests may be stressful, but they help show how far you've come and what to work on next. I'm feeling inspired to keep practicing my English skills through reading, games, movies, and conversations with native speakers.Whew, what a big day! I'd better go rest up now. Tackling that huge exam honestly knocked me out. But I'm so proud of myself for persevering through all those listening, reading, writing, and speaking sections. Wish me luck on a great score! Labors Cantantas Forever! (That's "Go Songbirds!" in Latin, my school's motto.) Thanks for letting me share my testing experience!篇3National English Level Test Time!Hi everyone! My name is Lily and I'm in 5th grade. Today I want to tell you all about the National English Level Test that Ijust took. It's a really big deal test that lets you see how good your English is compared to other kids across the whole country. The version I took was the Third Level, which is the level for upper elementary students like me.First off, let me just say - PHEW! I'm so glad that test is over. It was pretty tough, not gonna lie. But I studied really hard, so I think I did ok. My mom signed me up for this special English class to get ready. We did tons of practice tests and learned all kinds of strategies. I may have gotten a little sick of English by the end, but it was worth it!Ok, so the test had four sections - Listening, Reading, Writing, and Speaking. The Listening part had different recordings that we had to listen to very carefully and answer questions about. Some were conversations between people, while others were talks or instructions. I had to use those funny-looking headphones that go over your whole ear. That part wasn't too bad for me since I love listening to English songs, shows, and movies.Then there was the Reading section where we had different passages to read - stories, advertisements, tables, you name it! The questions asked things like what the main idea was, what certain details were, or what vocabulary words meant in context.I read a lottt during my studying, so that helped me get faster at reading in English.Writing is probably the hardest part for me. We had to write a letter and an essay responding to different prompts. It's just so much work putting all the grammar rules together while trying to make your writing flow nicely and get your point across clearly. I made sure to leave time at the end to check over my writing.Finally, there was the Speaking section which was pretty nerve-wracking if I'm being honest. You have to go one-by-one into a separate room with a recording device. The questions came through headphones and you had to speak your responses out loud to get recorded. Topics could be anything - describing a scene, stating an opinion, retelling a story. I tried to speak slowly and clearly like we practiced. Hopefully I didn't say anything too silly!The whole test took almost three hours from start to finish which felt like forever to my short student attention span. We did get a couple short breaks, thank goodness. I just tried to shake out my arms and legs when I could to stay focused. I also packed a healthy snack to nibble on during the breaks.After it was all over, I just felt relieved and proud of myself for pushing through. My teacher said she was already proud ofus all no matter what our scores end up being. She knows how hard we worked. Though I must admit, I am really hoping I did well enough to earn a certificate!The best part is, the test came with a CD full of learning games, videos, songs, you name it! I love playing the cool English games and watching the funny videos. It makes practicing English feel way more fun than just reading textbooks all the time. I really think using that CD helped prepare me.Some of my friends are hoping their scores qualify them to participate in an English summer camp where you go stay overnight and do all kinds of fun English activities. That would be so awesome! Even if I don't get to go this year, I'll just study harder for the next level test.Anyway, those are all my thoughts on this huge English test I just conquered. It was definitely challenging, but also kinda exciting getting to showcase my English skills after working so hard on them. I'm just relieved it's over for now so I can finally read my English novels for fun again instead of just studying! Fingers crossed I did well. Wish me luck!篇4The National English Test Adventure!Hey there, friends! It's me, your pal Timmy. I've got the most exciting story to share with you all today. Brace yourselves for an adventure that will take you through the thrilling world of the National English Proficiency Test!It all started one sunny morning when I arrived at school, my backpack stuffed with pencils, erasers, and a rumbling tummy (I may have skipped breakfast for an extra few minutes of video games). Mrs. Robinson, our awesome English teacher, greeted us with her usual warm smile and a surprise announcement."Class, today we'll be taking the National English Proficiency Test Simulation Paper Level 3!"A collective gasp filled the classroom. Some of my classmates looked puzzled, while others wore expressions of sheer determination. As for me, well, let's just say I was somewhere in between – a little nervous but mostly excited!Mrs. Robinson handed out the test booklets, and the adventure began. The first section was all about listening comprehension. We put on our headphones and tuned in to dialogues and stories, trying our best to answer the questions that followed. I gotta admit, some of those conversations were pretty tricky! But hey, that's half the fun, right?Next up was the reading section. We tackled passages about everything from science experiments to tales of brave explorers. I found myself completely immersed in the stories, like I was right there alongside the characters, navigating through their adventures.Then came the writing part. We had to put our creative juices to the test and pen a short story or essay. Now, I won't lie – this was the part that had me sweating a little. But with Mrs. Robinson's helpful tips and a deep breath, I let my imagination run wild!Finally, we tackled the speaking section. One by one, we stepped up to the microphone and unleashed our English speaking skills. Some of us chatted about our hobbies, while others described their favorite places or fictional characters. It was like we were putting on our own little theater performance!After what felt like an eternity (but was probably just a couple of hours), we handed in our test booklets, feeling a mix of relief and accomplishment. Mrs. Robinson congratulated us on our hard work and promised to go over the answers together in the next class.As I walked home that day, I couldn't help but feel a sense of pride. Sure, the National English Proficiency Test was no walk inthe park, but we had taken it head-on and given it our best shot. And you know what? That's what really matters!So, there you have it, my dear friends – the tale of my first encounter with the National English Test. It was a rollercoaster ride of emotions, challenges, and triumphs. But most importantly, it was an adventure that brought our class together, pushing us to explore the depths of our English skills.Who knows what other linguistic quests await us in the future? But one thing's for sure – with determination, hard work, and a sprinkle of fun, we'll conquer them all! Stay tuned for more exciting tales from the English-learning trenches!篇5The Big English Test Adventure!Hi there! My name is Emma and I'm a fifth-grader. I just had the craziest experience with this huge English test called the National English Proficiency Test Level 3. Let me tell you all about my big adventure!It all started a few months ago when my English teacher Ms. Roberts told our class that we'd be taking this really important test. She said it would show how good our English skills were inlistening, reading, writing, and speaking. I'm not gonna lie, I was pretty nervous at first. Tests can be super scary, especially really long ones!But Ms. Roberts helped us get ready by giving us lots of practice tests and activities from this big blue book called the "National English Proficiency Test Level 3 Simulation." It had ALL sorts of listening exercises, reading passages, writing prompts, and speaking questions, just like the real test. We did practice tests what felt like a million times!My favorite sections were the listening and reading parts. The listening had these fun conversations between kids and there were always silly jokes or stories that made me laugh. The reading passages were really interesting too - they had articles about animals, different countries, hobbies, you name it! I learned so many new words and facts.I definitely struggled more with the writing and speaking sections though. For the writing, we had to write letters, essays, and all sorts of paragraphs. Making sure I used proper grammar, spelling, and punctuation was hard. Speaking out loud was even harder for me because I'm pretty shy. But Ms. Roberts had us practice giving speeches and having conversations until I got more comfortable.Finally, test day arrived! I was pretty nervous waiting in line, clutching my pencil case and my lucky teddy bear. But when I sat down and got my test booklet, I told myself "You got this, Emma!" because I had practiced so much.The listening section went by super fast. The conversations and stories were just like the practice ones, so I didn't get too flustered. Same with the reading - I kept reminding myself to read carefully and double check if I was unsure of an answer.Writing was still hard, but I took my time and reread the questions over and over. I made sure to plan out my essays and letters first before writing them out. Ms. Roberts always said the brainstorming step was just as important as the writing part.When it was time for speaking, I did get a little sweaty! But I looked at the friendly test grader, took a deep breath, and just pretended I was talking to my stuffed animals at home. I stated my answers clearly and threw in some of those transition words and idioms we had practiced.After what felt like AGES, the test was finally over! I was so tired but really proud that I had given it my all. While I waited for my results, I worked on even more practice tests from the Simulation book and its CD of audio files. I wanted to be absolutely ready in case I needed to take any sections again.A few weeks later, the scores came in the mail. I had passed all four sections!! I was overjoyed and gave the biggest hug to Ms. Roberts and my parents. All that hard work and practice from the National English Proficiency Test Level 3 Simulation had really paid off. The test may have been hard, but it was also an awesome, rewarding experience!So to all my fellow test takers out there - study hard, practice tons, and don't be nervous! If you prepare well with materials like the Simulation tests, you'll do wonderfully. Just think of it as one big, exciting English adventure! Now if you'll excuse me, I have to go celebrate with some ice cream. Testing is tough work!篇6Hi there! I'm Sam, a 5th grade student, and I want to tell you about this really cool English test I took recently called the National English Proficiency Test Level 3. It was kind of like a big exam, but it was actually really fun!First off, we had to buy this big book and CD to prepare for the test. The book was filled with all kinds of practice questions and exercises to get us ready. There were reading passages, grammar drills, listening exercises, and even speaking practice. We used the CD to listen to the audio parts at home. My favoritesections were the dialogues – they were like little stories of kids my age talking about everyday things like school, friends, and hobbies.When the test day arrived, I was a tiny bit nervous, but mostly excited! We had to go to a special testing center with lots of other students. First up was the listening section. We put on headphones and listened to conversations, stories, and instructions. Then we had to answer multiple choice questions about what we heard. It was kind of challenging having to listen so carefully, but also pretty engaging with all the different voices and situations.After listening, we moved right into the reading part. There were passages about topics like science, narratives, and school life. The passages weren't too long, but there were a bunch of questions following each one that really made you think deeply about whatyou read. You had to identify main ideas, make inferences, figure out vocabulary from context, and more. It was a good mental workout!Then came the grammar and writing sections. These involved things like filling in blanks, rewriting sentences, and short answer writing. I'm not gonna lie - the grammar questions were pretty tough! You really had to know your verb tenses,sentence structures, and the nitty gritty details. The writing prompts weren't too bad though. We had to write a paragraph or two about common topics like our hobbies and experiences.Last but not least was the speaking section. We wentone-by-one into a room and spoke into a recorder. The tasks included introducing ourselves, describing pictures, androle-playing conversations. It felt a little weird talking to a machine at first, but I tried to just imagine I was chatting with a friend and it went smoothly.After almost four hours of awesomely exhausting English skills, the test was finally over! A few weeks later, I received my score report and...I passed! I earned a nifty certificate too. While the exam wasn't easy, I actually had a great time putting my English abilities to the test in all areas like listening, reading, writing, speaking, and even my grammar ninja skills. It felt like such an accomplishment.To anyone thinking of taking this test, I'd say go for it! It's challenging for sure, but also an amazing way to practice and showcase your practical English communication skills. Just study hard with those practice materials, don't stress too much, and most importantly - have fun with the language. Who knows, youmight just earn an English level up like I did! Let me know if you have any other questions!。

JAVA认证历年真题:SCJP认证套题解析(3)

JAVA认证历年真题:SCJP认证套题解析(3)

JAVA认证历年真题:SCJP认证套题解析(3)41、Which of the following statements are legal?A. long l = 4990;B. int i = 4L;C. float f = 1.1;D. double d = 34.4;E. double t = 0.9F.(ade)题目:下面的哪些声明是合法的。

此题的考点是数字的表示法和基本数据类型的类型自动转换,没有小数点的数字被认为是int型数,带有小数点的数被认为是double型的数,其它的使用在数字后面加一个字母表示数据类型,加l或者L是long型,加d或者D是double,加f或者F是float,可以将低精度的数字赋值给高精度的变量,反之则需要进行强制类型转换,例如将int,short,byte赋值给long 型时不需要显式的类型转换,反之,将long型数赋值给byte,short,int型时需要强制转换(int a=(int)123L;)。

42、public class Parent {int change() {…}}class Child extends Parent {}Which methods can be added into class Child?A. public int change(){}B. int chang(int i){}C. private int change(){}D. abstract int chang(){}(ab)题目:哪些方法可被加入类Child。

这个题目的问题在第35题中有详尽的叙述。

需要注意的是答案D的内容,子类可以重写父类的方法并将之声明为抽象方法,但是这引发的问题是类必须声明为抽象类,否则编译不能通过,而且抽象方法不能有方法体,也就是方法声明后面不能带上那两个大括号({}),这些D都不能满足。

43、class Parent {String one, two;public Parent(String a, String b){one = a;two = b;}public void print(){ System.out.println(one); }}public class Child extends Parent {public Child(String a, String b){super(a,b);}public void print(){System.out.println(one + " to " + two);}public static void main(String arg[]){Parent p = new Parent("south", "north");Parent t = new Child("east", "west");p.print();t.print();}}Which of the following is correct?A. Cause error during compilation.B. southeastC. south to northeast to westD. south to northeastE. southeast to west(e)题目:下面的哪些正确。

2023年四川英语三级考试真题

2023年四川英语三级考试真题

2023年四川英语三级考试真题2023 Sichuan English Level Three ExamPart I: Listening ComprehensionSection A: Conversations1. What are the speakers mainly discussing?A. A vacation planB. A work projectC. A new restaurantD. A movie premiere2. Where does the conversation most likely take place?A. A libraryB. A bankC. A department storeD. A cafeSection B: Passages3. What is the main topic of the passage?A. Climate changeB. Renewable energyC. Urban developmentD. Wildlife conservation4. Where does the speaker most likely work?A. A universityB. A research instituteC. A wildlife sanctuaryD. A government agencyPart II: Reading ComprehensionSection A: Multiple ChoiceRead the following passage and answer the questions:The World Health Organization (WHO) defines mental health as a state of well-being in which every individual realizes his or her own potential, can cope with the normal stresses of life, can work productively and fruitfully, and is able to make a contribution to her or his community.5. According to WHO, what is mental health?A. Achieving one's goalsB. Avoiding stressC. Being able to work efficientlyD. Being a productive member of societySection B: Fill in the BlanksRead the following passage and complete the sentences with the correct information:6. The author suggests that proper nutrition and exercise are important for maintaining (7) __________.7. The passage mentions that lack of sleep can lead to (8)__________ disorders.8. The author recommends seeking help from a mental health professional if one is experiencing (9) __________ symptoms.Part III: WritingWrite an essay of at least 300 words on the following topic:The Importance of Cultural Exchange ProgramsIn your essay, discuss the benefits of participating in cultural exchange programs, such as gaining a broader perspective, improving language skills, and fostering international friendships.Give examples of how cultural exchange programs have positively impacted individuals and communities.Overall, the 2023 Sichuan English Level Three Exam covers a range of listening, reading, and writing skills, testing students' ability to comprehend spoken and written English as well as express their ideas cohesively in written form. Good luck to all the test-takers!。

四川省大学英语新三级2023年考试真题

四川省大学英语新三级2023年考试真题

四川省大学英语新三级2023年考试真题Sichuan Province University English New Level III 2023 ExaminationPart I Listening Comprehension (20 points)Section A (10 points)Directions: In this section, you will hear 10 short conversations. At the end of each conversation, a question will be asked about what was said. Both the conversation and the question will be spoken only once. After each question, there will be a pause. During the pause, you must read the four choices marked [A], [B], [C], and [D], and decide which is the best answer. Then mark the corresponding letter on the Answer Sheet with a single line through the center.Example:You will hear:Woman: How are you doing with your paper?Man: I have to work on it this weekend.Now the conversation:Woman: When are you going to work on your paper?Man: This weekend.You will read:[A] At the exam office.[B] Next weekend.[C] This weekend.[D] In the professor's office.From the conversation, you can tell that the man will work on his paper this weekend. So you should choose [C].1. A. She will go home on Friday.B. She is moving to a new place.C. She has a heavy schedule.D. She is planning a party.2. A. They will ask the department head.B. They don’t know the answer.C. They will see the budget officer.D. They will make a decision later.3. A. The woman should return a red pen.B. Jill has already returned a pen.C. The red pen someone returned is fine.D. The man saw that pen somewhere.4. A. John is reading to leave.B. John will get there in an hour.C. John is coming soon.D. John is leaving for the office.5. A. Jane found the keys.B. The keys are not in the car.C. They can use the extra set of keys.D. Jane left the keys in the car.Section B (10 points)Directions: In this section, you will hear a passage. Read the passage and answer the questions or complete the statements. The questions and statements will be spoken only once. After you hear a question, read the four possible answers on your paper and decide which one is the best answer. Then mark the corresponding letter on the Answer Sheet with a single line through the center.In order for a country to develop and remain competitive, it must encourage entrepreneurship. Entrepreneurship brings innovation and drives economic growth. Countries with higher levels of entrepreneurship tend to have higher levels of economic development. As such, fostering an environment conducive to entrepreneurship is crucial for continued growth and prosperity.6. What does entrepreneurship bring?A. Stagnation.B. Innovation.C. Monotony.D. Conformity.7. Countries with higher levels of entrepreneurship tend to have higher levels of _______.A. technology.B. happiness.C. economic development.D. bureaucracy.As technology advances and global connectivity increases, the world of work is changing rapidly. Many traditional jobs are being replaced by automation and artificial intelligence, while new industries and career opportunities are emerging. It is essential for workers to adapt and acquire new skills to remain relevant in the evolving job market.8. What is replacing traditional jobs?A. Automation and artificial intelligence.B. Manual labor.C. Outsourcing.D. Internships.9. What is essential for workers to do in the evolving job market?A. Retire early.B. Stay in the same job.C. Adapt and acquire new skills.D. Avoid technology.Part II Reading Comprehension (40 points)Section A (15 points)Directions: In this section, there are five passages. Each passage is followed by four questions or incomplete statements. For each of them, there are four choices marked [A], [B], [C], and [D]. You should decide on the best choice and mark the corresponding letter on the Answer Sheet with a single line through the center.Passage OneWhat was the first color called in English?The noun orange came into the English language in the 1300s. Oranges existed long before that, but they were thought of as "yellow-red" or "red-yellow" until the modern English word was created. Why? Before that time, the color we now call orange was not regarded as distinct. It was called geoluhread meaning "yellow-red." In England, it is geoluread and in old English,ġeolurēad. Was calling orange 'red-yellow' logical? For years, geoluread was the name for this color. Then eventually, that changed and the fruit's name became the default. In the 1540s, people began to recognize an orange as a delicious fruit from Spain. From that moment on, the fruit's name became the color's name in English. Once people knew the name of the fruit, theybegan to see the color more often, and the name became associated with the color.10. What was the color orange called before the 1300s?A. Yellow-red.B. Geoluread.C. Red-yellow.D. Spain.11. Why did the color orange not have its own name before the 1300s?A. People didn't know it existed.B. It was considered too similar to red and yellow.C. It was too rare.D. It was only used for fruit.12. When did people start calling the color orange by its own name?A. In Spain.B. In the 1300s.C. In the 1540s.D. In England.13. How did the fruit's name become associated with the color?A. People painted fruit orange.B. They were named at the same time.C. The color was more noticeable once orange was a common word.D. People ate the fruit.Passage TwoWe all know that water is essential to life on Earth and often take it for granted. However, in many parts of the world, clean drinking water is scarce and precious. A lack of clean water can lead to various health problems and even death. Access to clean water is a basic human right, yet millions of people worldwide still lack it. It is important that we all make efforts to conserve water and protect water sources for future generations.14. Why is access to clean water important?A. To prevent drowning.B. To avoid earthquakes.C. To reduce pollution.D. For health and survival.15. What causes health problems in areas with a lack of clean water?A. Dirty clothes.B. Air pollution.C. Contaminated water.D. Insufficient sunlight.16. What should people do to protect water sources?A. Continue wasting water.B. Conserve water.C. Pollute water sources.D. Overuse water sources.17. Who benefits from efforts to protect water sources?A. Only future generations.B. Only people who are already sick.C. Everyone on Earth.D. Only the wealthy.Section B (25 points)Directions: In this section, there are two passages with five multiple-choice questions following each passage. Read the passages carefully and then answer the questions or complete the statements. For each question or statement, there are four choices marked [A], [B], [C], and [D]. You should decide on the best choice and mark the corresponding letter on the Answer Sheet with a single line through the center.Passage OneTeaching children the value of money from a young age is important for their financial literacy and future financialwell-being. One way to do this is through pocket money or allowance. Giving children a set amount of money regularly teaches them the concept of budgeting, saving, and spending wisely. It also helps them understand the value of hard work and the importance of making choices.18. What does teaching children about money from a young age lead to?A. Financial irresponsibility.B. Future financial success.C. Laziness.D. Financial illiteracy.19. What does giving children pocket money teach them?A. How to waste money.B. The importance of saving it all.C. The concept of budgeting.D. The value of borrowing money.20. What is one benefit of giving children pocket money?A. It teaches them to steal.B. It helps them understand the value of hard work.C. It encourages them to make careless choices.D. It makes them dependent on others.21. Why is teaching children about money important?A. So they will become bankers.B. So they can buy expensive things.C. So they can make informed financial decisions.D. So they will depend on their parents.22. How does giving children pocket money help them?A. They learn to buy everything they want.B. They are encouraged to save their money.C. Budgeting is unnecessary.D. They understand the value of laziness.Passage TwoWhat is global warming?Global warming refers to the long-term heating of the planet. It is mainly caused by human activities that release heat-trapping gases into the atmosphere. The most significant of these is carbon dioxide, which is released when we burn fossil fuels like coal, oil, and gas for energy. The greenhouse effect is the mechanism behind global warming. Nature uses the greenhouse effect to keep our planet at a comfortable temperature. However, human activities have overloaded the atmosphere withheat-trapping gases, causing the planet to heat up at an alarming rate.23. What causes global warming?A. The sun.B. Human activities.C. The planet's core.D. The moon.24. What is the main heat-trapping gas released by human activities?A. Carbon dioxide.B. Oxygen.C. Nitrogen.D. Water vapor.25. What is the greenhouse effect?A. The cooling of the planet.B. A mechanism that traps heat in the atmosphere.C. The heating of the atmosphere.D. An effect that sends greenhouse gases into space.26. What does nature use the greenhouse effect for?A. To heat the planet.B. To cool the planet.C. To keep the planet at a comfortable temperature.D. To cause rapid climate change.27. What has caused human activities to overload the atmosphere with heat-trapping gases?A. Too much rain.B. Too many cars.C. Burning fossil fuels.D. The sun's radiation.Part III Vocabulary and Structure (20 points)Directions: There are 40 incomplete sentences in this part. For each sentence, there are four choices marked [A], [B], [C], and [D]. Choose the best answer to complete the sentence and mark the corresponding letter on the Answer Sheet with a single line through the center.28. If only he _______ to me about the problem sooner.A. had spokenB. speaksC. speakD. spoke29. I'll call you _______ I arrive.A. whenB. whileC. tillD. where30. The concert is _______ to be delayed due to the bad weather.A. planB. plansC. planningD. planned31. She gave him all her money _______ a gift.A. forB. withC. asD. of32. His car went out of control and _______ on the road.A. skidB. slipsC. skiddedD. slipping33. The manager asked her _______ the report by the end of the week.A. finishesB. finishedC. to finishD. finishing34. Some species of wildlife are in danger _______ extinction.A. fromB. toC. ofD. for35. Will you please help me move this _______ off the table?A. stuffB. troubleC. trashD. thing36. I _______ if you would help me with this project.A. askedB. is askedC. askingD. ask37. The teacher asked the students to _______ the meaning of the word.A. guessB. discussionC. studyD. decide38. Don't worry, I will _______ the problem as soon as possible.A. solveB. resolveC. dissolveD. involve39. The cost of living in the city is much higher _______ in the countryside.A. thanB. toC. fromD. as40. If you need any help, please _______ hesitate to ask.A. wouldn'tB. shouldC. mightD. don'tPart IV Reading Comprehension (40 points)Section A (15 points)Directions: There are four passages in this section. Each passage is followed by some questions or unfinished sentences.For each of them, there are four choices marked [A], [B], [C], and [D]. You should decide on the best choice and mark the corresponding letter on the Answer Sheet with a single line through the center.Passage OneHealth and HappinessHealth and happiness are closely related. When you are healthy, you feel good mentally and physically. Likewise, happiness boosts your immune system and makes you more likely to take care of yourself and stay healthy. People who are happier tend to live longer and have a higher quality of life. Additionally, positive emotions have a calming effect on the body and reduce stress levels.41. What is the relationship between health and happiness?A. They are unrelated.B. They are not related at all.C. They are closely related.D. Health leads to unhappiness.42. How do positive emotions affect the body?A. They have no effect on the body.B. They increase stress levels.C. They reduce stress levels.D. They make people sick.43. Do happy people tend to live longer?A. No, they have shorter life spans.B. No, it has no effect on their lifespan.C. Yes, they live longer.D. Only if they are healthy.44. Why does happiness boost the immune system?A. It weakens the immune system.B. It has no effect on the immune system.C. It strengthens the immune system.D. It makes people sick.Passage TwoModern TechnologyModern technology has changed the way we live, work, and communicate. While technology has many benefits, such as increasing efficiency and convenience, it has also brought about challenges and concerns. In today's digital world, people are constantly connected through smartphones and social media, leading to issues like information overload and decreasedface-to-face communication.45. How has modern technology changed the way we live?A. It has no effect on our daily lives.B. It has made our lives more difficult.C. It has made our lives easier and more connected.D. It has disconnected us from each other.46. What are some benefits of modern technology?A. Decreased efficiency.B. Information overload.C. Convenience and efficiency.D. Lack of connectivity.47. What are some challenges brought about by modern technology?A. Increased face-to-face communication.B. Decreased information overload.C. Greater personal connections.D. Decreased face-to-face communication.48. How are people connected in today's digital world?A. Through physical letters.B. Through smartphones and social media.C. Through email.D. Through newspapers.Passage ThreeInternational TravelInternational travel has become more accessible and popular in recent years. With advancements in transportation and technology, people can travel to different countries more easily and affordably. Traveling abroad allows individuals to experience new cultures, languages, and cuisines, as well as broaden their perspectives and gain new insights.49. What has made international travel more accessible?A. The internet.B. Transportation and technology advancements.C. Language barriers.D. Lack of interest.50. What can people experience through traveling abroad?A. Only new languages.B. Only new cuisines.C. New cultures, languages, and cuisines.D. Nothing new.51. How has international travel changed in recent years?A. It has become less popular.B. It has become more expensive.C. It has become more accessible and affordable.D. It has become restricted.52. What can individuals gain from traveling abroad?A. Nothing.B. Language skills.C. New insights and perspectives.D. Disinterest.Passage FourSocial mediaSocial media has revolutionized the way people communicate, connect, and share information. Platforms like Facebook, Twitter, and Instagram allow individuals to connect with friends, family, and strangers from around the world. While social media has many benefits, such as instant communication and easy access to information, it also presents risks like cyberbullying and privacy concerns.53. How has social media revolutionized communication?A. It has had no impact on communication.B. It has made communication more difficult.C. It has revolutionized the way people communicate.D. It has made communication less efficient.54. What can individuals do on social media platforms?A. Nothing.B. Instant communication.C. Connect with friends and family.D. Only share information.55. What are some risks associated with social media?A. No risks at all.B. Cyberbullying and privacy concerns.C. Increased privacy.D. Only benefits.56. What are some benefits of social media?A. No benefits.B. Instant communication and easy access to information.C. Decreased communication.D. Increased cyberbullying.Section B (25 points)Directions: In this section, there are two passages with five multiple-choice questions following each passage. Read the passages carefully and then answer the questions or complete the statements. For each question or statement, there are four choices marked [A], [B], [C], and [D]. You should decide on thebest choice and mark the corresponding letter on the Answer Sheet with a single line through the center.Passage OneThe Benefits of ExerciseRegular exercise has many benefits for both the body and mind. Physical activity can help improve cardiovascular health, build muscle strength, and maintain a healthy weight. Exercise also releases endorphins, which are natural mood lifters that can reduce stress and anxiety, leading to better mental health.57. What are some benefits of regular exercise?A. Increased stress and anxiety.B. Decreased cardiovascular health.C. Improved cardiovascular health and mental health.D. Lower muscle strength.58. What does physical activity help with?A. Weakening cardiovascular health.B. Building muscle weakness.C. Improving cardiovascular health and building muscle strength.D. Increasing weight.59. How does exercise affect mental health?A. It has no effect on mental health.B. It causes stress and anxiety.C. It reduces stress and anxiety and improves mental health.D. It increases stress and anxiety.60. What are endorphins?A. Chemicals that cause stress.B. Natural mood lifters.C. Harmful substances.D. Muscle builders.61. Why can exercise benefit mental health?A. Because it increases stress levels.B. Because it doesn't affect mental health.C. Because it releases endorphins.D. Because it causes anxiety.Passage TwoThe Importance of SleepSleep is essential for overall health and well-being. Getting an adequate amount of quality sleep is crucial for physical and mental health. Lack of sleep can lead to various health problems, including impaired cognitive function, decreased immune function, and。

剑桥雅思13阅读test3passage3烤鸭

剑桥雅思13阅读test3passage3烤鸭

剑桥雅思13阅读test3passage3烤鸭下载提示:该文档是本店铺精心编制而成的,希望大家下载后,能够帮助大家解决实际问题。

文档下载后可定制修改,请根据实际需要进行调整和使用,谢谢!本店铺为大家提供各种类型的实用资料,如教育随笔、日记赏析、句子摘抄、古诗大全、经典美文、话题作文、工作总结、词语解析、文案摘录、其他资料等等,想了解不同资料格式和写法,敬请关注!Download tips: This document is carefully compiled by this editor. I hope that after you download it, it can help you solve practical problems. The document can be customized and modified after downloading, please adjust and use it according to actual needs, thank you! In addition, this shop provides you with various types of practical materials, such as educational essays, diary appreciation, sentence excerpts, ancient poems, classic articles, topic composition, work summary, word parsing, copy excerpts, other materials and so on, want to know different data formats and writing methods, please pay attention!烤鸭是一道源自中国的传统美食,在中国和世界各地都有着广泛的影响和受欢迎程度。

SCJP认证试题及答案

SCJP认证试题及答案

转载对题目和答案谨做参考Q1A method is ...1) an implementation of an abstraction.2) an attribute defining the property of a particular abstraction.3) a category of objects.4) an operation defining the behavior for a particular abstraction.5) a blueprint for making operations.Q2An object is ...1) what classes are instantiated from.2) an instance of a class.3) a blueprint for creating concrete realization of abstractions.4) a reference to an attribute.5) a variable.Q3Which line contains a constructor in this class definition?public class Counter { // (1)int current, step;public Counter(int startValue, int stepValue) { // (2)set(startValue);setStepValue(stepValue);}public int get() { return current; } // (3)public void set(int value) { current = value; } // (4)public void setStepValue(int stepValue) { step = stepValue; } // (5) }1) Code marked with (1) is a constructor2) Code marked with (2) is a constructor3) Code marked with (3) is a constructor4) Code marked with (4) is a constructor5) Code marked with (5) is a ConstructorQ4Given that Thing is a class, how many objects and reference variables are created by the following code?Thing item, stuff;item = new Thing();Thing entity = new Thing();1) One object is created2) Two objects are created3) Three objects are created4) One reference variable is created5) Two reference variables are created6) Three reference variables are created.Q5An instance member…1) is also called a static member2) is always a variable3) is never a method4) belongs to a single instance, not to the class as a whole5) always represents an operationQ6How do objects pass messages in Java?1) They pass messages by modifying each other's member variables2) They pass messages by modifying the static member variables of each other's classes3) They pass messages by calling each other's instance member methods4) They pass messages by calling static member methods of each other's classes.Q7Given the following code, which statements are true?class A {int value1;}class B extends A {int value2;}1) Class A extends class B.2) Class B is the superclass of class A.3) Class A inherits from class B.4) Class B is a subclass of class A.5) Objects of class A have a member variable named value2.Q8If this source code is contained in a file called SmallProg.java, what command should be used to compile it using the JDK?public class SmallProg {public static void main(String args[]) { System.out.println("Good luck!"); }}1) java SmallProg2) avac SmallProg3) java SmallProg.java4) javac SmallProg.java5) java SmallProg mainQ9Given the following class, which statements can be inserted at position 1 without causing the code to fail compilation?public class Q6db8 {int a;int b = 0;static int c;public void m() {int d;int e = 0;// Position 1}}1) a++;2) b++;3) c++;4) d++;5) e++;Q10Which statements are true concerning the effect of the >> and >>> operators?1) For non-negative values of the left operand, the >> and >>> operators will have the same effect.2) The result of (-1 >> 1) is 0.3) The result of (-1 >>> 1) is -1.4) The value returned by >>> will never be negative as long as the value of the right operand is equal to or greater than 1.5) When using the >> operator, the leftmost bit of the bit representation of the resulting value will always be the same bit value as the leftmost bit of the bit representation of the left operand.Q11What is wrong with the following code?class MyException extends Exception {}public class Qb4ab {public void foo() {try {bar();} finally {baz();} catch (MyException e) {}}public void bar() throws MyException {throw new MyException();}public void baz() throws RuntimeException {throw new RuntimeException();}}1) Since the method foo() does not catch the exception generated by the method baz(), it must declare the RuntimeException in its throws clause.2) A try block cannot be followed by both a catch and a finally block.3) An empty catch block is not allowed.4) A catch block cannot follow a finally block.5) A finally block must always follow one or more catch blocks.Q12What will be written to the standard output when the following program is run?public class Qd803 {public static void main(String args[]) {String word = "restructure";System.out.println(word.substring(2, 3));}}1) est2) es3) str4) st5) sQ13Given that a static method doIt() in a class Work represents work to be done, what block of code will succeed in starting a new thread that will do the work?CODE BLOCK A:Runnable r = new Runnable() { public void run() {Work.doIt();}};Thread t = new Thread(r);t.start();CODE BLOCK B:Thread t = new Thread() {public void start() {Work.doIt();}};t.start();CODE BLOCK C:Runnable r = new Runnable() { public void run() {Work.doIt();}};r.start();CODE BLOCK D:Thread t = new Thread(new Work()); t.start();CODE BLOCK E:Runnable t = new Runnable() { public void run() {Work.doIt();}};t.run();1) Code block A.2) Code block B.3) Code block C.4) Code block D.5) Code block E.Q14Write a line of code that declares a variable named layout of type LayoutManager and initializes it with a new object, which when used with a container can lay out components in a rectangular grid of equal-sized rectangles, 3 components wide and 2 components high.Q15public class Q275d {static int a;int b;public Q275d() {int c;c = a;a++;b += c;}public static void main(String args[]) {new Q275d();}}1) The code will fail to compile, since the constructor is trying to access static members.2) The code will fail to compile, since the constructor is trying to use static member variable a before it has been initialized.3) The code will fail to compile, since the constructor is trying to use member variable b before it has been initialized.4) The code will fail to compile, since the constructor is trying to use local variable c before it has been initialized.5) The code will compile and run without any problems.Q16What will be written to the standard output when the following program is run?public class Q63e3 {public static void main(String args[]) {System.out.println(9 ^ 2);}}1) 812) 73) 114) 05) falseQ17Which statements are true concerning the default layout manager for containers in the java.awt package?1) Objects instantiated from Panel do not have a default layout manager.2) Objects instantiated from Panel have FlowLayout as default layout manager.3) Objects instantiated from Applet have BorderLayout as default layout manager.4) Objects instantiated from Dialog have BorderLayout as default layout manager.5) Objects instantiated from Window have the same default layout manager as instances of Applet.Q18Which declarations will allow a class to be started as a standalone program?1) public void main(String args[])2) public void static main(String args[])3) public static main(String[] argv)4) final public static void main(String [] array)5) public static void main(String args[])Q19Under which circumstances will a thread stop?1) The method waitforId() in class MediaTracker is called.2) The run() method that the thread is executing ends.3) The call to the start() method of the Thread object returns.4) The suspend() method is called on the Thread object.5) The wait() method is called on the Thread object.Q20When creating a class that associates a set of keys with a set of values, which of these interfaces is most applicable?1) Collection2) Set3) SortedSet4) MapQ21What does the value returned by the method getID() found in class java.awt.AWTEvent uniquely identify?1) The particular event instance.2) The source of the event.3) The set of events that were triggered by the same action.4) The type of event.5) The type of component from which the event originated.Q22What will be written to the standard output when the following program is run?class Base {int i;Base() {add(1);}void add(int v) {i += v;}void print() {System.out.println(i);}}class Extension extends Base {Extension() {add(2);}void add(int v) {i += v*2;}}public class Qd073 {public static void main(String args[]) {bogo(new Extension());}static void bogo(Base b) {b.add(8);b.print();}}1) 92) 183) 204) 215) 22Q23Which lines of code are valid declarations of a native method when occurring within the declaration of the following class?public class Qf575 {// insert declaration of a native method here}1) native public void setTemperature(int kelvin);2) private native void setTemperature(int kelvin);3) protected int native getTemperature();4) public abstract native void setTemperature(int kelvin);5) native int setTemperature(int kelvin) {}Q24How does the weighty property of the GridBagConstraints objects used in grid bag layout affect the layout of the components?1) It affects which grid cell the components end up in.2) It affects how the extra vertical space is distributed.3) It affects the alignment of each component.4) It affects whether the components completely fill their allotted display area vertically.Q25Which statements can be inserted at the indicated position in the following code to make the program write 1 on the standard output when run?public class Q4a39 {int a = 1;int b = 1;int c = 1;class Inner {int a = 2;int get() {int c = 3;// insert statement herereturn c;}}Q4a39() {Inner i = new Inner();System.out.println(i.get());}public static void main(String args[]) {new Q4a39();}}1) c = b;2) c = this.a;3) c = this.b;4) c = Q4a39.this.a;5) c = c;Q26Which is the earliest line in the following code after which the object created on the line marked (0) will be a candidate for being garbage collected, assuming no compiler optimizations are done?public class Q76a9 {static String f() {String a = "hello";String b = "bye"; // (0)String c = b + "!"; // (1)String d = b;b = a; // (2)d = a; // (3)return c; // (4)}public static void main(String args[]) {String msg = f();System.out.println(msg); // (5)}}1) The line marked (1).2) The line marked (2).3) The line marked (3).4) The line marked (4).5) The line marked (5).Q27Which methods from the String and StringBuffer classes modify the object on which they are called?1) The charAt() method of the String class.2) The toUpperCase() method of the String class.3) The replace() method of the String class.4) The reverse() method of the StringBuffer class.5) The length() method of the StringBuffer class.Q28Which statements, when inserted at the indicated position in the following code, will cause a runtime exception when attempting to run the program?class A {}class B extends A {}class C extends A {}public class Q3ae4 {public static void main(String args[]) {A x = new A();B y = new B();C z = new C();// insert statement here}}1) x = y;2) z = x;3) y = (B) x;4) z = (C) y;5) y = (A) y;Q29Which of these are keywords in Java?1) default2) NULL3) String4) throws5) longQ30It is desirable that a certain method within a certain class can only be accessed by classes that are defined within the same package as the class of the method. How can such restrictions be enforced?1) Mark the method with the keyword public.2) Mark the method with the keyword protected.3) Mark the method with the keyword private.4) Mark the method with the keyword package.5) Do not mark the method with any accessibility modifiers.Q31Which code fragments will succeed in initializing a two-dimensional array named tab with a size that will cause the expression tab[3][2] to access a valid element?CODE FRAGMENT A:int[][] tab = {{ 0, 0, 0 },{ 0, 0, 0 }};CODE FRAGMENT B:int tab[][] = new int[4][];for (int i=0; iCODE FRAGMENT C:int tab[][] = {0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0,0, 0, 0, 0};CODE FRAGMENT D:int tab[3][2];CODE FRAGMENT E:int[] tab[] = { {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0} };1) Code fragment A.2) Code fragment B.3) Code fragment C.4) Code fragment D.5) Code fragment E.Q32What will be the result of attempting to run the following program?public class Qaa75 {public static void main(String args[]) {String[][][] arr = {{ {}, null },{ { "1", "2" }, { "1", null, "3" } },{},{ { "1", null } }};System.out.println(arr.length + arr[1][2].length);}}1) The program will terminate with an ArrayIndexOutOfBoundsException.2) The program will terminate with a NullPointerException.3) 4 will be written to standard output.4) 6 will be written to standard output.5) 7 will be written to standard output.Q33Which expressions will evaluate to true if preceded by the following code? String a = "hello";String b = new String(a);String c = a;char[] d = { 'h', 'e', 'l', 'l', 'o' };1) (a == "Hello")2) (a == b)3) (a == c)4) a.equals(b)5) a.equals(d)Q34Which statements concerning the following code are true?class A {public A() {}public A(int i) { this(); }}class B extends A {public boolean B(String msg) { return false; }}class C extends B {private C() { super(); }public C(String msg) { this(); }public C(int i) {}}1) The code will fail to compile.2) The constructor in A that takes an int as an argument will never be called as a result of constructing an object of class B or C.3) Class C has three constructors.4) Objects of class B cannot be constructed.5) At most one of the constructors of each class is called as a result of constructing an object of class C.Q35Given two collection objects referenced by col1 and col2, which of these statements are true?1) The operation col1.retainAll(col2) will not modify the col1 object.2) The operation col1.removeAll(col2) will not modify the col2 object.3) The operation col1.addAll(col2) will return a new collection object,containing elements from both col1 and col2.4) The operation col1.containsAll(Col2) will not modify the col1 object.Q36Which statements concerning the relationships between the following classes are true?class Foo {int num;Baz comp = new Baz();}class Bar {boolean flag;}class Baz extends Foo {Bar thing = new Bar();double limit;}1) A Bar is a Baz.2) A Foo has a Bar.3) A Baz is a Foo.4) A Foo is a Baz.5) A Baz has a Bar.Q37Which statements concerning the value of a member variable are true, when no explicit assignments have been made?1) The value of an int is undetermined.2) The value of all numeric types is zero.3) The compiler may issue an error if the variable is used before it is initialized.4) The value of a String variable is "" (empty string).5) The value of all object variables is null.Q38Which statements describe guaranteed behavior of the garbage collection and finalization mechanisms?1) Objects are deleted when they can no longer be accessed through any reference.2) The finalize() method will eventually be called on every object.3) The finalize() method will never be called more than once on an object.4) An object will not be garbage collected as long as it is possible for an active part of the program to access it through a reference.5) The garbage collector will use a mark and sweep algorithm.Q39Which code fragments will succeed in printing the last argument given on the command line to the standard output, and exit gracefully with no output if no arguments are given?CODE FRAGMENT A:public static void main(String args[]) {if (args.length != 0)System.out.println(args[args.length-1]);}CODE FRAGMENT B:public static void main(String args[]) {try { System.out.println(args[args.length]); }catch (ArrayIndexOutOfBoundsException e) {}}CODE FRAGMENT C:public static void main(String args[]) {int ix = args.length;String last = args[ix];if (ix != 0) System.out.println(last);}CODE FRAGMENT D:public static void main(String args[]) {int ix = args.length-1;if (ix > 0) System.out.println(args[ix]);}CODE FRAGMENT E:public static void main(String args[]) {try { System.out.println(args[args.length-1]); }catch (NullPointerException e) {}}1) Code fragment A.2) Code fragment B.3) Code fragment C.4) Code fragment D.5) Code fragment E.Q40Which of these statements concerning the collection interfaces are true?1) Set extends Collection.2) All methods defined in Set are also defined in Collection.3) List extends Collection.4) All methods defined in List are also defined in Collection.5) Map extends Collection.Q41What is the name of the method that threads can use to pause their execution until signalled to continue by another thread?Fill in the name of the method (do not include a parameter list).Q42Given the following class definitions, which expression identifies whether the object referred to by obj was created by instantiating class B rather than classes A, C and D?class A {}class B extends A {}class C extends B {}class D extends A {}1) obj instanceof B2) obj instanceof A && ! (obj instanceof C)3) obj instanceof B && ! (obj instanceof C)4) obj instanceof C || obj instanceof D5) (obj instanceof A) && ! (obj instanceof C) && ! (obj instanceof D)Q43What will be written to the standard output when the following program is run?public class Q8499 {public static void main(String args[]) {double d = -2.9;int i = (int) d;i *= (int) Math.ceil(d);i *= (int) Math.abs(d);System.out.println(i);}}1) 122) 183) 84) 125) 27Q44What will be written to the standard output when the following program is run?public class Qcb90 {int a;int b;public void f() {a = 0;b = 0;int[] c = { 0 };g(b, c);System.out.println(a + " " + b + " " + c[0] + " ");}public void g(int b, int[] c) {a = 1;b = 1;c[0] = 1;}public static void main(String args[]) {Qcb90 obj = new Qcb90();obj.f();}}1) 0 0 02) 0 0 13) 0 1 04) 1 0 05) 1 0 1Q45Which statements concerning the effect of the statement gfx.drawRect(5, 5, 10, 10) are true, given that gfx is a reference to a valid Graphics object?1) The rectangle drawn will have a total width of 5 pixels.2) The rectangle drawn will have a total height of 6 pixels.3) The rectangle drawn will have a total width of 10 pixels.4) The rectangle drawn will have a total height of 11 pixels.Q46Given the following code, which code fragments, when inserted at the indicated location, will succeed in making the program display a button spanning the whole window area?import java.awt.*;public class Q1e65 {public static void main(String args[]) {Window win = new Frame();Button but = new Button("button");// insert code fragment herewin.setSize(200, 200);win.setVisible(true);}}1) win.setLayout(new BorderLayout()); win.add(but);2) win.setLayout(new GridLayout(1, 1)); win.add(but);3) win.setLayout(new BorderLayout()); win.add(but, BorderLayout.CENTER);4) win.add(but);5) win.setLayout(new FlowLayout()); win.add(but);Q47Which method implementations will write the given string to a file named "file", using UTF8 encoding?IMPLEMENTATION A:public void write(String msg) throws IOException {FileWriter fw = new FileWriter(new File("file"));fw.write(msg);fw.close();}IMPLEMENTATION B:public void write(String msg) throws IOException {OutputStreamWriter osw =new OutputStreamWriter(new FileOutputStream("file"), "UTF8");osw.write(msg);osw.close();}IMPLEMENTATION C:public void write(String msg) throws IOException { FileWriter fw = new FileWriter(new File("file"));fw.setEncoding("UTF8");fw.write(msg);fw.close();}IMPLEMENTATION D:public void write(String msg) throws IOException { FilterWriter fw = FilterWriter(new FileWriter("file"), "UTF8"); fw.write(msg);fw.close();}IMPLEMENTATION E:public void write(String msg) throws IOException { OutputStreamWriter osw = new OutputStreamWriter(new OutputStream(new File("file")), "UTF8");osw.write(msg);osw.close();}1) Implementation A.2) Implementation B.3) Implementation C.4) Implementation D.5) Implementation E.Q48Which are valid identifiers?1) _class2) $value$3) zer@4) ¥ngstr5) 2muchuqQ49What will be the result of attempting to compile and run the following program?public class Q28fd {public static void main(String args[]) {int counter = 0;l1:for (int i=10; i<0; i--) {l2:int j = 0;while (j < 10) {if (j > i) break l2;if (i == j) {counter++;continue l1;}}counter--;}System.out.println(counter);}}1) The program will fail to compile.2) The program will not terminate normally.3) The program will write 10 to the standard output.4) The program will write 0 to the standard output.5) The program will write 9 to the standard output.Q50Given the following interface definition, which definitions are valid?interface I {void setValue(int val);int getValue();}DEFINITION A:(a) class A extends I {int value;void setValue(int val) { value = val; }int getValue() { return value; }}DEFINITION B:(b) interface B extends I {void increment();}DEFINITION C:(c) abstract class C implements I {int getValue() { return 0; }abstract void increment();}DEFINITION D:(d) interface D implements I {void increment();}DEFINITION E:(e) class E implements I {int value;public void setValue(int val) { value = val; } }1) Definition A.2) Definition B.3) Definition C.4) Definition D.5) Definition E.Q51Which statements concerning the methods notify() and notifyAll() are true?1) Instances of class Thread have a method called notify().2) A call to the method notify() will wake the thread that currently owns the monitor of the object.3) The method notify() is synchronized.4) The method notifyAll() is defined in class Thread.5) When there is more than one thread waiting to obtain the monitor of an object, there is no way to be sure which thread will be notified by the notify() method.Q52Which statements concerning the correlation between the inner and outer instances of non-static inner classes are true?1) Member variables of the outer instance are always accessible to inner instances, regardless of their accessibility modifiers.2) Member variables of the outer instance can never be referred to using only the variable name within the inner instance.3) More than one inner instance can be associated with the same outer instance.4) All variables from the outer instance that should be accessible in the inner instance must be declared final.5) A class that is declared final cannot have any inner classes.Q53What will be the result of attempting to compile and run the following code?public class Q6b0c {public static void main(String args[]) {int i = 4;float f = 4.3;double d = 1.8;int c = 0;if (i == f) c++;if (((int) (f + d)) == ((int) f + (int) d)) c += 2;System.out.println(c);}}1) The code will fail to compile.2) 0 will be written to the standard output.3) 1 will be written to the standard output.4) 2 will be written to the standard output.5) 3 will be written to the standard output.Q54Which operators will always evaluate all the operands?1) ||2) +3) &&4) ? :5) %Q55Which statements concerning the switch construct are true?1) All switch statements must have a default label.2) There must be exactly one label for each code segment in a switch statement.3) The keyword continue can never occur within the body of a switch statement.4) No case label may follow a default label within a single switch statement.5) A character literal can be used as a value for a case label.Q56Which modifiers and return types would be valid in the declaration of a working main() method for a Java standalone application?1) private2) final3) static4) int5) abstractQ57What will be the appearance of an applet with the following init() method?public void init() {add(new Button("hello"));}1) Nothing appears in the applet.2) A button will cover the whole area of the applet.3) A button will appear in the top left corner of the applet.4) A button will appear, centered in the top region of the applet.5) A button will appear in the center of the applet.Q58Which statements concerning the event model of the AWT are true?1) At most one listener of each type can be registered with a component.2) Mouse motion listeners can be registered on a List instance.3) There exists a class named ContainerEvent in package java.awt.event.4) There exists a class named MouseMotionEvent in package java.awt.event.5) There exists a class named ActionAdapter in package java.awt.event.Q59Which statements are true, given the code new FileOutputStream("data", true) for creating an object of class FileOutputStream?1) FileOutputStream has no constructors matching the given arguments.2) An IOExeception will be thrown if a file named "data" already exists.3) An IOExeception will be thrown if a file named "data" does not already exist.4) If a file named "data" exists, its contents will be reset and overwritten.5) If a file named "data" exists, output will be appended to its current contents.Q60Given the following code, write a line of code that, when inserted at the indicated location, will make theoverriding method in Extension invoke the overridden method in class Base on the current object.class Base {public void print() {System.out.println("base");}}class Extention extends Base {public void print() {System.out.println("extension");// insert line of implementation here}}public class Q294d {public static void main(String args[]) {Extention ext = new Extention();ext.print();}}Fill in a single line of implementation.Q61Given that file is a reference to a File object that represents a directory, which code fragments will succeed in obtaining a list of the entries in the directory?1) Vector filelist = ((Directory) file).getList();2) String[] filelist = file.directory();3) Enumeration filelist = file.contents();4) String[] filelist = file.list();5) Vector filelist = (new Directory(file)).files();Q62What will be written to the standard output when the following program is run?。

CFA考试(Level Ⅰ)辅导系列-Mock Exam 3【圣才出品】

CFA考试(Level Ⅰ)辅导系列-Mock Exam 3【圣才出品】

Mock Exam 3Morning Session1.Kenneth, CFA, is a portfolio manager at A&B limited, if he suspects a colleague at his company of engaging in ongoing illegal activities, as according to the AIMR Standards of Professional Conduct, he is required to take all of the following actions EXCEPT:A.determine whether the conduct is, in fact, illegal.B.disassociate himself from any illegal activity.C.report the illegal violations to the appropriate governmental or regulatory organizations.【答案】C【解析】Standard I(B) Fundamental Responsibilities. Prohibition against participating or assisting in illegal and ethical violations. If Roberts suspects someone is planning or engaging in illegal activities, he should: (1) determine the legality of the activities, (2) disassociate himself from the illegal or unethical activity, and (3) urge his firm to attempt to persuade the perpetrator to stop. The AIMR Standards of Professional Conduct do not require that Roberts report such activities to the authorities, but the law might.2.Susan’s company is participating in an investment analysis project. Hermanager gave her a report from another company’s analyst, also working on the project, and told her to put it on company letterhead and distribute the report by the end of the day.Being an AIMR member, which of the following AIMR Standards of Professional Conduct will she probably have broken if Susan complies with her manager instruction?A.Ⅳ(A) Research Reports.B.Ⅳ(B) Portfolio Investment Recommendations and Actions.C.Ⅱ(C) Prohibition against Plagiarism.【答案】C【解析】Standard Ⅱ(C)Prohibition against Plagiarism. All sources used in an analyst’s report should be referenced as to the source, author and publisher. The only exception being factual information published by recognized financial and statistical reporting services,3.Before disseminating changes in his firm’s buy/sell list. Johnson, a CFA candidate, calls his best clients to apprise them of the pending change. Based on the AIMR Standards of Professional Conduct, what standard, if any, did Johnson violate?A.Standard Ⅲ(B), Fair Dealing.B.Standard Ⅳ(B), Priority of Transactions.C.Standard Ⅱ(A), Prohibition Against Use of Material Nonpublic Information.【答案】A【解析】Standard Ⅲ(B)Fair Dealing. Johnson violated the standard on fair dealing because he did not deal fairly and objectively with all clients and prospects when disseminating investment recommendations. Instead, he showed favoritism to his best clients. In disseminating investment recommendations, Johnson should consider making the information available to clients based on their interest and suitability. A change of recommendation from buy to sell or sell to buy is generally material.4.According to the AIMR Standards of Professional Conduct, which of the following about Standard Ⅲ(E), Preservation of Confidentiality, is TRUE? A.If a member receives information due to his or her special relationship with the client indicating illegal behavior on the part of the client, the member may not have an obligation to inform the appropriate authorities. B.Confidentiality clauses in settlement agreements protect members from divulging information during investigations.C.Employees who are also working for the client should keep the information of the clients confidential.【答案】C【解析】Standard Ⅲ(E)Preservation of Confidentiality. Choice B is false because this standard prohibits members from executing settlement agreements that prevent members from providing information in an investigation by AIMR’s Professional Conduct Program (PCP). Choice A is false because if a memberreceives information due to his or her special relationship with the client indicating illegal behavior on the past of the client, the member may not have an obligation to inform the appropriate authorities.5.Based on the AIMR Standards of Professional Conduct, which of the following statements is least likely to be a violation of Standard Ⅲ(D), Prohibition against Misrepresentation?A.An analyst tells a prospective client that investment grade bonds involve less default risk than junk bonds.B.A bond trader tells a client that he can assist the client in all the client’s investment needs: equity, fixed income, and derivatives.C.An investment manager recommends to a prospective client an investment in mortgage IO strips because they are guaranteed by an agency of the federal government.【答案】A【解析】Standard Ⅲ(D)Prohibition against Misrepresentation. Members are not permitted to make any assurances or guarantees about any investment, except to communicate accurate information. The statement that investment grade bonds have less default risk than junk bonds is an accurate statement.6.Ian O ’sullivan, CFA, is the owner and sole employee of two companies, a public relations firm and a financial research firm. The public relations firmentered into a contract with Mallory Enterprises to provide public relations services. According to the contract, O’Sullivan received 40000 shares of Mallory stock in payment for his services. Over the next 10 days, the public relations firm issued several press releases that discussed Mallory’s excellent growth prospects. O’Sullivan, through his financial research firm, also published a research report recommending Mallory stock as a buy? According to theStandards of Practice Handbook, was O’Sullivan required to disclose his ownership of Mallory stock in the:【答案】C【解析】Members should disclose all matters that reasonably could be expected to impair the member’s objectivity.7.During an onsite company visit, Yu Ding, CFA, accidentally overheard the Chief Executive office(CEO) of AMP, Inc., discussing the company’s pending tender office to purchase Dynamica Enterprises, a retailer of stargazer products, According to the Standards of practice Handbook, Yu Ding may not use the Information to take investment action because:A .the information relates to a tender offer.B.acting on the information would breach a duty to bother the CEO and AMP. C.she does not have a reasonable and adequate basis for taking investment action.【答案】A【解析】Trading on the information is restricted as it relates to a tender offer; it is clearly material,nonpublic information.8.Several years ago, Simon Ma, CFA, founded an investment club with three friends. The investment club’s account grew rapidly to a substantial size, but the club has not actively traded the account for at least a year and does not plan to resume active trading of the account. Simon’s employer requires an annual disclosure of employee stock ownership. Simon discloses all of his personal trading accounts., but does not disclose his holdings in the investment club. Has Simon most likely violated any CFA Institute Standards of Professional Conduct?A.NoB.Yes, with respect to fiduciary duty.C.Yes, with respect to confilicts of interest.【答案】C【解析】Members should disclose all beneficial ownership that could reasonably cause a conflict of interest. Additionally, because Simon’s employer requires the disclosure, a failure to provide full information would。

SCJP模拟题 AND Answer [6]

SCJP模拟题 AND Answer [6]

Java Certification Mock ExamQ. 1Which colour is used to indicate instance methods in the standard "javadoc" format documentation:A. blueB. redC. purpleD. orangeSelect the most appropriate answer.Q. 2What is the correct ordering for the import, class and package declarations when found in a single file?A. package, import, classB. class, import, packageC. import, package, classD. package, class, importSelect the most appropriate answer.Q. 3Which methods can be legally applied to a string object?A. equals(String)B. equals(Object)C. trim()D. round()E. toString()Select all correct answers.Q. 4What is the parameter specification for the public static void main method?A. String args []B. String [] argsC. Strings args []D. String argsSelect all correct answers.Q. 5What does the zeroth element of the string array passed to the public static void main method contain?A. The name of the programB. The number of argumentsC. The first argument if one is presentSelect the most appropriate answer.Q. 6Which of the following are Java keywords?A. gotoB. mallocC. extendsD. FALSESelect all correct answersQ. 7What will be the result of compiling the following code:public class Test {public static void main (String args []) {int age;age = age + 1;System.out.println("The age is " + age);}}A. Compiles and runs with no outputB. Compiles and runs printing out The age is 1C. Compiles but generates a runtime errorD. Does not compileE. Compiles but generates a compile time errorSelect the most appropriate answer.Q. 8Which of these is the correct format to use to create the literal char value a?A. ‘a’B. "a"C. new Character(a)D. \000aSelect the most appropriate answer.Q. 9What is the legal range of a byte integral type?A. 0 - 65, 535B. (–128) – 127C. (–32,768) – 32,767D. (–256) – 255Select the most appropriate answer.Q. 10Which of the following is illegal:A. int i = 32;B. float f = 45.0;C. double d = 45.0;Select the most appropriate answer.Q. 11What will be the result of compiling the following code:public class Test {static int age;public static void main (String args []) {age = age + 1;System.out.println("The age is " + age);}}A. Compiles and runs with no outputB. Compiles and runs printing out The age is 1C. Compiles but generates a runtime errorD. Does not compileE. Compiles but generates a compile time errorSelect the most appropriate answer.Q. 12Which of the following are correct?A. 128 >> 1 gives 64B. 128 >>> 1 gives 64C. 128 >> 1 gives –64D. 128 >>> 1 gives –64Select all correct answersQ. 13Which of the following return true?A. "john" == "john"B. "john".equals("john")C. "john" = "john"D. "john".equals(new Button("john"))Select all correct answers.Q. 14Which of the following do not lead to a runtime error?A. "john" + " was " + " here"B. "john" + 3C. 3 + 5D. 5 + 5.5Select all correct answers.Q. 15Which of the following are so called "short circuit" logical operators?A. &B. ||C. &&D. |Select all correct answers.Q. 16Which of the following are acceptable?A. Object o = new Button("A");B. Boolean flag = true;C. Panel p = new Frame();D. Frame f = new Panel();E. Panel p = new Applet();Select all correct answers.Q. 17What is the result of compiling and running the following code:public class Test {static int total = 10;public static void main (String args []) {new Test();}public Test () {System.out.println("In test");System.out.println(this);int temp = this.total;if (temp > 5) {System.out.println(temp);}}}A. The class will not compileB. The compiler reports and error at line 2C. The compiler reports an error at line 9D. The value 10 is one of the elements printed to the standard outputE. The class compiles but generates a runtime errorSelect all correct answers.Q 18Which of the following is correct:A. String temp [] = new String {"j" "a" "z"};B. String temp [] = { "j " " b" "c"};C. String temp = {"a", "b", "c"};D. String temp [] = {"a", "b", "c"};Select the most appropriate answer.Q. 19What is the correct declaration of an abstract method that is intended to be public:A. public abstract void add();B. public abstract void add() {}C. public abstract add();D. public virtual add();Select the most appropriate answer.Q. 20Under what situations do you obtain a default constructor?A. When you define any classB. When the class has no other constructorsC. When you define at least one constructorSelect the most appropriate answer.Q. 21Given the following code:public class Test {…}Which of the following can be used to define a constructor for this class:A. public void Tes t() {…}B. public Test() {…}C. public static Test() {…}D. public static void Test() {…}Select the most appropriate answer.Q. 22Which of the following are acceptable to the Java compiler:A. if (2 == 3) System.out.println("Hi");B. if (2 = 3) System.out.println("Hi");C. if (true) System.out.println("Hi");D. if (2 != 3) System.out.println("Hi");E. if (aString.equals("hello")) System.out.println("Hi");Select all correct answers.Q. 23Assuming a method contains code which may raise an Exception (but not a RuntimeException), what is the correct way for a method to indicate that it expects the caller to handle that exception:A. throw ExceptionB. throws ExceptionC. new ExceptionD. Don't need to specify anythingSelect the most appropriate answer.Q. 24What is the result of executing the following code, using the parameters 4 and 0:public void divide(int a, int b) {try {int c = a / b;} catch (Exception e) {System.out.print("Exception ");} finally {System.out.println("Finally");}A. Prints out: Exception FinallyB. Prints out: FinallyC. Prints out: ExceptionD. No outputSelect the most appropriate answer.Q.25Which of the following is a legal return type of a method overloading the following method:public void add(int a) {…}A. voidB. intC. Can be anythingSelect the most appropriate answer.Q.26Which of the following statements is correct for a method which is overriding the following method:public void add(int a) {…}A. the overriding method must return voidB. the overriding method must return intC. the overriding method can return whatever it likesSelect the most appropriate answer.Q. 27Given the following classes defined in separate files:class Vehicle {public void drive() {System.out.println("Vehicle: drive");}}class Car extends Vehicle {public void drive() {System.out.println("Car: drive");}}public class Test {public static void main (String args []) {Vehicle v;Car c;v = new Vehicle();c = new Car();v.drive();c.drive();v = c;v.drive();}}What will be the effect of compiling and running this class Test?A. Generates a Compiler error on the statement v= c;B. Generates runtime error on the statement v= c;C. Prints out:Vehicle: driveCar: driveCar: driveD. Prints out:Vehicle: driveCar: driveVehicle: driveSelect the most appropriate answer.Q. 28Where in a constructor, can you place a call to a constructor defined in the super class?A. AnywhereB. The first statement in the constructorC. The last statement in the constructorD. You can't call super in a constructorSelect the most appropriate answer.Q. 29Which variables can an inner class access from the class which encapsulates it?A. All static variablesB. All final variablesC. All instance variablesD. Only final instance variablesE. Only final static variablesSelect all correct answers.Q. 30What class must an inner class extend:A. The top level classB. The Object classC. Any class or interfaceD. It must extend an interfaceSelect the most appropriate answer.Q. 31In the following code, which is the earliest statement, where the object originally held in e, may be garbage collected:1. public class Test {2. public static void main (String args []) {3. Employee e = new Employee("Bob", 48);4. e.calculatePay();5. System.out.println(e.printDetails());6. e = null;7. e = new Employee("Denise", 36);8. e.calculatePay();9. System.out.println(e.printDetails());10. }11. }A. Line 10B. Line 11C. Line 7D. Line 8E. NeverSelect the most appropriate answer.Q. 32What is the name of the interface that can be used to define a class that can execute within its own thread?A. RunnableB. RunC. ThreadableD. ThreadE. ExecutableSelect the most appropriate answer.Q. 33What is the name of the method used to schedule a thread for execution?A. init();B. start();C. run();D. resume();E. sleep();Select the most appropriate answer.Q. 34Which methods may cause a thread to stop executing?A. sleep();B. stop();C. yield();D. wait();E. notify();F. notifyAll()G. synchronized()Select all correct answers.Q. 35Write code to create a text field able to display 10 characters (assuming a fixed size font) displaying the initial string "hello"::Q. 36Which of the following methods are defined on the Graphics class:A. drawLine(int, int, int, int)B. drawImage(Image, int, int, ImageObserver)C. drawString(String, int, int)D. add(Component);E. setVisible(boolean);F. setLayout(Object);Select all correct answers.Q. 37Which of the following layout managers honours the preferred size of a component:A. CardLayoutB. FlowLayoutC. BorderLayoutD. GridLayoutSelect all correct answers.Q. 38Given the following code what is the effect of a being 5:public class Test {public void add(int a) {loop: for (int i = 1; i < 3; i++){for (int j = 1; j < 3; j++) {if (a == 5) {break loop;}System.out.println(i * j);}}}}A. Generate a runtime errorB. Throw an ArrayIndexOutOfBoundsExceptionC. Print the values: 1, 2, 2, 4D. Produces no outputSelect the most appropriate answer.Q. 39What is the effect of issuing a wait() method on an objectA. If a notify() method has already been sent to that object then it has no effectB. The object issuing the call to wait() will halt until another object sends a notify() or notifyAll() methodC. An exception will be raisedD. The object issuing the call to wait() will be automatically synchronized with any other objects using the receiving object.Select the most appropriate answer.Q. 40The layout of a container can be altered using which of the following methods:A. setLayout(aLayoutManager);B. addLayout(aLayoutManager);C. layout(aLayoutManager);D. setLayoutManager(aLayoutManager);Select all correct answers.Q. 41Using a FlowLayout manager, which is the correct way to add elements to a container:A. add(component);B. add("Center", component);C. add(x, y, component);D. set(component);Select the most appropriate answer.Q. 42Given that a Button can generate an ActionEvent which listener would you expect to have to implement, in a class which would handle this event?A. FocusListenerB. ComponentListenerC. WindowListenerD. ActionListenerE. ItemListenerSelect the most appropriate answer.Q. 43Which of the following, are valid return types, for listener methods:A. booleanB. the type of event handledC. voidD. ComponentSelect the most appropriate answer.Q. 44Assuming we have a class which implements the ActionListener interface, which method should be used to register this with a Button?A. addListener(*);B. addActionListener(*);C. addButtonListener(*);D. setListener(*);Select the most appropriate answer.Q. 45In order to cause the paint(Graphics) method to execute, which of the following is the mostappropriate method to call:A. paint()B. repaint()C. paint(Graphics)D. update(Graphics)E. None – you should never cause paint(Graphics) to executeSelect the most appropriate answer.Q. 46Which of the following illustrates the correct way to pass a parameter into an applet: A. tags?A. line 1, 2, 3B. line 2, 5, 6, 7C. line 3, 4, 5D. line 8, 9, 10E. line 8, 9Select all correct answers.Q. 59Which of the following is a legal way to construct a RandomAccessFile:A. RandomAccessFile("data", "r");B. RandomAccessFile("r", "data");C. RandomAccessFile("data", "read");D. RandomAccessFile("read", "data");Select the most appropriate answer.Q. 60Carefully examine the following code:public class StaticTest {static {System.out.println("Hi there");}public void print() {System.out.println("Hello");}public static void main(String args []) {StaticTest st1 = new StaticTest();st1.print();StaticTest st2 = new StaticTest();st2.print();}}When will the string "Hi there" be printed?A. Never.B. Each time a new instance is created.C. Once when the class is first loaded into the Java virtual machine.D. Only when the static method is called explicitly.Select the most appropriate answer.Q. 61Consider the following program:public class Test { public static void main (String args []) { boolean a = false; if (a = true)System.out.println("Hello");ElseSystem.out.println("Goodbye");}}What is the result:A. Program produces no output but terminates correctly.B. Program does not terminate.C. Prints out "Hello"D. Prints out "Goodbye"Select the most appropriate answer.Q. 62Examine the following code which includes an inner class:public final class Test4 implements A {class Inner {void test() {if (Test4.this.flag); {sample();}}}private boolean flag = false;public void sample() {System.out.println("Sample");}public Test4() {(new Inner()).test();}public static void main(String args []) {new Test4();}}What is the result:A. Prints out "Sample"B. Program produces no output but terminates correctly.C. Program does not terminate.D. The program will not compileSelect the most appropriate answer.Q. 63Carefully examine the following class:public class Test5 { public static void main (String args []) { /* This is the start of a commentif (true) {Test5 = new test5();System.out.println("Done the test");}/* This is another comment */System.out.println ("The end");}}What is the result:A. Prints out "Done the test" and nothing else.B. Program produces no output but terminates correctly.C. Program does not terminate.D. The program will not compile.E. The program generates a runtime exception.F. The program prints out "The end" and nothing else.G. The program prints out "Done the test" and "The end" Select the most appropriate answer.Q. 64The following code defines a simple applet:import java.applet.Applet;import java.awt.*;public class Sample extends Applet {private String text = "Hello World";public void init() {add(new Label(text));}public Sample (String string) {text = string;}}It is accessed form the following HTML page:What is the result of compiling and running this applet:A. Prints "Hello World".B. Generates a runtime error.C. Does nothing.D. Generates a compile time error.Select the most appropriate answer.Q. 65Examine the following code:public class Calc {public static void main (String args []) {int total = 0;for (int i = 0, j = 10; total > 30; ++i, --j) {System.out.println(" i = " + i + " : j = " + j);total += (i + j);}System.out.println("Total " + total);}}Does this code:A. Produce a runtime errorB. Produce a compile time errorC. Print out "Total 0"D. Generate the following as output:i = 0 : j = 10i = 1 : j = 9i = 2 : j = 8Total 30Please select the most appropriate answer.Answers to Java Certification Mock Exam1. B2. A3. A, B, C, E4. A, B5. C6. A, C7. D8. A9. B 10. B11. B 12. A,B 13. A, B 14. A, B, C, D 15.B, C16. A, E 17. D 18. D 19. A 20. B21. B 22. A, C, D, E 23. B 24. A 25. C26. A 27. C 28. B 29. A, B, C 30. C31. C 32. A 33. B 34. A, B, C, D 35. new TextField("hello", 10) 36. A, B, C 37. B 38. D 39. B 40. A41. A 42. D 43. C 44. B 45. B46. B 47. A, E 48. B 49. C 50. C51. F 52. A 53. F 54. C 55. D56. D, F 57. F 58. A, E 59. A 60. C61. C 62. A 63. F 64. B 65. C。

公共英语3级考试真题

公共英语3级考试真题

Public English Test Level 3 (PET-3) Original Practice QuestionsChoice Questions:What is the main function of the public library?A. To provide free Wi-FiB. To house government documentsC. To offer reading materials to the publicD. To organize cultural events onlyIn a business letter, which part is usually used to express gratitude?A. The opening paragraphB. The body paragraphC. The closing paragraphD. The signatureWhich of the following is NOT a type of non-verbal communication?A. GesturesB. Eye contactC. Tone of voiceD. Written wordsThe word "meticulous" means:A. carelessB. thoroughC. lazyD. quickWhen planning a trip, which is the most important factor to consider?A. The destination's weatherB. The cost of the tripC. Personal interests and preferencesD. The length of the tripFill-in-the-Blank Questions:__________ is an essential skill for effective communication in both personal and professional settings.The __________ of a book is the cover or outer part that protects the pages.In a formal meeting, it is important to maintain a __________ and respectful tone.The __________ of a language refers to the study of its structure, grammar, and vocabulary.To __________ is to keep oneself informed by reading news and current events. Short-Answer Questions:Describe the importance of reading comprehension in academic success. Explain the role of technology in modern-day communication.Discuss the benefits of regular exercise for physical and mental health. Outline the steps involved in planning a successful business presentation. Explain the difference between a novel and a short story.。

SCJP Exam Module3

SCJP Exam Module3

Module 3-面向对象编程1. Coupling 是指一个类使用另一个类的成员的程度。

2. Loose Coupling 是理想状态,有较好的封装,互相引用最小化,限制 API 使用的范围3. Cohesion 是指一个类被设计成单一功能或责任的程度。

4. Overriding 和 Overloading:a)第一要注意的是 private 的方法是隐藏的,它不会被继承。

题目中如果父类中该方法为 private,不构成override。

b)Override 的时候对封装类不适用。

c)要注意,override 的时候,父类声明抛出的异常子类可以不声明,或者声明更比父类更宽泛的异常类,或者多抛出一些 unchecked 异常。

下面两个例子:i. class Super {public int m1() throws Exception{}}class Sub extends Super{public int m1(){}}//正确!ii. class Super {public int m1()}class Sub extends Super{public int m1() throws Exception{}}//编译错误!!!iii. class Super {public int m1() throws FileNotFoundException{}}class Sub extends Super{public int m1() throws IOException{}}//正确!!!iv. class Super {public int m1(){}}class Sub extends Super{public int m1() throws NullPointerxception{}}一、选择题:Question 1 Given:20. public class CreditCard {21.22. private String cardlD;23. private Integer limit;24. public String ownerName;25.26. public void setCardlnformation(String cardlD,27. String ownerName,28. Integer limit) {29. this.cardlD = cardlD;30. this.ownerName = ownerName;31. this.limit = limit;32. }33. }Which is true?A. The class is fully encapsulated.B. The code demonstrates polymorphism.C. The ownerName variable breaks encapsulation.D. The cardlD and limit variables break polymorphism.E. The setCardlnformation method breaks encapsulation. Answer: CQuestion 2 Which two are true? (Choose two.) A. An encapsulated, public class promotes re-use.B. Classes that share the same interface are always tightly encapsulated.C. An encapsulated class allows subclasses to overload methods, but does NOT allow overriding methods.D. An encapsulated class allows a programmer to change an implementation without affecting outside code. Answer: ADQuestion 3 Assume that country is set for each class. Given:10. public class Money {11. private String country, name;12. public String getCountry() { return country; }13.}and:24. class Yen extends Money {25. public String getCountry() { return super.country; }26. }27.28. class Euro extends Money {29. public String getCountry(String timeZone) {30. return super.getCountry();31. }32. }Which two are correct? (Choose two.) A. Yen returns correct values. B. Euro returns correct values.C. An exception is thrown at runtime.D. Yen and Euro both return correct values.E. Compilation fails because of an error at line 25.F. Compilation fails because of an error at line 30. Answer: BEQuestion 4 Given:10. interface A { void x(); }11. class B implements A { public void x() { } public void y() { } }12. class C extends B { public void x() {} } And:20. java.util.List<A> list = new java.util.ArrayList<A>();21. list.add(new B());22. list.add(new C());23. for (A a:list) {24. a.x();25. a.y();26. } What is the result? A. The code runs with no output. B. An exception is thrown at runtime.C. Compilation fails because of an error in line 20.D. Compilation fails because of an error in line 21.E. Compilation fails because of an error in line 23.F. Compilation fails because of an error in line 25. Answer: FQuestion 5 Given:1. class SuperClass {2. public A getA() {3. return new A();4. }5. }6. class SubClass extends SuperClass {7. public B getA() {8. return new B();9. }10. } Which is true?A. Compilation will succeed if A extendsB. B. Compilation will succeed if B extends A.C. Compilation will always fail because of an error in line 7.D. Compilation will always fail because of an error in line 8. Answer: B Question 6 Given:1. interface A { public void aMethod(); } 2. interface B { public void bMethod(); }3. interface C extends A,B { public void cMethod(); }4. class D implements B {5. public void bMethod() { }6. }7. class E extends D implements C {8. public void aMethod() { }9. public void bMethod() { }10. public void cMethod() { }11. }What is the result? A. Compilation fails because of an error in line 3. B. Compilation fails because of an error in line 7.C. Compilation fails because of an error in line 9.D. If you define D e = new E(), then e.bMethod() invokes the version of bMethod() defined in Line 5.E. If you define D e = (D)(new E()), then e.bMethod() invokes the version of bMethod() defined in Line 5.F. If you define D e = (D)(new E()), then e.bMethod() invokes the version of bMethod() defined in Line 9. Answer: FQuestion 7 Given:1. public class Base {2. public static final String FOO ="foo";3. public static void main(String[] args) {4. Base b = new Base();5. Sub s = new Sub();6. System.out.print(Base.FOO);7. System.out.print(Sub.FOO);8. System.out.print(b.FOO);9. System.out.print(s.FOO);10. System.out.print(((Base)s).FOO);11. } }12. class Sub extends Base {public static final String FOO="bar";} What is the result? A. foofoofoofoofoo B. foobarfoobarbarC. foobarfoofoofooD. foobarfoobarfooE. barbarbarbarbarF. foofoofoobarbarG. foofoofoobarfoo Answer: DQuestion 8 Given:1. class Pizza {2. java.util.ArrayList toppings;3. public final void addTopping(String topping) {4. toppings.add(topping);5. }6. }7. public class PepperoniPizza extends Pizza {8. public void addTopping(String topping) {9. System.out.println("Cannot add Toppings");10. }11. public static void main(String[] args) {12. Pizza pizza = new PepperoniPizza();13. pizza.addTopping("Mushrooms");14. }15. } What is the result? A. Compilation fails. B. Cannot add Toppings C. The code runs with no output.D. A NullPointerException is thrown in Line 4. Answer: AQuestion 9 Given:10. public class Foo {11. public int a;12. public Foo() { a = 3; }13. public void addFive() { a += 5; }14. }and:20. public class Bar extends Foo {21. public int a;22. public Bar() { a = 8; }23. public void addFive() { this.a +=5; }24. }invoked with:30. Foo foo = new Bar();31. foo.addFive();32. System.out.println("Value: "+ foo.a); What is the result? A. Value: 3B. Value: 8C. Value: 13D. Compilation fails.E. The code runs with no output.F. An exception is thrown at runtime. Answer: AQuestion 10 Given:10. public class SuperCalc {11. protected static int multiply(int a, int b) { return a * b; }12. }and:20. public class SubCalc extends SuperCalc {21. public static int multiply(int a, int b) {22. int c = super.multiply(a, b);23. return c;24. }25. } and:30. SubCalc sc = new SubCalc();31. System.out.println(sc.multiply(3,4));32. System.out.println(SubCalc.multiply(2,2)); What is the result?A. 12 4 B. The code runs with no output. C. An exception is thrown at runtime. D. Compilation fails because of an error in line 21. E. Compilation fails because of an error in line 22. F. Compilation fails because of an error in line 31. Answer: EQuestion 11 Given:1. public class Team extends java.util.LinkedList {2. public void addPlayer(Player p) {3. add(p);4. }5. public void compete(Team opponent) { /* more code here */ }6. }7. class Player { /* more code here */ } Which two are true? (Choose two.) A. This code will compile.B. This code demonstrates proper design of an is-a relationship.C. This code demonstrates proper design of a has-a relationship.D. A Java programmer using the Team class could remove Player objects from a Team object. Answer: ADQuestion 12 Given:11. class ClassA {}12. class ClassB extends ClassA {}13. class ClassC extends ClassA {}and:21. ClassA p0 = new ClassA();22. ClassB p1 = new ClassB();23. ClassC p2 = new ClassC();24. ClassA p3 = new ClassB();25. ClassA p4 = new ClassC(); Which three are valid? (Choose three.) A. p0 = p1; B. p1 =p2; C. p2 = p4;D. p2 = (ClassC)p1;E. p1 = (ClassB)p3;F. p2 = (ClassC)p4; Answer: AEFQuestion 13 Given:11. class Animal { public String noise() { return "peep"; } }12. class Dog extends Animal {13. public String noise() { return "bark"; }14. }15. class Cat extends Animal {16. public String noise() { return "meow"; }17. }.....30. Animal animal = new Dog();31. Cat cat = (Cat)animal;32. System.out.printIn(cat.noise()); What is the result?A. peepB. barkC. meowD. Compilation fails.E. An exception is thrown at runtime. Answer: EQuestion 14 Given:11. class Cup { }12. class PoisonCup extends Cup { }21. public void takeCup(Cup c) {22. if(c instanceof PoisonCup) {23. System.out.println("Inconceivable!");24. } else if(c instanceof Cup) {25. System.out.println("Dizzying intellect!");26. } else {27. System.exit(0);28. }29. } And the execution of the statements: Cup cup = new PoisonCup(); takeCup(cup); What is the output? A. Inconceivable! B. Dizzying intellect! C. The code runs with no output.D. An exception is thrown at runtime.E. Compilation fails because of an error in line 22. Answer: AQuestion 15 Click the Exhibit button.1. public class SimpleCalc {2. public int value;3. public void calculate() { value += 7; }4. } And: 1. public class MultiCalc extends SimpleCalc {2. public void calculate() { value -= 3; }3. public void calculate(int multiplier) {4. calculate();5. super.calculate();6. value *=multiplier;7. }8. public static void main(String[] args) {9. MultiCalc calculator = new MultiCalc();10. calculator.calculate(2);11. System.out.println("Value is: "+ calculator.value);12. }13. }What is the result? A. Value is: 8B. Compilation fails.C. Value is: 12D. Value is: -12E. The code runs with no output.F. An exception is thrown at runtime. Answer: AQuestion 16 Given:1. public class Blip {2. protected int blipvert(int x) { return 0; }3. }4. class Vert extends Blip {5. // insert code here6. } Which five methods, inserted independently at line 5, will compile? (Choose five.)A. public int blipvert(int x) { return 0; }B. private int blipvert(int x) { return 0; }C. private int blipvert(long x) { return 0; }D. protected long blipvert(int x) { return 0; }E. protected int blipvert(long x) { return 0; }F. protected long blipvert(long x) { return 0; }G. protected long blipvert(int x, int y) { return 0; } Answer: ACEFGQuestion 17 Given:11. abstract class Vehicle { public int speed() { return 0; } }12. class Car extends Vehicle { public int speed(){ return 60; } }13. class RaceCar extends Car { public int speed() { return 150; }}......21. RaceCar racer = new RaceCar();22. Car car = new RaceCar();23. Vehicle vehicle = new RaceCar();24. System.out.println(racer.speed() + ", " + car.speed()25. + ", "+ vehicle.speed()); What is the result?A. 0, 0,0B. 150, 60, 0C. Compilation fails.D. 150, 150, 150E. An exception is thrown at runtime. Answer: DQuestion 18 Given:10. interface A { public int getValue() }11. class B implements A {12. public int getValue() { return 1; }13. }14. class C extends B {15. // insert code here16. }Which three code fragments, inserted individually at line 15, make use of polymorphism? (Choose three.) A. public void add(C c) { c.getValue(); } B. public void add(B b) { b.getValue(); } C. public void add(A a) { a.getValue(); } D. public void add(A a, B b) { a.getValue(); } E. public void add(C c1, C c2) { c1.getValue(); } Answer: BCDQuestion 19 Which three statements are true? (Choose three.) A. A final method in class X can be abstract if and only if X is abstract. B. A protected method in class X can be overridden by any subclass of X. C. A private static method can be called only within other static methods in class X. D. A non-static public final method in class X can be overridden in any subclass of X.E. A public static method in class X can be called by a subclass of X without explicitly referencing the class X.F. A method with the same signature as a private final method in class X can be implemented in a subclass of X.G. A protected method in class X can be overridden by a subclass of A only if the subclass is in the same package as X. Answer: BEFQuestion 20 Given:10. abstract class A {11. abstract void al();12. void a2() { }13. }14. class B extends A {15. void a1() { }16. void a2() { }17. }18. class C extends B { void c1() { } }and:A x = new B(); C y = new C(); A z = new C();Which four are valid examples of polymorphic method calls? (Choose four.) A. x.a2(); B. z.a2(); C. z.c1(); D. z.a1(); E. y.c1(); F. x.a1(); Answer: ABDFQuestion 21 Click the Exhibit button.1. public class GoTest {2. public static void main(String[] args) {3. Sente a = new Sente(); a.go();4. Goban b = new Goban(); b.go();5. Stone c = new Stone(); c.go();6. }7. }8.9. class Sente implements Go {10. public void go() { System.out.println("go in Sente."); }11. }12.13. class Goban extends Sente {14. public void go() { System.out.println("go in Goban"); }15. }16.17. class Stone extends Goban implements Go { }18.19. interface Go { public void go(); } What is the result?A. go in Goban go in Sente go in SenteB. go in Sente go in Sente go in GobanC. go in Sente go in Goban go in GobanD. go in Goban go in Goban go in SenteE. Compilation fails because of an error in line 17. Answer: CQuestion 22 Given:1. class ClassA {2. public int numberOfinstances;3. protected ClassA(int numberOfinstances) {4. this.numberOflnstances = numberOfinstances;5. }6. }7. public class ExtendedA extends ClassA {8. private ExtendedA(int numberOfInstances) {9. super(numberOfiInstances);10. }11.public static void main(String[] args) {12.ExtendedA ext = new ExtendedA(420);13. System.out.print(ext.numberOfInstances);14. }15.} Which is true? A. 420 is the output. B. An exception is thrown at runtime. C. All constructors must be declared public.D. Constructors CANNOT use the private modifier.E. Constructors CANNOT use the protected modifier. Answer: AQuestion 23 Given:1. class Super {2. private int a;3. protected Super(int a) { this.a = a; }4. }.....11. class Sub extends Super {12. public Sub(int a) { super(a); }13. public Sub() { this.a= 5; }14. }Which two, independently, will allow Sub to compile? (Choose two.) A. Change line 2 to:public int a;B. Change line 2 to:protected int a;C. Change line 13 to:public Sub() { this(5); }D. Change line 13 to:public Sub() { super(5); }E. Change line 13 to:public Sub() { super(a); } Answer: CDQuestion 24 Given:10. public class Hello {11. String title;12. int value;13. public Hello() {14. title += "World";15. }16. public Hello(int value) {17. this.value = value;18. title = "Hello";19. Hello();20. }21. }and:30. Hello c = new Hello(5);31. System.out.println(c.title); What is the result? A. Hello B. Hello World C. Compilation fails.D. Hello World 5E. The code runs with no output.F. An exception is thrown at runtime. Answer: CQuestion 25 Click the Exhibit button.1. public class Car {2. private int wheelCount;3. private String vin;4. public Car(String vin) {5. this.vin = vin;6. this.wheelCount = 4;7. }8. public String drive() {9. return "zoom-zoom";10. }11. public String getInfo() {12. return "VIN: "+ vin + "wheels: "+ wheelCount;13. }14. } And:1. public class MeGo extends Car {2. public MeGo(String vin) {3. this.wheelCount = 3;4. }5. }What two must the programmer do to correct the compilation errors? (Choose two.)A. insert a call to this() in the Car constructorB. insert a call to this() in the MeGo constructorC. insert a call to super() in the MeGo constructorD. insert a call to super(vin) in the MeGo constructorE. change the wheelCount variable in Car to protectedF. change line 3 in the MeGo class to super.wheelCount = 3; Answer: DEQuestion 26 Click the Exhibit button.1. public class Employee {2. String name;3. double baseSalary;4. Employee(String name, double baseSalary) {5. = name;6. this.baseSalary = baseSalary;7. }8. } And:1. public class Salesperson extends Employee {2. double commission;3. public Salesperson(String name, double baseSalary,4. double commission) {5. // insert code here6. }7. } Which code, inserted at line 7, completes the Salesperson constructor?A. mission = commission;B. superb();commission = commission;C. mission = commission;superb();D. super(name, baseSalary);mission = commission;E. super();mission = commission;F. mission = commission;super(name, baseSalary); Answer: DQuestion 27 Which Man class properl y represents the relationship “Man has a best friend who is a Dog”?A. class Man extends Dog { }B. class Man implements Dog { }C. class Man { private BestFriend dog; }D. class Man { private Dog bestFriend; }E. class Man { private Dog<bestFriend> }F. class Man { private BestFriend<dog> }Answer: DQuestion 28 Which four are true? (Choose four.) A. Has-a relationships should never be encapsulated.B. Has-a relationships should be implemented using inheritance.C. Has-a relationships can be implemented using instance variables.D. Is-a relationships can be implemented using the extends keyword.E. Is-a relationships can be implemented using the implements keyword.F. The relationship between Movie and Actress is an example of an is-a relationship.G. An array or a collection can be used to implement a one-to-many has-a relationship. Answer: CDEGQuestion 29 Which two are true about has-a and is-a relationships? (Choose two.) A. Inheritance represents an is-a relationship.B. Inheritance represents a has-a relationship.C. Interfaces must be used when creating a has-a relationship.D. Instance variables can be used when creating a has-a relationship. Answer: ADQuestion 30 Given:10. interface Jumper { public void jump(); }......20. class Animal {}......30. class Dog extends Animal {31. Tail tail;32. }......40. class Beagle extends Dog implements Jumper {41. public void jump() { }42. }.......50. class Cat implements Jumper {51. public void jump() { }52. } Which three are true? (Choose three.) A. Cat is-a AnimalB. Cat is-a JumperC. Dog is-a AnimalD. Dog is-a JumperE. Cat has-a AnimalF. Beagle has-a TailG. Beagle has-a Jumper Answer: BCFQuestion 31 Given:1. package geometry;2. public class Hypotenuse {3. public InnerTriangle it = new InnerTriangle();4. class InnerTriangle {5. public int base;6. public int height;7. }8. }Which is true about the class of an object that can reference the variable base? A. It can be any class. B. No class has access to base. C. The class must belong to the geometry package. D. The class must be a subclass of the class Hypotenuse. Answer: C二、拖拽题:Question 1:Answer:class A has name A class B has name AQuestion 2:Answer:Alpha:foo Beta:foo B eta:bar B eta:barQuestion 3:Answer:public class Beta extends Alpha{public void bar(int x){}public int bar(String x){return 1;}public void bar(int x,int y){}} Question 4:Answer:class A{ List<B> b;} //Car has Wheels class A extends B,C{}class A{} //Car is an Object class A{B c; C c;}class A{B b;} //Car has a Steering Wheelsclass A implements B,C{} //Car is Vehicle And Car is a Collectableclass A extends B{} //Mini is a CarQuestion 5:Answer: Dog is-a AnimalForest has-a TreeRectangle has-a SideJava Book is-a Programming Book。

2014 March Mock Exam - AM -Answers

2014 March Mock Exam - AM -Answers

Block 1: MachariaQuestion1 of 6Under the new Prudent Investor Rule, a trustee has a duty to avoid fees, transaction costs, andother expenses that are not justified by the objectives of the investment program.CFA Level II“P rudence in Perspective,” John Train and Thomas A. Melfe Section 4Question2 of 6Under the new Prudent Investor Rule, previous specific restrictions on types of investments (e.g., mutual funds and unit trusts) that trustees may use have been abrogated. A trustee may invest in anything that plays an appropriate role in achieving the risk–return objectives of the trust and that meets the requirements of prudent investing, irrespective of the type of management used (i.e., active or passive). CFA Level II“P rudence in Perspective,” John Train and Thomas A. Melfe Section 3Question3 of 6The trustee with the civil engineering qualification who had previously worked with developers did not use his expertise in helping the trustees to make an informed investment decision when he suspected development costs were underestimated. Under the general fiduciary standards, if a trustee possesses more than ordinary skill, he must use it.CFA Level II“P rudence in Perspective,” John Train and Thomas A. Melfe Section 4Question4 of 6The trustees appear to have fulfilled the duty to be impartial to balancing income and capital, as both unit trusts are “balanced”—they are invested in nearly identical underlying investments with growth opportunities and current income streams. The trustees will violate the duty to avoid fees by switching to a 2% front-end load unit trust only on the basis of wanting to support a former employee. The trustees will also violate the duty of delegation because it is unlikely a prudent investor would move 100% of their investments to a brand new investment manager; it could significantly increase the risk factors faced by the fund.CFA Level II“P rudence in Perspective,” John Train and Thomas A. Melfe Section 4Question5 of 6A trustee’s compliance with his duties (i.e., care, skill, and caution) is judged as of the time an investment decision is made, not with the benefit of hindsight or subsequent developments or on the outcome of his investment decisions.CFA Level II“P rudence in Perspective,” John Train and Thomas A. Melfe Section 4Question6 of 6Even a highly paid beneficiary may still require high levels of liquidity (e.g., if his or her debt level is high, liquidity would be needed to make debt payments), and it would also be pertinent to consider the financial stability of the employer to determine the likelihood that the income stream from his or her wages will be regular. Therefore, it is still necessary for the trustee to assess the key factors of liquidity and income regularity for a highly paid beneficiary.CFA Level II“P rudence in Perspective,” John Train and Thomas A. Melfe Section 6Block 2: AnaKondaQuestion1 of 6Medeva's comment is most accurate. The percentage change in stock market value equals the percentage change in GDP plus the percentage change in the share of earnings (profit) in GDP plus the percentage change in the price-to-earnings multiple. Over short to immediate horizons, all three of these factors contribute to appreciation or depreciation of the stock market. In the long run, however, the growth rate of GDP must dominate. As noted, the ratio of earnings to GDP cannot rise forever.CFA Level II"Economic Growth and the Investment Decision," Paul KutasovicSections 2.7, 32 of 6Steady state of growth = ΔY/Y= θ/(1 –α) + n,whereθ = growth rate of TFP (in this case, 2.25)(1 –α) = labor cost in total factor cost (in this case, 0.689)n = labor force growth (in this case, 2%)For Country X: ΔY/Y = 2.25/0.689 + 2 = 5.27%CFA Level II“Economic Growth and the Investment Decision,” Paul KutasovicSection 5.2.1Question3 of 6Using the labor productivity growth accounting equation, Country Z indicates the highest growth rate in potential GDP.Growth rate in potential GDP = Long-term growth rate of labor force + Long-term growth rate in labor productivityCFA Level II“Economic Growth and the Investment Decision,” Paul KutasovicSection 4.34 of 6Rajan’s conclusions pertaining to Country Y are most consistent with the neoclassical model. Because of diminishing marginal returns to capital, the only way to sustain growth in potential GDP per capita is through technological change or growth in total factor productivity. This change results in an upward shift in the production function—the economy produces more goods and services for any given mix of labor and capital inputs.CFA Level II“Economic Growth and the Investment Decision,” Paul KutasovicSection 5.2.1Question5 of 6Country Z has the highest real interest rate according to the International Fisher effect. The Fisher effect breaks down the nominal interest rate (i) in a given country into two parts: (1) the real interest rate in that particular country (r) and (2) the expected inflation rate (πɛ) in that country.ɛɛ = Expected inflation rate.CFA Level II“Currency Exchange Rates: Determination and Forecasting,” Michael R. Rosenberg and William A. BarkerSection 3.1.56 of 6The Taylor rule to determine the appropriate policy rate isi = r n +π+ α(π–π*) + ß(y–y*)wherei= the Taylor rule prescribed central bank policy rater n= the neutral real policy rateπ = the current inflation rateπ* = the central bank’s target inflation ratey= the log of the current level of output21y* = the log of the economy’s potential/sustainable level of outputα and ß = the policy response coefficientsTaylor proposed that alpha and beta each equal 0.5.i = 2.75 + 2.67 + 0.5(2.67 – 3.27) + 0.5(3.50 – 4.00) = 2.75 + 2.67 – 0.30 – 0.25 = 4.87%CFA Level II“Currency Exchange Rates: Determination and Forecasting,” Michael R. Rosenberg and William A. BarkerSection 6.3Block 3: AdOreQuestion1 of 6In 2011, although Glace had less than 20% ownership interest in AdOre, it was considered to have significant influence, which required the equity method.CFA Level II"Intercorporate Investments," Susan Perry WilliamsSections 2, 5Question2 of 6In 2011, Strawberry Mines used the equity method because it exercised significant influence and owned 32% of AdOre. Under the equity method, it should recognize its percentage share (32% × 18,182 = 5,818.2) of AdOre's net income.CFA Level II"Intercorporate Investments," Susan Perry WilliamsSection 5.1Question3 of 6In 2011, Strawberry Mines owned 32% of AdOre's stock and had significant influence; therefore, it should have used the equity method. It will not report any dividends received from AdOre as income but would have deducted the dividends received from the carrying value of the investment in AdOre.CFA Level II"Intercorporate Investments," Susan Perry WilliamsSection 5.1Question4 of 6In 2011, Cupernico had a controlling interest in AdOre and would have used the consolidation method. In consolidation, companies combine all of the assets, liabilities, revenues, and expenses of subsidiaries with the parent. Therefore, Cupernico would have included $40,000 (100%) of AdOre's long-term debt.CFA Level II"Intercorporate Investments," Susan Perry WilliamsSection 6.45 of 6In 2012, Cupernico and Glace shared joint control. Cupernico must use the equity method under US GAAP; if the ownership structure had not changed, Cupernico would have continued to use the consolidation method.CFA Level II"Intercorporate Investments," Susan Perry WilliamsSections 5.1, 6.56 of 6CFA Level II"Intercorporate Investments," Susan Perry WilliamsSection 6.2.5Block 4: Atlantic PreservesQuestion1 of 6Loris' response about the past service costs is most accurate. Past service costs arise because of the enrichment of the pension benefit to be received under the plan. Under US GAAP, any past service costs will be reported in other comprehensive income and are amortized on the profit and loss statement over the average service lives of the employees. Under IFRS, the past service costs are recognized as an expense in the income statement.CFA Level II"Employee Compensation: Post-Employment and Share Based," Elaine Henry and Elizabeth A. GordonSection 2.1, 2.2, 2.3.2.20$9,683 x 0.075$9,683 $10,409$9,683 $20,818CFA Level II“Employee Compensation: Post-Employment and Share Based,”Elaine Henry and Elizabeth A. Gordon Section 2.3.3Question3 of 6The yield on high quality corporate bonds is the appropriate discount rate that should be used to calculate the present value of the future benefits because it represents the rate at which the defined benefit obligation could be effectively settled.CFA Level II"Employee Compensation: Post-Employment and Share Based," Elaine Henry and Elizabeth A. GordonSections 2.2, 2.3.3, 2.4.14 of 6The current service cost will decrease, not increase. A higher discount rate means that the present value of the future benefits earned in retirement will be lower and thus the annual unit credit will be lower. Therefore, the current service cost will decrease.CFA Level II"Employee Compensation: Post-Employment and Share Based," Elaine Henry and Elizabeth A. GordonSection 2.3.2.2Question5 of 6The amount of Atlantic Preserve's 2013 periodic pension cost (in $ thousands) is closest to: Under US GAAP, the periodic pension cost is calculated as follows:CFA Level II"Employee Compensation: Post-Employment and Share Based," Elaine Henry and Elizabeth A. GordonSection 2.3.2.2, Exhibit 2Question6 of 6The total periodic pension cost is the change in the net pension asset or liability excluding the effect of the employer's periodic contribution to the plan.“Employee Compensation: Post-Employment and Share Based,”Elaine Henry and Elizabeth A. Gordon Section 2.4.3Block 5: DeMolayQuestion1 of 6When modeled using a AR(1) model, as in the formula given in Exhibit 1, random walks will have an estimated intercept coefficient near zero and an estimated slope coefficient on the first lag near 1. Therefore, his statement is correct.CFA Level II"Time-Series Analysis," Richard A. Defusco, Dennis W. McLeavey, Jerald E. Pinto, and David E. RunkleSection 5.1Question2 of 6If a time series is a random walk, the best forecast of x t that can be made in period t– 1 is x t-1. So, the best forecast of the next period's trailing P/E is the current period's trailing P/E.CFA Level II"Time-Series Analysis," Richard A. Defusco, Dennis W. McLeavey, Jerald E. Pinto, and David E. RunkleSection 5.1Question3 of 6We can test whether a time series is ARCH by regressing the squared residuals from a previously estimated time series model on a constant and one lag of the squared residuals (as in Exhibit 2). If the estimate of the slope (c1 in Exhibit 2) of the regression of the squared residuals on the lagged one period squared residuals is statistically significantly different from 0, the time series is ARCH(1).CFA Level IITime-Series Analysis," Richard A. Defusco, Dennis W. McLeavey, Jerald E. Pinto, and David E. Runkle Section 9Question4 of 6If ARCH exists, the standard errors for the regression parameters will not be correct. In the case that ARCH exists, you will need to use generalized least squares or other methods that correct for heteroskedasticity to correctly estimate the standard error of the parameters in the time series model.CFA Level II"Time-Series Analysis," Richard A. Defusco, Dennis W. McLeavey, Jerald E. Pinto, and David E. RunkleSection 9Question5 of 6When working with two time series in a regression analysis, both of the series must be tested for the presence of a unit root. If neither series has a unit root, you can safely use linear regression to test the relationship between the two time series.CFA Level II"Time-Series Analysis," Richard A. Defusco, Dennis W. McLeavey, Jerald E. Pinto, and David E. RunkleSection 10Question6 of 6If the two series each have a unit root, regression results will be consistent, provided that the two series are cointegrated.CFA Level II"Time-Series Analysis," Richard A. Defusco, Dennis W. McLeavey, Jerald E. Pinto, and David E. RunkleSection 10Block 6: ShoshoneQuestion1 of 6Characteristic 3 describes venture capital investments, which are commonly the result of relationships between venture capitalists and entrepreneurs (existing shareholders or owners). Most buyout transactions are auctions, which involve multiple potential acquirers.CFA Level 2“Private Equity Valuation,” Yves Courtois and Tim JenkinsonSection 2.3Question2 of 6Private equity firms may require that certain strategically important decisions (such as acquisitions or divestitures) be approved by the private equity firm, protecting its equity interests, not those of managers.CFA Level 2"Private Equity Valuation," Yves Courtois and Tim JenkinsonSection 2.1Question3 of 6A common source of value creation in leveraged buyouts is debt reduction.CFA Level 2"Private Equity Valuation," Yves Courtois and Tim JenkinsonSection 2.4Question4 of 6Liquidation is the route chosen if the company is no longer viable.The exit route used for LUW, Inc., was a secondary market transaction at a price that indicated a strong company.CFA Level 2"Private Equity Valuation," Yves Courtois and Tim JenkinsonSection 2.6Question5 of 6Although the investment in Firm B produced a $10 million profit in two years, that figure represents an annual return (internal rate of return, or IRR) of only 8.01% = (70 million/60 million)1/2– 1, which is below the hurdle rate. The general partner will not receive any carried interest payments until the fund's IRR exceeds the hurdle rate.CFA Level 2"Private Equity Valuation," Yves Courtois and Tim JenkinsonSections 3.1, 4Question6 of 6Total value to paid in (TVPI) equals distributed to paid in (DPI) plus residual value to paid in (RVPI), where DPI is the sum of distributions divided by paid-in capital [(19+38)/125] = 0.46 and RVPI is NAV after distributions divided by paid-in capital (122.7/125) = 0.98. TVPI = 0.46 + 0.98 = 1.44.CFA Level 2"Private Equity Valuation," Yves Courtois and Tim JenkinsonSections 3.5, 4Block 7: MerinarQuestion1 of 6Per $1 of notional principal, the market value of the equity swap is calculated as follows:The market value of the swap = 0.1333 × $75,000,000 = $9,997,500For example, B30(90) is calculated asCFA Level 2“Swap Markets and Contracts,” Don M. ChanceSection 4.2.3Question2 of 6The market value of the receiver swaption is calculated as follows:Max[0, (0.0275 – 0.0223)] × (0.9903 + 0.9645 + 0.9419 + 0.0149) × $25,000,000= $495,508For example, B0(180) is calculated asOther present value factors are calculated in a similar manner.The fixed rate is calculated as follows:The annualized rate = 0.0223 × 2 = 0.0446.CFA Level 2“Swap Markets and Contracts,” Don M. ChanceSection 4.2.1 and 6.4Question3 of 6Since Geng expects credit ratings for Onex Corporation bonds to weaken over the near term up to two years, and then strengthen over the longer term (five years), the appropriate strategy is to buy two-year CDS and sell five-year CDS. The two-year CDS would provide a hedge against short-term volatility, and the sale of the five-year CDS would partially fund the purchase of two-year CDS. This trade is a curve flattening trade.CFA Level 2“Credit Default Swaps,” Brian Rose and Don M. ChanceSection 4.1Question4 of 6The S&P MidCap 400 futures price is 840 × (1.035) (145/365)– 3.15 = 848.41.CFA Level 2“Futures Markets and Contracts,” Don M. ChanceSection 7.35 of 6Merinar is correct. If stock index futures are underpriced, the correct arbitrage strategy would be to short the stock index and purchase stock index futures. This approach will effectively ensure that Merinar has borrowed money at the risk-free rate and repaid at a rate less than the risk-free rate.CFA Level 2“Futures Markets and Contracts,” Don M. ChanceSection 7.3Question6 of 6Jani is correct. The futures price is equal to the expected spot price minus a risk premium. Alternatively, the expected spot price equals the futures price plus a risk premium.CFA Level 2“Futures Markest and Contracts,” Don M. ChanceSection 7.1.9Block 8: AlahtabQuestion1 of 6Using the Gordon growth model, V0 = D0 (1 + g)/(r–g).So,g = b × ROEb = 1 – Payout ratio = 1 – (48/120) = 0.6ROE = Net income/Shareholders’ equity = 120/(800 + 159.3) = 12.5g = 0.6 × 12.5 = 7.5%D0 = $48 million/50 million shares = $0.96/shareV0 = (0.96×1 + 0.075) / (0.11 – 0.075) = $29.49CFA Level II“Discounted Dividend Valuation,” Jerald Pinto, Elaine Henry, Thomas Robinson, and JohnStoweSection 4.12 of 6The H-model is,whereD0= Dividend/Number of sharesD0= $48/$50 = $0.96g S= Initial short-term dividend growth rate = 20%g L= Normal long-term dividend growth rate = 6%r= 11% + 2% = 13%H= 4/2 = 2V0 = $14.54 + $3.84 = $18.38CFA Level II“Discounted Dividend Valuation,” Jerald Pinto, Elaine Henry, Thomas Robinson, and John Stowe Section 5.3Question3 of 6FCFF = EBITDA(1 – Tax rate) + Depreciation(Tax rate) – FCInv – WCInvCFA Level II“Free Cash Flow Valuation,” Jerald Pinto, Elaine Henry, Thomas Robinson, and John StoweSection 3.5Question4 of 6= $1.383 = $0.96 $1.66/$1.134=$1.02;25.13/1.63=$15.42CFA Level II“Free Cash Flow Valuation,” Jerald Pinto, Elaine Henry, Thomas Robinson, and John StoweSection 4.3Question5 of 6Jatin is correct with respect to Statement 1 only. The H-model is a variant of the two-stage model in which growth begins at a high rate and declines linearly throughout the super-normal growth period until itreaches a normal growth rate at the end. A smoother transition to the mature phase growth rate would be more realistic than the erratic growth rate in dividends displayed by the data.CFA Level II“Discounted Dividend Valuation,” Jerald Pinto, Elaine Henry, Thomas Robinson, and John StoweSection 5.3“Free Cash Flow Valuation,” Jerald Pinto, Elaine Henry, Thomas Robinson, and John Stowe Section 3.8.36 of 6Lederman is correct with respect to Statement 2 only. The Pastor–Stambaugh model adds a liquidity premium as a fourth factor to the Fama–French model and thus helps make an adjustment for the liquidity concerns surrounding the stock.CFA Level II“Return Concepts,” by Jerald E. Pinto, Elaine Henry, Thomas R. Robinson, and John D. StoweSection 4.1.1, 4.2.2“Residual Income Valuation,” Jerald Pinto, Elaine Henry, Thomas Robinson, and John StoweSection 4.1Block 9: GreenSnacksQuestion1 of 6GNSK is in the growth stage because it is expanding rapidly and enjoying the benefits of the health food market, which is also growing rapidly. GNSK is also experiencing high and growing profit margins as well as abnormally high earnings per share growth, which are all indicative of a company in its growth phase. CFA Level II“Discounted Dividend Valuation,” by Jerald Pinto, Elaine Henry, Thomas Robinson, and John Stowe Section 4.7QuestionGNSK’s strategy is best described as visionary. The slow growt h of the packaged food industry required a bold strategy that GNSK undertook to improve its own growth profile. This approach is characteristic of a visionary strategy. The process to develop its healthier foods with longer shelf lives took time and care, and management was willing to stay the course to develop its new process. Both of these decisions are also characteristic of the visionary strategy.CFA Level II“Your Strategy Needs a Strategy,” Martin Reeves, Claire Love, and Philipp Tillmanns3 of 6The H-model that Tanner decides to use is a variant of the two-stage dividend discount model. It assumes growth begins at a high rate and declines linearly throughout the super-normal growth period until it reaches a normal rate at the end. In the case of GNSK, the H-model is appropriate for estimating the required return because Tanner expects extraordinary earnings growth of 20% next year with the rate of growth diminishing over time to match industry conditions in Year 6.H = Half-life in years of the super-normal growth rate = 5 x 0.5 = 2.5D0 = 2.45 × 0.25 = $0.6125g L= Sustainable growth rate for the industry = ROE × (1-payout) = 0.128×(1 – 0.65) = 0.0448 or 4.48%g s= Short-term growth rate of GNSK = 0.20= (0.028) {(1.0448) + 0.388} +0.0448=0.08492 or 8.5%CFA Level II“Discounted Dividend Valuation,” Jerald Pinto, Elaine Henry, Thomas Robinson, and John Stowe Sections 5.2, 5.6Question4 of 6Rearranging:Let D0/P0 = d and rewrite the equation:Using the industry data in Exhibit 1:Alternatively:0.037 = (0.11 – g)/(1 + g)0.037(1 + g) + g = 0.110.037 + 0.037g + g = 0.111.037g = 0.11 – 0.037g = 0.073 / 1.037 = 0.0704 =~ 7.0%CFA Level II“Discounted Dividend Valuation,” Jerald Pinto, Elaine Henry, Thomas Robinson, and John Stowe Section 4.1“Market-Based Valuation: Price and Enterprise Value Multiples,” Jerald Pinto, Elaine Henry, Thomas Robinson, and John StoweSection 3.5.2Question5 of 6V0 = D1/(r–g) where D1 = D0 (1 + g).=2.43/0.094 = $25.85CFA Level II“Discounted Dividend Valuation,” by Jerald Pinto, Elaine Henry, Thomas Robinson, and John Stowe Section 4.16 of 6Baldridge’s statement is least accurate. The residual income approach uses the book value of eq uity, and it requires that the clean surplus relationship holds.CFA Level II“Discounted Dividend Valuation,” Jerald Pinto, Elaine Henry, Thomas Robinson, and John StoweSection 2.2“Residual Income Valuation,” Jerald Pinto, Elaine Henry, Thomas Robinson, and John StoweSection 3.1Block 10: FischerQuestion1 of 6A 5-year/30-year multi-stage period is the most appropriate time horizon. Fischer must first consider his concentrated restricted PSMG holding that reduces diversification during the first five years while still addressing his long-term objectives to fund his retirement.CFA Level II"The Portfolio Management Process and the Investment Policy Statement," John L. Maginn, Donald L. Tuttle, Dennis W. McLeavey, and Jerald E. PintoSection 6.2.2Question2 of 6Risk tolerance will not be satisfied. None of the investment alternatives offers a standard deviation of less than 12%, which is more than Schilz's recommendation of a 9% standard deviation risk objective.CFA Level II"The Portfolio Management Process and the Investment Policy Statement," John L. Maginn, Donald L. Tuttle, Dennis W. McLeavey, and Jerald E. PintoSection 6.13 of 6Schilz would not include the Broad Market Index Fund. PSMG stock has a high correlation with the Broad Market Index and would offer little diversification benefit.CFA Level II"Portfolio Concepts," Richard A. DeFusco, Dennis W. McLeavey, Jerald E. Pinto, and David E. RunkleSection 2.1Question4 of 6The addition of the short assets FOF would achieve the greatest mean–variance improvement. The addition of a new asset to a portfolio is optimal if the Sharpe ratio of the new investment is larger than the product of the Sharpe ratio of the existing portfolio and the correlation of the new investment's returns with the returns of the current portfolio.The product of the Sharpe ratio of PSMG and the correlation between PSMG and the short assets FOF is –0.375. The difference between this result and the Sharpe ratio of the short assets FOF is greatest, at 0.955.CFA Level II“Portfolio Concepts,” Richard A. DeFusco, Dennis W. McLeavey, Jerald E. Pinto, and David E. Runkle Section 2.75 of 6The standard deviation is closest to 11.3%. The standard deviation of the portfolio, by using his available funds from cash to purchase €6,250,000 of the EWM short assets fund, is approximately 11.3%. Use the following formula to calculate the standard deviation of a combination of two assets:wherethe weighting of the FOF is 0.309the weighting of PSMG is 0.691(0.3092 × 0.122) + (0.6912 × 0.22) + (2 × 0.309 × 0.691 × ‒0.75 × 0.2 × 0.12 ) = 0.012788√0.012788 = 0.113CFA Level II“Portfolio Concepts,” Richard A. DeFusco, Dennis W. McLeavey, Jerald E. Pinto, and David E. Runkle Question6 of 6PSMG is overvalued according to the CAPM. Exhibit 2 contains the inputs of the CAPM, and the expected return for PSMG is the same as indicated by the model:whereE(Ri)= the expected return on asset i (PSMG)R F= the risk-free rate of return (2%)E(R M) = the expected return on the market portfolio (broad market equity index, 12%)βi= beta of asset i, 1.2or2% + 1.2(12% – 2%) = 14%.According to the CAPM, PSMG’s return should be 14%. Because its actual expected return is only 12%, PSMG is overvalued.CFA Level II“Portfolio Concepts,” Richard A. DeFusco, Dennis W. McLeavey, Jerald E. Pinto, and David E. Runkle Section 2.6。

SCJP Mock Exam 2

SCJP Mock Exam 2

Question 1)Which of the following are legal statements?1) float f=1/3;2) int i=1/3;3) float f=1.01;4) double d=999d;Answer to Question 1)--------------------------------------------------------------------------------Question 2)Which of the following are Java keywords?1) NULL2) new3) instanceOf4) wendAnswer to Question 2)--------------------------------------------------------------------------------Question 3)Which of the following are valid statements?1) System.out.println(1+1);2) int i=2+'2';3) c4) byte b=255;Answer to Question 3)--------------------------------------------------------------------------------Question 4)Which of the following statements are true?1) The garbage collection algorithm in Java is vendor implemented2) The size of primitives is platform dependent3) The default type for a numerical literal with decimal component is a float.4) You can modify the value in an Instance of the Integer class with the setValue methodAnswer to Question 4)--------------------------------------------------------------------------------Question 5)Which of the following are true statements?1) I/O in Java can only be performed using the Listener classes2) The RandomAccessFile class allows you to move directly to any point a file.3) The creation of a named instance of the File class creates a matching file in the underlying operating system only when the close method is called.4) The characteristics of an instance of the File class such as the directory separator, depend on the current underlying operating systemAnswer to Question 5)--------------------------------------------------------------------------------Question 6).Which of the following statements are true?1) The instanceof operator can be used to determine if a reference is an instance of a class, but not an interface.2) The instanceof operator can be used to determine if a reference is an instance of a particular primitive wrapper class3) The instanceof operator will only determine if a reference is an instance of a class immediately above in the hierarchy but no further up the inheritance chain4) The instanceof operator can be used to determine if one reference is of the same class as another reference thusAnswer to Question 6)--------------------------------------------------------------------------------Question 7)Which of the following statements are true?1) An interface can only contain method and not variables2) Interfaces cannot have constructors3) A class may extend only one other class and implement only one interface4) Interfaces are the Java approach to addressing its lack of multiple inheritance, but require implementing classes to create the functionality of the Interfaces.Answer to Question 7)--------------------------------------------------------------------------------Question 8)Which of the following are valid statements1) public class MyCalc extends Math2) Math.max(s);3) Math.round(9.99,1);4)Math.mod(4,10);Answer to Question 8)--------------------------------------------------------------------------------Question 9)Which of the following are methods of the Runnable interface1) run2) start3) yield4) stopAnswer to Question 9)--------------------------------------------------------------------------------Question 10)Which of the following statements are true?1) A byte can represent between -128 to 1272) A byte can represent between -127 to 1283) A byte can represent between -256 to 2564) A char can represent between -2x2 pow 16 2 x2 pow 16 - 1Answer to Question 10)--------------------------------------------------------------------------------Question 11)What will happen when you attempt to compile and run the following code class Base{public void Base(){System.out.println("Base");}}public class In extends Base{public static void main(String argv[]){In i=new In();}}1) Compile time error Base is a keyword2) Compilation and no output at runtime3) Output of Base4) Runtime error Base has no valid constructorAnswer to Question 11)--------------------------------------------------------------------------------Question 12)You have a public class called myclass with the main method defined as followspublic static void main(String parm[]){System.out.println(parm[0]);}If you attempt to compile the class and run the program as followsjava myclass helloWhat will happen?1) Compile time error, main is not correctly defined2) Run time error, main is not correctly defined3) Compilation and output of java4) Compilation and output of helloAnswer to Question 12)--------------------------------------------------------------------------------Question 13)Which of the following statements are true?1) If a class has any abstract methods it must be declared abstract itself.2) All methods in an abstract class must be declared as abstract3) When applied to a class, the final modifier means it cannot be sub-classed4) transient and volatile are Java modifiersAnswer to Question 13)--------------------------------------------------------------------------------Question 14)Which of the following are valid methods?1) public static native void amethod(){}2) public static void ametic native void amethod(){}3) private protected void amethod(){}4) static native void amethod();Answer to Question 14)--------------------------------------------------------------------------------Question 15)Which of the following statements are true?1) Constructors cannot have a visibility modifier2) Constructors can be marked public and protected, but not private3) Constructors can only have a primitive return type4) Constructors are not inheritedAnswer to Question 15)--------------------------------------------------------------------------------Question 16)What will happen when you attempt to compile and run the following class?class Base{Base(int i){System.out.println("Base");}}class Severn extends Base{public static void main(String argv[]){Severn s = new Severn();}void Severn(){System.out.println("Severn");}}1) Compilation and output of the string "Severn" at runtime2) Compile time error3) Compilation and no output at runtime4) Compilation and output of the string "Base"Answer to Question 16)--------------------------------------------------------------------------------Question 17)Which of the following statements are true?1) static methods do not have access to the implicit variable called this2) A static method may be called without creating an instance of its class3) A static method may not be overriden to be non-static4) A static method may not be overloadedAnswer to question 17)--------------------------------------------------------------------------------Question 18)Which of the following will compile without error?1)char c='1';System.out.println(c>>1);2)Integer i=Integer("1");System.out.println(i>>1);3)int i=1;System.out.println(i<<<1);4)int i=1;System.out.println(i<<1);Answer to Question 18)--------------------------------------------------------------------------------Question 19)Which of the following are true?1) A component may have only one event listener attached at a time2) An event listener may be removed from a component3) The ActionListener interface has no corresponding Adapter class4) The processing of an event listener requires a try/catch block Answer to Question 19)--------------------------------------------------------------------------------Question 20)Which of the following are Java keywords?1) sizeof2) main3) transient4) volatileAnswer to Question 20)--------------------------------------------------------------------------------Question 21)Which of the following statements are true?1) The default constructor has a return type of void2) The default constructor takes a parameter of void3) The default constructor takes no parameters4) The default constructor is not created if the class has any constructors of its own. Answer to Question 21)--------------------------------------------------------------------------------Question 22)Which of the following statements are true?1) All of the variables in an interface are implicitly static2) All of the variables in an interface are implicitly final3) All of the methods in an interface are implicitly abstract4) A method in an interface can access class level variablesAnswer to Question 22)--------------------------------------------------------------------------------Question 23)Which of the following statements are true?1 ) The String class is implemented as a char array, elements are addressed using the stringname[] convention2) The + operator is overloaded for concatenation for the String class3) Strings are a primitive type in Java and the StringBuffer is used as the matching wrapper type4) The size of a string can be retrieved using the length propertyAnswer to Question 23)--------------------------------------------------------------------------------Question 24)Which of the following statements are true?1) A method in an interface must not have a body2) A class may extend one other class plus at most one interface3) A class may extends at most one other class plus implement many interfaces4) An class accesses an interface via the keyword usesAnswer to Question 24)--------------------------------------------------------------------------------Question 25)Which of the following statements are true?1) The following statement will produce a result of 1. System.out.println( -1 >>>2);2) Performing an unsigned left shift (<<<) on a negative number will always produce a negative number result3) The following statement will produce a result of zero, System.out.println(1 >>1);4) All the integer primitives in java are signed numbersAnswer to Question 25)--------------------------------------------------------------------------------Question 26)Which of the following statements are true?1) The elements in a Java array can only be of primitive tray can only be of primitive types, not objects2) Arrays are initialized to default values wherever they are created3) An array may be dynamically resized using the setSize method4) You can find out the size of an array using the size methodAnswer to Question 26)--------------------------------------------------------------------------------Question 27)Given the following classpublic class Ombersley{public static void main(String argv[]){boolean b1 = true;if((b1 ==true) || place(true)){System.out.println("Hello Crowle");}}public static boolean place(b public static boolean place(boolean location){if(location==true){System.out.println("Borcetshire");}System.out.println("Powick");return true;turn true;}}What will happen when you attempt to compile and run it?1) Compile time error2) Output of "Hello Crowle"3) Output of Hello Crowle followed by Borcetshire and Powick4) No outputAnswer to Question 27)--------------------------------------------------------------------------------Question 28)You are given a class hierarchy with an instance of the class Dog. The class Dog is a child of mammal and the class Mammal is a child of the class Vertebrate. The class Vertebrate has a method called move which prints out the string "move". The class mammal overrides this method and prints out the string "walks". The class Dog overrides this method and prints out the string "walks on paws". Given an instance of the class Dog,. how can you access the ancestor method move in Vertebrate so it prints out the string "move";1) d.super().super().move();2) d.parent().parent().move();3) d.move();4) none of the above;Answer to Question 28)--------------------------------------------------------------------------------Question 29)Which of the following most closely describes the process of overriding?1) A class with the same name replaces the functionality of a class defined earlier in the hierarchy2) A method with the same name completely replaces the functionality of a method earlier in the hierarchy3) A method with the same name but different parameters gives multiple uses for the same method name4) A class is prevented from accessing methods in its immediate ancestorAnswer to Question 29)--------------------------------------------------------------------------------Question 30)Which of the following statements are true?1) The % is used to calculate a percentage thus: 10 % 20=502) The / operator is used to divide one value by another3) The # symbol may not be used as the first character of a variable4) The $ symbol may not be used as the first character of a variableAnswer to Question 30)--------------------------------------------------------------------------------Question 31)Which of the following statements are true?1) The default layout manager for an Applet is FlowLayout2) The default layout manager for a Frame is FlowLayout3) A layout manager must be assigned to an Applet before the setSize method is called4) The FlowLayout manager attempts to honor the preferred size of any components Answer to Question 31)--------------------------------------------------------------------------------Question 32)Which of the following statements are true about a variable created with the static modifier?1) Once assigned the value of a static variable may not be altered2) A static variable created in a method will keep the same value between calls3) Only one instance of a static variable will exist for any amount of class instances4) The static modifier can only be applied to a primitive valueAnswer to Question 32)--------------------------------------------------------------------------------Question 33)Which of the following statements are true?1) Java uses a system called UTF for I/O to support international character sets2) The RandomAccessFile is the most suitable class for supporting international character sets3) An instance of FileInputStream may not be chained to an instance of FileOutputStream4) File I/O activities requires use of Exception handlingAnswer to Question 33)--------------------------------------------------------------------------------Question 34)What will happen when you attempt to compile and run the following code?import java.io.*;class ExBase{abstract public void martley(){}}public class MyEx extends ExBase{public static void main(String argv[]){DataInputStream fi = new DataInputStream(System.in);try{fi.readChar();}catch(IOException e){System.exit(0);}finally {System.out.println("Doing finally");}}}1) Compile time error2) It will run, wait for a key press and then exit3) It will run, wait for a keypress, print "Doing finally" then exit4) At run and immediately exitAnswer to Question 34)--------------------------------------------------------------------------------Question 35)What will happen when you attempt to compile and run the following codepublic class Borley extends Thread{public static void main(String argv[]){Borley b = new Borley();b.start();}public void run(){System.out.println("Running");}1) Compilation and run but no output2) Compilation and run with the output "Running"3) Compile time error with complaint of no Thread target4) Compile time error with complaint of no access to Thread packageAnswer to Question 35)--------------------------------------------------------------------------------Question 36)Assuming any exception handling has been set up, which of the following will create an instance of the RandomAccessFile class1) RandomAccessFile raf=new RandomAccessFile("myfile.txt","rw");2) RandomAccessFile raf=new RandomAccessFile( new DataInputStream());3) RandomAccessFile raf=new RandomAccessFile("myfile.txt");4) RandomAccessFile raf=new RandomAccessFile( new File("myfile.txt"));Answer to Question 36)--------------------------------------------------------------------------------Question 37)Given the following class definitionpublic class Upton{public static void main(String argv[]){}public void amethod(int i){}//Here}Which of the following would be legal to place after the comment //Here ?1) public int amethod(int z){}2) public int amethod(int i,int j){return 99;}3) protected void amethod(long l){ }4) private void anothermethod(){}Answer to Question 37)--------------------------------------------------------------------------------Question 38)Which of the following statements are true?1) Code must be written if the programmer wants a frame to close on selecting the system close menu2) The default layout for a Frame is the BorderLayout Manager3) The layout manager for a Frame cannot be changed once it has been assigned4) The GridBagLayout manager makes extensive use of the the GridBagConstraints class. Answer to Question 38)--------------------------------------------------------------------------------Question 39)Given the following class definitionpublic class Droitwich{class one{private class two{public void main(){System.out.println("two");}}}}Which of the following statements are true1) The code will not compile because the classes are nested to more than one level2) The code will not compile because class two is marked as private3) The code will compile and output the string two at runtime4) The code will compile without errorAnswer to Question 39)--------------------------------------------------------------------------------Question 40)Given the following codeclass Base{static int oak=99;}public class Doverdale extends Base{public static void main(String argv[]){Doverdale d = new Doverdale();d.amethod();}public void amethod(){//Here}}Which of the following if placed after the comment //Here, will compile and modify the value of the variable oak?1) super.oak=1;2) oak=33;3) Base.oak=22;4) oak=50.1;Answer to Question 40)--------------------------------------------------------------------------------Question 41)You are creating an application that has a form with a text entry field used to enter a persons age. Which of the following is appropriate for capturing this information.1) Use the Text field of a TextField and parse the result using Integer2) Use the getInteger method of the TextField3) Use the getText method of a TextBox and parse the result using the getInt method of Integer class4) Use the getText method of a TextField and use the parseInt method of the Integer class Answer to Question 41)--------------------------------------------------------------------------------Question 42)Given the following declarationInteger i=new Integer(99);How can you now set the value of i to 10?1) i=10;2) i.setValue(10);3) i.parseInt(10);4) none of the aboveAnswer to Question 42)--------------------------------------------------------------------------------Question 43)Which of the following statements are true1) constructors cannot be overloaded2) constructors cannot be overridden3) a constructor can return a primitive or an object reference4) constructor code executes from the current class up the hierarchy to the ancestor class Answer to Question 43)--------------------------------------------------------------------------------Question 44)Given a reference calledtto to a class which extends Thread, which of the following will cause it to give up cycles to allow another thread to execute.1) t.yield();2) yield();3) yield(100); //Or some other suitable amount in milliseconds4) yield(t);Answer to Question 44)--------------------------------------------------------------------------------Question 45)What will happen when you attempt to compile and run the following code?public class Sandys{private int court;public static void main(String argv[]){Sandys s = new Sandys(99);System.out.println(s.court);}Sandys(int ballcount){court=ballcount;}}1) Compile time error, the variable court is defined as private2) Compile time error, s is not initialized when the System.out method is called3) Compilation and execution with no output4) Compilation and run with an output of 99Answer to Question 45)--------------------------------------------------------------------------------Question 46)Which of the following statements are true?1) A method cannot be overloaded to be less public in a child class2) To be overridden a method must have the same name and parameter types3) To be overridden a method must have the same name, parameter and return types4) An overridden method must have the same name, parameter names and parameter typesAnswer to Question 46)--------------------------------------------------------------------------------Question 47)What will happen when you attempt to compile and run the following code?class Base{Base(){System.out.println("Base");}}public class Checket extends Base{public static void main(String argv[]){Checket c = new Checket();super();}Checket(){System.out.println("Checket");}}1) Compile time error2) Checket followed by Base3) Base followed by Checket4) runtime errorAnswer to Question 47)--------------------------------------------------------------------------------Question 48)Which of the following statements are true?1) Static methods cannot be overriden to be non static2) Static methods cannot be declared as private3) Private methods cannot be overloaded4) An overloaded method cannot throw exceptions not checked in the base class Answer to Question 48)--------------------------------------------------------------------------------Question 49)Which of the following statements are true?1) The automatic garbage collection of the JVM prevents programs from ever running out of memory2) A program can suggest that garbage collection be performed but not force it3) Garbage collection is platform independent4) An object becomes eligible for garbage collection when all references denoting it are set to null.Answer to Question 49)--------------------------------------------------------------------------------Question 50)Given the following codepublic class Sytch{int x=2000;public static void main(String argv[]){System.out.println("Ms "+argv[1]+"Please pay $"+x);}}What will happen if you attempt to compile and run this code with the command linejava Sytch Jones Diggle1) Compilation and output of Ms Diggle Please pay $20002) Compile time error3) Compilation and output of Ms Jones Please pay $20004) Compilation but runtime errorAnswer to Question 50)--------------------------------------------------------------------------------Question 51)What will happen when you attempt to compile and run the following codeclass Base{protected int i = 99;}public class Ab{private int i=1;public static void main(String argv[]){Ab a = new Ab();a.hallow();}abstract void hallow(){System.out.println("Claines "+i);}}1) Compile time error2) Compilation and output of Claines 993) Compilation and output of Claines 14) Compilation and not output at runtimeAnswer to Question 51)--------------------------------------------------------------------------------Question 52)You have been asked to create a scheduling system for a hotel and catering organsiation.You have been given the following information and asked to create a set of classes to represent it. On the catering side of the organsiation they haveHead ChefsChefsApprentice ChefsThe system needs to store an employeeid, salary and the holiday entitlementHow would you best represent this information in Javae been given the following information and asked to create a set of classes to represent it.On the catering side of the organsiation they haveHead ChefsChefsApprentice ChefsThe system needs to store an employeeid, salary and the holiday entitlementHow would you best represent this information in Java1) Create classes for Head Chef, Chef, Apprentice Chef and store the other values in fields2) Create an employee class and derive sub classes for Head Chef, Chef, Apprentice Chef and store the other values in fields.3) Create and employee class with fields for Job title and fields for the other values.4) Create classes for all of the items mentioned and create a container class to represent employeesAnswer to Question 52)--------------------------------------------------------------------------------Question 53)You need to read in the lines of a large text file containing tens of megabytes of data. Which of the following would be most suitable for reading in such a file1) new FileInputStream("")2) new InputStreamReader(new FileInputStream(""))3) new BufferedReader(new InputStreamReader(new FileInputStream("")));4) new RandomAccessFile raf=new RandomAccessFile("myfile.txt","+rw");Answer to Question 53)--------------------------------------------------------------------------------Question 54)What will happen when you attempt to compile and run the following code?public class Inc{public static void main(String argv[]){Inc inc = new Inc();int i =0;inc.fermin(i);i = i++;System.out.println(i);}void fermin(int i){i++;}}1) Compile time error2) Output of 23) Output of 14) Output of 0Answer to Question 54)--------------------------------------------------------------------------------Question 55)What will happen when you attempt to compile and run the following code?public class Agg{static public long i=10;public static void main(String argv[]){switch(i){default:System.out.println("no value given");case 1:System.out.println("one");case 10:System.out.println("ten");case 5:System.out.println("five");}}}1) Compile time error2) Output of "ten" followed by "five"3) Output of "ten"4) Compilation and run time error because of location of defaultAnswer to Question 55)。

Java_SCJP_Marcus_Green_SCJP_Exam_2

Java_SCJP_Marcus_Green_SCJP_Exam_2

Java Programmer Certification Mock Exam No 2Last updated 29 Dec 200260 QuestionsCopyright ©Marcus Green 2002Buy Java Certification books containg more mock exams at /bookreviews/jcertbooks.htmThis is my mock Exam No 2 based on the Objectives for the Sun Java Programmers Exam. It was created by Marcus Green(mail@) and may be freely distributed so long as it is unmodified. Please email me if you have any corrections or comments, but please read this document first/homepage/getanswers.htm.If you obtained this exam from some other source please email me to let me know and check out the latest version at .Want to ask a question about this exam?You can post a message on the discussion forum at /discus. You could also send me your question but I get heaps of email and my answer is likely to be slow and brief.It really does come with answersYes, this is a long document (around 35 pages if you were to print it out), if you cannot see the answers then you have not got the entire document, try reloading it untill you can see the answer to Question 60 and the words "End of document". If you cannot load it just keep trying.The answers contain references to approximately which objective the question relates to. If you have a query about any of these questions, please, please include the full answerwith the question. You can jump back from an answer to the question by pressing the back button on your web browser.How does this compare with the real thing?As of 5 Oct 2000 the question format has changed very slightly. You will now get more questions that include snippets of code (though the ratio may be similar to this mock exam). Each question will also tell you how many of the options you need to pick. You can read more about these revisions at/faq/ExamUpdate.htm. You should assume that the real thing will be harder though many people have told me that they get similar marks in the real thing to my exams... You can find a comparison between my exams and some other exams at/Enthuse/jsp/ViewAllResults.jspWhere can you find other Mock Exams?Check out my FAQ at /faq/jcertfaq.htm for links to other mock exams You can check out my first mock exam that contains 60 question at /mockexams/exam1.htmQuestionsQuestion 1)What will happen when you attempt to compile and run this code?abstract class Base{abstract public void myfunc();public void another(){System.out.println("Another method");}}public class Abs extends Base{public static void main(String argv[]){Abs a = new Abs();a.amethod();}public void myfunc(){System.out.println("My Func");}public void amethod(){myfunc();}}1) The code will compile and run, printing out the words "My Func"2) The compiler will complain that the Base class has non abstract methods3) The code will compile but complain at run time that the Base class has non abstract methods4) The compiler will complain that the method myfunc in the base class has no body, nobody at all to looove itAnswer to Question 1Question 2)What will happen when you attempt to compile and run this code?public class MyMain{public static void main(String argv){System.out.println("Hello cruel world");}}1) The compiler will complain that main is a reserved word and cannot be used for a class2) The code will compile and when run will print out "Hello cruel world"3) The code will compile but will complain at run time that no constructor is defined4) The code will compile but will complain at run time that main is not correctly definedAnswer to Question 2Question 3)Which of the following are Java modifiers?1) public2) private3) friendly4) transient5) vagrantAnswer to Question 3Question 4)What will happen when you attempt to compile and run this code?class Base{abstract public void myfunc();public void another(){System.out.println("Another method");}}public class Abs extends Base{public static void main(String argv[]){ Abs a = new Abs();a.amethod();}public void myfunc(){System.out.println("My func"); }public void amethod(){myfunc();}}1) The code will compile and run, printing out the words "My Func"2) The compiler will complain that the Base class is not declared as abstract.3) The code will compile but complain at run time that the Base class has non abstract methods4) The compiler will complain that the method myfunc in the base class has no body, nobody at all to looove itAnswer to Question 4Question 5)Why might you define a method as native?1) To get to access hardware that Java does not know about2) To define a new data type such as an unsigned integer3) To write optimised code for performance in a language such as C/C++4) To overcome the limitation of the private scope of a methodAnswer to Question 5Question 6)What will happen when you attempt to compile and run this code?class Base{public final void amethod(){System.out.println("amethod");}}public class Fin extends Base{public static void main(String argv[]){Base b = new Base();b.amethod();}}1) Compile time error indicating that a class with any final methods must be declared final itself2) Compile time error indicating that you cannot inherit from a class with final methods3) Run time error indicating that Base is not defined as final4) Success in compilation and output of "amethod" at run time.Answer to Question 6Question 7)What will happen when you attempt to compile and run this code?public class Mod{public static void main(String argv[]){}public static native void amethod();}1) Error at compilation: native method cannot be static2) Error at compilation native method must return value3) Compilation but error at run time unless you have made code containing native amethod available4) Compilation and execution without errorAnswer to Question 7Question 8)What will happen when you attempt to compile and run this code?private class Base{}public class Vis{transient int iVal;public static void main(String elephant[]){}}1)Compile time error: Base cannot be private2)Compile time error indicating that an integer cannot be transient3)Compile time error transient not a data type4)Compile time error malformed main methodAnswer to Question 8Question 9)What happens when you attempt to compile and run these two files in the same directory?//File P1.javapackage MyPackage;class P1{void afancymethod(){System.out.println("What a fancy method");}}//File P2.javapublic class P2 extends P1{public static void main(String argv[]){P2 p2 = new P2();p2.afancymethod();}}1) Both compile and P2 outputs "What a fancy method" when run2) Neither will compile3) Both compile but P2 has an error at run time4) P1 compiles cleanly but P2 has an error at compile timeAnswer to Question 9Question 10)You want to find out the value of the last element of an array. You write the following code. What will happen when you compile and run it.?public class MyAr{public static void main(String argv[]){int[] i = new int[5];System.out.println(i[5]);}}1) An error at compile time2) An error at run time3) The value 0 will be output4) The string "null" will be outputAnswer to Question 10Question 11)You want to loop through an array and stop when you come to the last element. Being a good java programmer and forgetting everything you ever knew about C/C++ you know that arrays contain information about their size. Which of the following can you use?1)myarray.length();2)myarray.length;3)myarray.size4)myarray.size();Answer to Question 11Question 12)What best describes the appearance of an application with the following code?import java.awt.*;public class FlowAp extends Frame{public static void main(String argv[]){FlowAp fa=new FlowAp();fa.setSize(400,300);fa.setVisible(true);}FlowAp(){add(new Button("One"));add(new Button("Two"));add(new Button("Three"));add(new Button("Four"));}//End of constructor}//End of Application1) A Frame with buttons marked One to Four placed on each edge.2) A Frame with buutons marked One to four running from the top to bottom3) A Frame with one large button marked Four in the Centre4) An Error at run time indicating you have not set a LayoutManagerAnswer to Question 12Question 13)How do you indicate where a component will be positioned using Flowlayout?1) North, South,East,West2) Assign a row/column grid reference3) Pass a X/Y percentage parameter to the add method4) Do nothing, the FlowLayout will position the componentAnswer to Question 13)Question 14)How do you change the current layout manager for a container1) Use the setLayout method2) Once created you cannot change the current layout manager of a component3) Use the setLayoutManager method4) Use the updateLayout methodAnswer to Question 14)Question 15)Which of the following are fields of the GridBagConstraints class?1) ipadx2) fill3) insets4) widthAnswer to Question 15)Question 16)What most closely matches the appearance when this code runs?import java.awt.*;public class CompLay extends Frame{public static void main(String argv[]){CompLay cl = new CompLay();}CompLay(){Panel p = new Panel();p.setBackground(Color.pink);p.add(new Button("One"));p.add(new Button("Two"));p.add(new Button("Three"));add("South",p);setLayout(new FlowLayout());setSize(300,300);setVisible(true);}}1) The buttons will run from left to right along the bottom of the Frame2) The buttons will run from left to right along the top of the frame3) The buttons will not be displayed4) Only button three will show occupying all of the frameAnswer to Question 16)Question 17)Which statements are correct about the anchor field?1) It is a field of the GridBagLayout manager for controlling component placement2) It is a field of the GridBagConstraints class for controlling component placement3) A valid setting for the anchor field is GridBagConstraints.NORTH4) The anchor field controls the height of components added to a container Answer to Question 17)Question 18)What will happen when you attempt to compile and run the following code?public class Bground extends Thread{public static void main(String argv[]){Bground b = new Bground();b.run();}public void start(){for (int i = 0; i <10; i++){System.out.println("Value of i = " + i);}}}1) A compile time error indicating that no run method is defined for the Thread class2) A run time error indicating that no run method is defined for the Thread class3) Clean compile and at run time the values 0 to 9 are printed out4) Clean compile but no output at runtimeAnswer to Question 18)Question 19)Is the following statement true or false?When using the GridBagLayout manager, each new component requires a new instance of the GridBagConstraints class.1) true2) falseAnswer to Question 19)Question 20)Which most closely matches a description of a Java Map?1) A vector of arrays for a 2D geographic representation2) A class for containing unique array elements3) A class for containing unique vector elements4) An interface that ensures that implementing classes cannot contain duplicate keysAnswer to Question 20)Question 21)How does the set collection deal with duplicate elements?1) An exception is thrown if you attempt to add an element with a duplicate value2) The add method returns false if you attempt to add an element with a duplicate value3) A set may contain elements that return duplicate values from a call to the equals method4) Duplicate values will cause an error at compile timeAnswer to Question 21)Question 22)What can cause a thread to stop executing?1) The program exits via a call to System.exit(0);2) Another thread is given a higher priority3) A call to the thread's stop method.4) A call to the halt method of the Thread class?Answer to Question 22)Question 23)For a class defined inside a method, what rule governs access to the variables of the enclosing method?1) The class can access any variable2) The class can only access static variables3) The class can only access transient variables4) The class can only access final variablesAnswer to Question 23)Question 24)Under what circumstances might you use the yield method of the Thread class1) To call from the currently running thread to allow another thread of the same or higher priority to run2) To call on a waiting thread to allow it to run3) To allow a thread of higher priority to run4) To call from the currently running thread with a parameter designating which thread should be allowed to runAnswer to Question 24)Question 25)What will happen when you attempt to compile and run the following codepublic class Hope{public static void main(String argv[]){Hope h = new Hope();}protected Hope(){for(int i =0; i <10; i ++){System.out.println(i);}}}1) Compilation error: Constructors cannot be declared protected2) Run time error: Constructors cannot be declared protected3) Compilation and running with output 0 to 104) Compilation and running with output 0 to 9Answer to Question 25)Question 26)What will happen when you attempt to compile and run the following codepublic class MySwitch{public static void main(String argv[]){MySwitch ms= new MySwitch();ms.amethod();}public void amethod(){int k=10;switch(k){default: //Put the default at the bottom, not here System.out.println("This is the default output");break;case 10:System.out.println("ten");case 20:System.out.println("twenty");break;}}}1) None of these options2) Compile time error target of switch must be an integral type3) Compile and run with output "This is the default output"4) Compile and run with output of the single line "ten"Answer to Question 26)Question 27)Which of the following is the correct syntax for suggesting that the JVM performs garbage collection1) System.free();2) System.setGarbageCollection();3) System.out.gc();4) System.gc();Answer to Question 27)Question 28)What will happen when you attempt to compile and run the following codepublic class As{int i = 10;int j;char z= 1;boolean b;public static void main(String argv[]){As a = new As();a.amethod();}public void amethod(){System.out.println(j);System.out.println(b);}}1) Compilation succeeds and at run time an output of 0 and false2) Compilation succeeds and at run time an output of 0 and true3) Compile time error b is not initialised4) Compile time error z must be assigned a char valueAnswer to Question 28)Question 29)What will happen when you attempt to compile and run the following code with the command line "hello there"public class Arg{String[] MyArg;public static void main(String argv[]){MyArg=argv;}public void amethod(){System.out.println(argv[1]);}}1) Compile time error2) Compilation and output of "hello"3) Compilation and output of "there"4) None of the aboveAnswer to Question 29)Question 30)What will happen when you attempt to compile and run the following codepublic class StrEq{public static void main(String argv[]){StrEq s = new StrEq();}private StrEq(){String s = "Marcus";String s2 = new String("Marcus");if(s == s2){System.out.println("we have a match");}else{System.out.println("Not equal"); }}}1) Compile time error caused by private constructor2) Output of "we have a match"3) Output of "Not equal"4) Compile time error by attempting to compare strings using ==Answer to Question 30)Question 31)What will happen when you attempt to compile and run the following codeimport java.io.*;class Base{public void amethod()throws FileNotFoundException{} }public class ExcepDemo extends Base{public static void main(String argv[]){ExcepDemo e = new ExcepDemo();}public void amethod(){}protected ExcepDemo(){try{DataInputStream din = newDataInputStream(System.in);System.out.println("Pausing");din.readByte();System.out.println("Continuing");this.amethod();}catch(IOException ioe) {}}}1) Compile time error caused by protected constructor2) Compile time error caused by amethod not declaring Exception3) Runtime error caused by amethod not declaring Exception4) Compile and run with output of "Pausing" and "Continuing" after a key is hit Answer to Question 31)Question 32)What will happen when you attempt to compile and run this programpublic class Outer{public String name = "Outer";public static void main(String argv[]){Inner i = new Inner();i.showName();}//End of mainprivate class Inner{String name =new String("Inner");void showName(){System.out.println(name);}}//End of Inner class}1) Compile and run with output of "Outer"2) Compile and run with output of "Inner"3) Compile time error because Inner is declared as private4) Compile time error because of the line creating the instance of Inner Answer to Question to 32Question 33)What will happen when you attempt to compile and run this code//Demonstration of event handlingimport java.awt.*;import java.awt.event.*;public class MyWc extends Frame implements WindowListener{ public static void main(String argv[]){MyWc mwc = new MyWc();}public void windowClosing(WindowEvent we){System.exit(0);}//End of windowClosingpublic void MyWc(){setSize(300,300);setVisible(true);}}//End of class1) Error at compile time2) Visible Frame created that that can be closed3) Compilation but no output at run time4) Error at compile time because of comment before import statements Answer to Question 33)Question 34)Which option most fully describes will happen when you attempt to compile and run the following codepublic class MyAr{public static void main(String argv[]) {MyAr m = new MyAr();m.amethod();}public void amethod(){static int i;System.out.println(i);}}1) Compilation and output of the value 02) Compile time error because i has not been initialized3) Compilation and output of null4) Compile time errorAnswer to Question 34)Question 35)Which of the following will compile correctly1) short myshort = 99S;2) String name = 'Excellent tutorial Mr Green';3) char c = 17c;4)int z = 015;Answer to Question 35)Question 36)Which of the following are Java key words1)double2)Switch3)then4)instanceofAnswer to Question 36)Question 37)What will be output by the following line?System.out.println(Math.floor(-2.1));1) -22) 2.03) -34) -3.0Answer to Question 37)Question 38)Given the following main method in a class called Cycle and a command line of java Cycle one twowhat will be output?public static void main(String bicycle[]){System.out.println(bicycle[0]);}1) None of these options2) cycle3) one4) twoAnswer to Question 38)Question 39)Which of the following statements are true?1) At the root of the collection hierarchy is a class called Collection2) The collection interface contains a method called enumerator3) The interator method returns an instance of the Vector class4) The Set interface is designed for unique elementsAnswer to Question 39)Question 40)Which of the following statements are correct?1) If multiple listeners are added to a component only events for the last listener added will be processed2) If multiple listeners are added to a component the events will be processed for all but with no guarantee in the order3) Adding multiple listeners to a comnponent will cause a compile time error4) You may remove as well add listeners to a component.Answer to Question 40)Question 41)Given the following codeclass Base{}public class MyCast extends Base{static boolean b1=false;static int i = -1;static double d = 10.1;public static void main(String argv[]){MyCast m = new MyCast();Base b = new Base();//Here}}Which of the following, if inserted at the comment //Here will allow the code to compile and run without error1) b=m;2) m=b;3) d =i;4) b1 =i;Answer to Question 41)Question 42)Which of the following statements about threading are true1) You can only obtain a mutually exclusive lock on methods in a class that extends Thread or implements runnable2) You can obtain a mutually exclusive lock on any object3) A thread can obtain a mutually exclusive lock on an object by calling a method synchronized on that object.4) Thread scheduling algorithms are platform dependentAnswer to Question 42)Question 43)Your chief Software designer has shown you a sketch of the new Computer parts system she is about to create. At the top of the hierarchy is a Class called Computer and under this are two child classes. One is called LinuxPC and one is called WindowsPC.The main difference between the two is that one runs the Linux operating System and the other runs the Windows System (of course another difference is that one needs constant re-booting and the other runs reliably). Under the WindowsPC are two Sub classes one called Server and one Called Workstation. How might you appraise your designers work?1) Give the goahead for further design using the current scheme2) Ask for a re-design of the hierarchy with changing the Operating System to a field rather than Class type3) Ask for the option of WindowsPC to be removed as it will soon be obsolete4) Change the hierarchy to remove the need for the superfluous Computer Class.Answer to Question 43)Question 44)Which of the following statements are true1) An inner class may be defined as static2) There are NO circumstances where an inner class may be defined as private3) A programmer may only provide one constructor for an anonymous class4) An inner class may extend another classAnswer to Question 44)Question 45)What will happen when you attempt to compile and run the following codeint Output=10;boolean b1 = false;if((b1==true) && ((Output+=10)==20)){System.out.println("We are equal "+Output);}elseSystem.out.println("Not equal! "+Output);}1) Compile error, attempting to peform binary comparison on logical data type2) Compilation and output of "We are equal 10"3) Compilation and output of "Not equal! 20"4) Compilation and output of "Not equal! 10"Answer to Question 45)Question 46)Given the following variables which of the following lines will compile without error?String s = "Hello";long l = 99;double d = 1.11;int i = 1;int j = 0;1) j= i <<s;2) j= i<<j;3) j=i<<d;4)j=i<<l;Answer to Question 46)Question 47)What will be output by the following line of code?System.out.println(010|4);2) 03) 64) 12Answer to Question 47)Question 48)Given the following variableschar c = 'c';int i = 10;double d = 10;long l = 1;String s = "Hello";Which of the following will compile without error?1)c=c+i;2)s+=i;3)i+=s;4)c+=s;Answer to Question 48)Question 49)Which of the following will compile without error?1) File f = new File("/","autoexec.bat");2) DataInputStream d = new DataInputStream(System.in);3) OutputStreamWriter o = new OutputStreamWriter(System.out);4) RandomAccessFile r = new RandomAccessFile("OutFile"); Answer to Question 49)Question 50)Given the folowing classes which of the following will compile without error?interface IFace{}class CFace implements IFace{}class Base{}public class ObRef extends Base{public static void main(String argv[]){ObRef ob = new ObRef();Base b = new Base();Object o1 = new Object();IFace o2 = new CFace();}}1)o1=o2;2)b=ob;3)ob=b;4)o1=b;Answer to Question 50)Question 51)Given the following code what will be the output?class ValHold{public int i = 10;}public class ObParm{public static void main(String argv[]){ObParm o = new ObParm();o.amethod();}public void amethod(){int i = 99;ValHold v = new ValHold();v.i=30;another(v,i);System.out.print( v.i );}//End of amethodpublic void another(ValHold v, int i){i=0;v.i = 20;ValHold vh = new ValHold();v = vh;System.out.print(v.i);System.out.print(i);}//End of another}1) 100302) 200303) 2099304) 10020Answer to Question 51)Question 52)Given the following class definition, which of the following methods could be legally placed after the comment//Herepublic class Rid{public void amethod(int i, String s){}//Here}1)public void amethod(String s, int i){}2)public int amethod(int i, String s){}3)public void amethod(int i, String mystring){}4) public void Amethod(int i, String s) {}Answer to Question 52)Question 53)Given the following class definition which of the following can be legally placed after the comment line//Here ?class Base{public Base(int i){}}public class MyOver extends Base{public static void main(String arg[]){MyOver m = new MyOver(10);}MyOver(int i){super(i);}MyOver(String s, int i){this(i);//Here}}1)MyOver m = new MyOver();2)super();3)this("Hello",10);4)Base b = new Base(10);Answer to Question 53)Question 54)Given the following class definition, which of the following statements would be legal after the comment //Hereclass InOut{String s= new String("Between");public void amethod(final int iArgs){int iam;class Bicycle{public void sayHello(){//Here}}//End of bicycle class}//End of amethodpublic void another(){int iOther;}}1) System.out.println(s);2) System.out.println(iOther);3) System.out.println(iam);4) System.out.println(iArgs);Answer to Question 54)Question 55)Which of the following are methods of the Thread class?1) yield()2) sleep(long msec)3) go()4) stop()Answer to Question 55)。

SCJP考试简介

SCJP考试简介

SCJP考试简介●考试方式全英文试题,以电脑作答,在授权的Prometric考试中心参加考试考试编号:310-025先决条件:无考试题型:复选、填空和拖拽匹配题量:59及格标准:61%时限:120分钟费用:1250元●要求具备的能力●使用Java编程语言创建Java应用程序和applets。

●定义和描述垃圾搜集,安全性和Java虚拟机(JVM)。

●描述和使用Java语言面向对象的特点。

●开发图形用户界面(GUI)。

利用Java支持的多种布局治理。

●描述和使用Java的事件处理模式。

●使用Java语言的鼠标输入、文本、窗口和菜单窗口部件。

●使用Java的例外处理来控制程序执行和定义用户自己的例外事件。

●使用Java语言先进的面向对象特点,包括方法重载、方法覆盖、抽象类、接口、final、static和访问控制。

●实现文件的输入/输出(I/O)。

●使用Java语言内在的线程模式来控制多线程。

●使用Java的Sockets机制进行网络通信。

例题1:Choose the three valid identifiers from those listed below.A.IDoLikeTheLongNameClassB.$byteC.constD._okE.3_case解答:A,B,D点评:Java中的标示符必须是字母、美元符($)或下划线(_)开头。

要害字与保留字不能作为标示符。

选项C中的const是Java的保留字,所以不能作标示符。

选项E中的3_case 以数字开头,违反了Java的规则。

例题2:How can you force garbage collection of an object?A.Garbage collection cannot be forcedB.Call System.gc().C.Call System.gc(),passing in a reference to the object to be garbage collected.D.Call Runtime.gc().E.Set all references to the object to new values(null,for example).解答:A点评:在Java中垃圾收集是不能被强迫立即执行的。

2023届四川省大数据精准教学联盟高三第三次联考英语试题

2023届四川省大数据精准教学联盟高三第三次联考英语试题

2023届四川省大数据精准教学联盟高三第三次联考英语试题一、听力选择题1. What will the woman probably do for the man next?A.Call the doctor for him.B.Take him to the hospital.C.Give him some medicine.2. Where did the woman go first?A.The post office.B.Her friend’s home.C.The supermarket3.A.It was hard to get rid of the salesman.B.The products that the salesman was selling were not good.C.The salesman kept making stops on the way.D.It was a waste of time to talk about the products.4. Why does the woman give up buying the coat?A.It is expensive.B.The size doesn’t fit her.C.She doesn’t like the color.5.A.There are different kinds of folders.B.It doesn’t matter which color she uses.C.This decision requires careful thought.D.The color shouldn’t suggest the content.二、听力选择题6. 听下面一段较长对话,回答以下小题。

1. What’s the relationship between the speakers?A.Waiter and customer.B.Professor and student.C.Taxi driver and passenger.2. What do we know about the woman?A.She studied Drama in the U. K.B.She has the same accent as the man.C.She is a tourist.7. 听下面一段较长对话,回答以下小题。

四川省英语三级考试

四川省英语三级考试

SICHUAN COLLEGE ENGLISH TESTA 卷试卷一()密封签由考生亲自启封→注意事项一、将校名、姓名、学校代号、准考证号和试卷代号分别填写在答题纸、试卷二(含填充式听写和作文纸)上。

看清试卷一封面上的试卷代号,你现在做的是A卷,须在答题纸试卷代号栏相应字母A上划线。

划错或不划均判为零分,责任由考生自负。

二·答题前仔细读懂各部分题目的说明要求。

三·多项选择题的答案一定要做在答题纸上,每题仅限一个答案,多选作答错处理。

选定答案后,用2B浓度的铅笔在相应字母的中部划一条横线。

其正确方法是:[A][B][C][D]。

使用其他符号者不给分。

划线的浓度一定要盖过字母底色。

四·如果要改动答案,必须先用橡皮擦净原来选定的答案,然后再按上面的规定重新答题。

五·填充式听写和作文用钢笔或圆珠笔分别按要求写在试卷二中相应的各部分,并保持卷面整洁。

写在其他地方无效。

六·考试时间为120分钟,不得拖延时间。

本试卷做完后,把试卷一、试卷二和答题纸放在桌上,一律不得带走。

待监考人员收完所有试卷后考生方可离开考场。

Part I Listening Comprehension (15%) (20 minutes) Section ADirections: In this section, you will hear 10 short conversations. At the end of each conversation, a question will be asked about what was said. Both theconversation and the question will be spoken twice. After each question therewill be a pause. During the pause you must read the four choices marked A), B),C) and D), and decide which is the best answer. Then mark the correspondingletter on the Answer Sheet with a single line through the center.Example: You will hear:You will read:A) At the office.B) In the waiting room.C) At the airport.D) In a restaurant.From the conversation we know that the two were talking about some work theyhad to finish in the evening. This is most likely to have taken place at the office.Therefore, A) "At the office" is the best answer. You should choose [A] on theAnswer Sheet and mark it with a single line through the center.Sample Answer [A] [B] [C] [D]1. A) They are good friends. C) They met each other before.B) They both are interested in art. D) They both are interested in India.2. A) In a drugstore. B) At a bookstore. C) In the library. D) At the post office.3. A) 6:30. B) 7:00. C) 7:30. D) 8:00.4. A) Policeman and thief. C) Policeman and driver.B) Doctor and patient. D) Teacher and student.5. A) He is studying a hot major. C) He is confident about it.B) He is as scared as the woman. D) He is offered many job openings.6. A) 100. B) 85. C) 50. D) 15.7. A) She didn't want to write her report. C) She didn't want to talk about the concert.B) She didn't like the concert. D) She was busy writing her report.8. A) Susan. B) Linda. C) Anne. D) Angela.9. A) A healthy way of life. C) Whether they should move to Africa.B) A marvelous book on wildlife. D) Whether they once lived in the same city.10. A) No one was killed in a train accident.B) A plane crash killed more than 300 people.C) Over 300 people died in a train accident.D) Over 300 people were injured in a train crash.Section BDirections: In this section, you will hear a short passage. At the end of the passage, you will hear two questions. Both the passage and the questions will be spoken twice.After you hear one question, you must choose the best answer from the fourchoices marked A), B), C) and D). Then mark the corresponding letter on theAnswer Sheet with a single line through the center.PassageQuestions 11 to 12 are based on the passage you have just heard.11. A) The speaker. B) Lisa. C) The parents. D) Neil.12. A) The parents came back. C) The kids continued the party.B) The parents spoiled the party. D) The kids cleaned up the room.Section C Spot Dictation注意:听力理解的C节(Section C)为填充式听写(Spot Dictation), 短文及题目(S1- S6) 在试卷二(Test Paper Two)上。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Question 1)What will happen when you attempt to compile and run this code?abstract class Base{abstract public void myfunc();public void another(){System.out.println("Another method");}}public class Abs extends Base{public static void main(String argv[]){Abs a = new Abs();a.amethod();}public void myfunc(){System.out.println("My Func");}public void amethod(){myfunc();}}1) The code will compile and run, printing out the words "My Func"2) The compiler will complain that the Base class has non abstract methods3) The code will compile but complain at run time that the Base class has non abstract methods4) The compiler will complain that the method myfunc in the base class has no body, nobody at all to looove itAnswer to Question 1--------------------------------------------------------------------------------Question 2)What will happen when you attempt to compile and run this code?public class MyMain{public static void main(String argv){System.out.println("Hello cruel world");}}1) The compiler will complain that main is a reserved word and cannot be used for a class2) The code will compile and when run will print out "Hello cruel world"3) The code will compile but will complain at run time that no constructor is defined4) The code will compile but will complain at run time that main is not correctly defined Answer to Question 2--------------------------------------------------------------------------------Question 3)Which of the following are Java modifiers?1) public2) private3) friendly4) transient5) vagrantAnswer to Question 3--------------------------------------------------------------------------------Question 4)What will happen when you attempt to compile and run this code?class Base{abstract public void myfunc();public void another(){System.out.println("Another method");}}public class Abs extends Base{public static void main(String argv[]){Abs a = new Abs();a.amethod();}public void myfunc(){System.out.println("My func");}public void amethod(){myfunc();}}1) The code will compile and run, printing out the words "My Func"2) The compiler will complain that the Base class is not declared as abstract.3) The code will compile but complain at run time that the Base class has non abstract methods4) The compiler will complain that the method myfunc in the base class has no body, nobody at all to looove itAnswer to Question 4--------------------------------------------------------------------------------Question 5)Why might you define a method as native?1) To get to access hardware that Java does not know about2) To define a new data type such as an unsigned integer3) To write optimised code for performance in a language such as C/C++4) To overcome the limitation of the private scope of a methodAnswer to Question 5--------------------------------------------------------------------------------Question 6)What will happen when you attempt to compile and run this code?class Base{public final void amethod(){System.out.println("amethod");}}public class Fin extends Base{public static void main(String argv[]){Base b = new Base();b.amethod();}}1) Compile time error indicating that a class with any final methods must be declared final itself2) Compile time error indicating that you cannot inherit from a class with final methods3) Run time error indicating that Base is not defined as final4) Success in compilation and output of "amethod" at run time.Answer to Question 6--------------------------------------------------------------------------------Question 7)What will happen when you attempt to compile and run this code?public class Mod{public static void main(String argv[]){}public static native void amethod();}1) Error at compilation: native method cannot be static2) Error at compilation native method must return value3) Compilation but error at run time unless you have made code containing native amethod available4) Compilation and execution without errorAnswer to Question 7--------------------------------------------------------------------------------Question 8)What will happen when you attempt to compile and run this code?private class Base{}public class Vis{transient int iVal;public static void main(String elephant[]){}}1)Compile time error: Base cannot be private2)Compile time error indicating that an integer cannot be transient3)Compile time error transient not a data type4)Compile time error malformed main methodAnswer to Question 8--------------------------------------------------------------------------------Question 9)What happens when you attempt to compile and run these two files in the same directory?//File P1.javapackage MyPackage;class P1{void afancymethod(){System.out.println("What a fancy method");}}//File P2.javapublic class P2 extends P1{afancymethod();}1) Both compile and P2 outputs "What a fancy method" when run2) Neither will compile3) Both compile but P2 has an error at run time4) P1 compiles cleanly but P2 has an error at compile timeAnswer to Question 9--------------------------------------------------------------------------------Question 10)You want to find out the value of the last element of an array. You write the following code. What will happen when you compile and run it.?public class MyAr{public static void main(String argv[]){int[] i = new int[5];System.out.println(i[5]);}}1) An error at compile time2) An error at run time3) The value 0 will be output4) The string "null" will be outputAnswer to Question 10--------------------------------------------------------------------------------Question 11)You want to loop through an array and stop when you come to the last element. Being a good java programmer and forgetting everything you ever knew about C/C++ you know that arrays contain information about their size. Which of the following can you use?1)myarray.length();2)myarray.length;3)myarray.size4)myarray.size();Answer to Question 11--------------------------------------------------------------------------------Question 12)What best describes the appearance of an application with the following code?import java.awt.*;public class FlowAp extends Frame{public static void main(String argv[]){FlowAp fa=new FlowAp();fa.setSize(400,300);fa.setVisible(true);}FlowAp(){add(new Button("One"));add(new Button("Two"));add(new Button("Three"));add(new Button("Four"));}//End of constructor}//End of Application1) A Frame with buttons marked One to Four placed on each edge.2) A Frame with buutons marked One to four running from the top to bottom3) A Frame with one large button marked Four in the Centre4) An Error at run time indicating you have not set a LayoutManagerAnswer to Question 12--------------------------------------------------------------------------------Question 13)How do you indicate where a component will be positioned using Flowlayout?1) North, South,East,West2) Assign a row/column grid reference3) Pass a X/Y percentage parameter to the add method4) Do nothing, the FlowLayout will position the componentAnswer to Question 13)--------------------------------------------------------------------------------Question 14)How do you change the current layout manager for a container1) Use the setLayout method2) Once created you cannot change the current layout manager of a component3) Use the setLayoutManager method4) Use the updateLayout method--------------------------------------------------------------------------------Question 15)Which of the following are fields of the GridBagConstraints class?1) ipadx2) fill3) insets4) widthAnswer to Question 15)--------------------------------------------------------------------------------Question 16)What most closely matches the appearance when this code runs?import java.awt.*;public class CompLay extends Frame{public static void main(String argv[]){CompLay cl = new CompLay();}CompLay(){Panel p = new Panel();p.setBackground(Color.pink);p.add(new Button("One"));p.add(new Button("Two"));p.add(new Button("Three"));add("South",p);setLayout(new FlowLayout());setSize(300,300);setVisible(true);}}1) The buttons will run from left to right along the bottom of the Frame2) The buttons will run from left to right along the top of the frame3) The buttons will not be displayed4) Only button three will show occupying all of the frame--------------------------------------------------------------------------------Question 17)Which statements are correct about the anchor field?1) It is a field of the GridBagLayout manager for controlling component placement2) It is a field of the GridBagConstraints class for controlling component placement3) A valid setting for the anchor field is GridBagConstraints.NORTH4) The anchor field controls the height of components added to a containerAnswer to Question 17)--------------------------------------------------------------------------------Question 18)What will happen when you attempt to compile and run the following code?public class Bground extends Thread{public static void main(String argv[]){Bground b = new Bground();b.run();}public void start(){for (int i = 0; i <10; i++){System.out.println("Value of i = " + i);}}}1) A compile time error indicating that no run method is defined for the Thread class2) A run time error indicating that no run method is defined for the Thread class3) Clean compile and at run time the values 0 to 9 are printed out4) Clean compile but no output at runtimeAnswer to Question 18)--------------------------------------------------------------------------------Question 19)10)When using the GridBagLayout manager, each new component requires a new instance of theGridBagConstraints class. Is this statement1) true2) falseAnswer to Question 19)--------------------------------------------------------------------------------Question 20)Which most closely matches a description of a Java Map?1) A vector of arrays for a 2D geographic representation2) A class for containing unique array elements3) A class for containing unique vector elements4) An interface that ensures that implementing classes cannot contain duplicate keys Answer to Question 20)--------------------------------------------------------------------------------Question 21)How does the set collection deal with duplicate elements?1) An exception is thrown if you attempt to add an element with a duplicate value2) The add method returns false if you attempt to add an element with a duplicate value3) A set may contain elements that return duplicate values from a call to the equals method4) Duplicate values will cause an error at compile timeAnswer to Question 21)--------------------------------------------------------------------------------Question 22)What can cause a thread to stop executing?1) The program exits via a call to System.exit(0);2) Another thread is given a higher priority3) A call to the thread's stop method.4) A call to the halt method of the Thread classAnswer to Question 22)--------------------------------------------------------------------------------Question 23)For a class defined inside a method, what rule governs access to the variables of the enclosing method?1) The class can access any variable2) The class can only access static variables3) The class can only access transient variables4) The class can only access final variablesAnswer to Question 23)--------------------------------------------------------------------------------Question 24)Under what circumstances might you use the yield method of the Thread class1) To call from the currently running thread to allow another thread of the same or higher priority to run2) To call on a waiting thread to allow it to run3) To allow a thread of higher priority to run4) To call from the currently running thread with a parameter designating which thread should be allowed to runAnswer to Question 24)--------------------------------------------------------------------------------Question 25)What will happen when you attempt to compile and run the following codepublic class Hope{public static void main(String argv[]){Hope h = new Hope();}protected Hope(){for(int i =0; i <10; i ++){System.out.println(i);}}}1) Compilation error: Constructors cannot be declared protected2) Run time error: Constructors cannot be declared protected3) Compilation and running with output 0 to 104) Compilation and running with output 0 to 9Answer to Question 25)--------------------------------------------------------------------------------Question 26)What will happen when you attempt to compile and run the following codepublic class MySwitch{public static void main(String argv[]){MySwitch ms= new MySwitch();ms.amethod();}public void amethod(){int k=10;switch(k){default: //Put the default at the bottom, not hereSystem.out.println("This is the default output");break;case 10:System.out.println("ten");case 20:System.out.println("twenty");break;}}}1) None of these options2) Compile time error target of switch must be an integral type3) Compile and run with output "This is the default output"4) Compile and run with output of the single line "ten"Answer to Question 26)--------------------------------------------------------------------------------Question 27)Which of the following is the correct syntax for suggesting that the JVM performs garbage collection1) System.free();2) System.setGarbageCollection();3) System.out.gc();4) System.gc();Answer to Question 27)--------------------------------------------------------------------------------Question 28)What will happen when you attempt to compile and run the following codepublic class As{int i = 10;int j;char z= 1;boolean b;public static void main(String argv[]){As a = new As();a.amethod();}public void amethod(){System.out.println(j);System.out.println(b);}}1) Compilation succeeds and at run time an output of 0 and false2) Compilation succeeds and at run time an output of 0 and true3) Compile time error b is not initialised4) Compile time error z must be assigned a char valueAnswer to Question 28)--------------------------------------------------------------------------------Question 29)What will happen when you attempt to compile and run the following code with the command line "hello there"public class Arg{String[] MyArg;public static void main(String argv[]){MyArg=argv;}public void amethod(){System.out.println(argv[1]);}}1) Compile time error2) Compilation and output of "hello"3) Compilation and output of "there"4) None of the aboveAnswer to Question 29)--------------------------------------------------------------------------------Question 30)What will happen when you attempt to compile and run the following codepublic class StrEq{public static void main(String argv[]){StrEq s = new StrEq();}private StrEq(){String s = "Marcus";String s2 = new String("Marcus");if(s == s2){System.out.println("we have a match");}else{System.out.println("Not equal");}}}1) Compile time error caused by private constructor2) Output of "we have a match"3) Output of "Not equal"4) Compile time error by attempting to compare strings using ==Answer to Question 30)--------------------------------------------------------------------------------Question 31)1) What will happen when you attempt to compile and run the following codeimport java.io.*;class Base{public static void amethod()throws FileNotFoundException{}}public class ExcepDemo extends Base{public static void main(String argv[]){ExcepDemo e = new ExcepDemo();}public static void amethod(){}protected ExcepDemo(){try{DataInputStream din = new DataInputStream(System.in);System.out.println("Pausing");din.readChar();System.out.println("Continuing");this.amethod();}catch(IOException ioe) {}}}1)Compile time error caused by protected constructor2) Compile time error caused by amethod not declaring Exception3) Runtime error caused by amethod not declaring Exception4) Compile and run with output of "Pausing" and "Continuing" after a key is hitAnswer to Question 31)--------------------------------------------------------------------------------Question 32)What will happen when you attempt to compile and run this programpublic class Outer{public String name = "Outer";public static void main(String argv[]){Inner i = new Inner();i.showName();}//End of mainprivate class Inner{String name =new String("Inner");void showName(){System.out.println(name);}}//End of Inner class}1) Compile and run with output of "Outer"2) Compile and run with output of "Inner"3) Compile time error because Inner is declared as private4) Compile time error because of the line creating the instance of Inner Answer to Question to 32--------------------------------------------------------------------------------Question 33)What will happen when you attempt to compile and run this code//Demonstration of event handlingimport java.awt.event.*;import java.awt.*;public class MyWc extends Frame implements WindowListener{ public static void main(String argv[]){MyWc mwc = new MyWc();}public void windowClosing(WindowEvent we){System.exit(0);}//End of windowClosingpublic void MyWc(){setSize(300,300);setVisible(true);}}//End of class1) Error at compile time2) Visible Frame created that that can be closed3) Compilation but no output at run time4) Error at compile time because of comment before import statementsAnswer to Question 33)--------------------------------------------------------------------------------Question 34)Which option most fully describes will happen when you attempt to compile and run the following codepublic class MyAr{public static void main(String argv[]) {MyAr m = new MyAr();m.amethod();}public void amethod(){static int i;System.out.println(i);}}1) Compilation and output of the value 02) Compile time error because i has not been initialized3) Compilation and output of null4) Compile time errorAnswer to Question 34)--------------------------------------------------------------------------------Question 35)Which of the following will compile correctly1) short myshort = 99S;2) String name = 'Excellent tutorial Mr Green';3) char c = 17c;4)int z = 015;Answer to Question 35)--------------------------------------------------------------------------------Question 36)Which of the following are Java key words1)double2)Switch3)then4)instanceofAnswer to Question 36)--------------------------------------------------------------------------------Question 37)What will be output by the following line?System.out.println(Math.floor(-2.1));1) -22) 2.03) -34) -3.0Answer to Question 37)--------------------------------------------------------------------------------Question 38)Given the following main method in a class called Cycle and a command line ofjava Cycle one twowhat will be output?public static void main(String bicycle[]){System.out.println(bicycle[0]);}1) None of these options2) cycle3) one4) twoAnswer to Question 38)--------------------------------------------------------------------------------Question 39)Which of the following statements are true?1) At the root of the collection hierarchy is a class called Collection2) The collection interface contains a method called enumerator3) The interator method returns an instance of the Vector class4) The set interface is designed for unique elementsAnswer to Question 39)--------------------------------------------------------------------------------Question 40)Which of the following statements are correct?1) If multiple listeners are added to a component only events for the last listener added will be processed2) If multiple listeners are added to a component the events will be processed for all but with no guarantee in the order3) Adding multiple listeners to a comnponent will cause a compile time error4) You may remove as well add listeners to a component.Answer to Question 40)--------------------------------------------------------------------------------Question 41)Given the following codeclass Base{}public class MyCast extends Base{static boolean b1=false;static int i = -1;static double d = 10.1;public static void main(String argv[]){MyCast m = new MyCast();Base b = new Base();//Here}}Which of the following, if inserted at the comment //Here will allow the code to compile and run without error1) b=m;2) m=b;3) d =i;4) b1 =i;Answer to Question 41)--------------------------------------------------------------------------------Question 42)Which of the following statements about threading are true1) You can only obtain a mutually exclusive lock on methods in a class that extends Thread or implements runnable2) You can obtain a mutually exclusive lock on any object3) A thread can obtain a mutually exclusive lock on a synchronized method of an object4) Thread scheduling algorithms are platform dependentAnswer to Question 42)--------------------------------------------------------------------------------Question 43)Your chief Software designer has shown you a sketch of the new Computer parts system she is about to create. At the top of the hierarchy is a Class called Computer and under this are two child classes. One is called LinuxPC and one is called WindowsPC.The main difference between the two is that one runs the Linux operating System and the other runs the Windows System (of course another difference is that one needs constant re-booting and the other runs reliably). Under the WindowsPC are two Sub classes one called Server and one Called Workstation. How might you appraise your designers work?1) Give the goahead for further design using the current scheme2) Ask for a re-design of the hierarchy with changing the Operating System to a field rather than Class type3) Ask for the option of WindowsPC to be removed as it will soon be obsolete4) Change the hierarchy to remove the need for the superfluous Computer Class.Answer to Question 43)--------------------------------------------------------------------------------Question 44)Which of the following statements are true1) An inner class may be defined as static2) There are NO circumstances where an inner class may be defined as private3) An anonymous class may have only one constructor4) An inner class may extend another classAnswer to Question 44)--------------------------------------------------------------------------------Question 45)What will happen when you attempt to compile and run the following codeint Output=10;boolean b1 = false;if((b1==true) && ((Output+=10)==20)){System.out.println("We are equal "+Output);}else{System.out.println("Not equal! "+Output);}1) Compile error, attempting to peform binary comparison on logical data type2) Compilation and output of "We are equal 10"3) Compilation and output of "Not equal! 20"4) Compilation and output of "Not equal! 10"Answer to Question 45)--------------------------------------------------------------------------------Question 46)Given the following variables which of the following lines will compile without error?String s = "Hello";long l = 99;double d = 1.11;int i = 1;int j = 0;1) j= i <Answerto Question 46)--------------------------------------------------------------------------------Question 47)What will be output by the following line of code?System.out.println(010|4);1) 142) 03) 64) 12Answerto Question 47)--------------------------------------------------------------------------------Question 48)Given the following variableschar c = 'c';int i = 10;double d = 10;long l = 1;String s = "Hello";Which of the following will compile without error?1)c=c+i; 2)s+=i; 3)i+=s; 4)c+=s;Answerto Question 48)--------------------------------------------------------------------------------Question 49)Which of the following will compile without error?1) File f = new File("/","autoexec.bat");2) DataInputStream d = newDataInputStream(System.in);3) OutputStreamWriter o = new OutputStreamWriter(System.out);4) RandomAccessFile r = new RandomAccessFile("OutFile");Answerto Question 49)--------------------------------------------------------------------------------Question 50)Given the folowing classes which of the following will compile without error?interface IFace{}class CFace implements IFace{}class Base{}public class ObRef extends Base{public static void main(String argv[]){ObRef ob = new ObRef();Base b = new Base();Object o1 = new Object();IFace o2 = new CFace();}}1)o1=o2;2)b=ob;3)ob=b;4)o1=b;Answerto Question 50)--------------------------------------------------------------------------------Question 51)Given the following code what will be the output?class ValHold{ public int i = 10;}public class ObParm{public static void main(String argv[]){ObParm o = new ObParm();o.amethod();}public void amethod(){int i = 99;ValHold v = new ValHold();v.i=30;another(v,i);System.out.println(v.i);}//End of amethodpublic void another(ValHold v, int i){i=0;v.i = 20;ValHold vh = new ValHold();v = vh;System.out.println(v.i+ " "+i);}//End of another}1) 10,0, 302) 20,0,303) 20,99,304) 10,0,20Answerto Question 51)--------------------------------------------------------------------------------Question 52)Given the following class definition, which of the following methods could be legally placed after the comment//Herepublic class Rid{public void amethod(int i, String s){}//Here}1)public void amethod(String s, int i){}2)public int amethod(int i,String s){} 3)public void amethod(int i, String mystring){} 4) publicvoid Amethod(int i, String s) {}Answerto Question 52)--------------------------------------------------------------------------------Question 53)Given the following class definition which of the following can be legally placed after the comment line//Here ?class Base{public Base(int i){}}public class MyOver extends Base{public static void main(String arg[]){MyOver m = new MyOver(10);}MyOver(int i){。

相关文档
最新文档