SlideShare a Scribd company logo
How many times will the following code print "Welcome to Java"? int count = 0; while
(count
Solution
Ans)
15) D.10
public class MultiQues {
public static void main(String[] args) {
// TODO Auto-generated method stub
int count = 0;
while(count < 10){
System.out.println("welcome to java");
count++;
}
}
}
16) E.45
public class MultiQues {
public static void main(String[] args) {
// TODO Auto-generated method stub
int y = 0;
for(int i=0;i<10;++i){
y+=i;
}
System.out.println(y);
}
}
17) B.10
public class MultiQues {
public static void main(String[] args) {
// TODO Auto-generated method stub
int y = 0;
int i=0;
for(i=0;i<10;++i){
y+=i;
}
System.out.println(i);
}
}
18) B.n
There are n iterations for the given for loop because it is given that i=1 to i <= n so there
aren iterations.
19) C.n-1
Here for loop starts from i=1 to i

More Related Content

PDF
C++ Certified Associate Programmer CPA
PPTX
RxJS ‘Marble’ programming
PDF
1z0 851 exam-java standard edition 6 programmer certified professional
PDF
Oop Presentation
PDF
Basic program in java
PDF
Revisão OCPJP7 - Class Design (parte 02)
PDF
Fnt software solutions placement paper
C++ Certified Associate Programmer CPA
RxJS ‘Marble’ programming
1z0 851 exam-java standard edition 6 programmer certified professional
Oop Presentation
Basic program in java
Revisão OCPJP7 - Class Design (parte 02)
Fnt software solutions placement paper

Similar to How many times will the following code print Welcome to Java in.pdf (20)

PDF
Generic programming
PDF
Java and j2ee_lab-manual
PPTX
(Rx).NET' way of async programming (.NET summit 2017 Belarus)
PDF
JVM Mechanics: When Does the JVM JIT & Deoptimize?
PDF
Java MCQ Questions and Answers PDF By ScholarHat
PDF
Improving Java performance at JBCNConf 2015
DOCX
informatics practices practical file
PDF
C# programs
PPTX
Puzles C#
DOCX
Wap to implement bitwise operators
PPTX
Java parallel programming made simple
PDF
C++11 concurrency
PDF
Java doc Pr ITM2
PDF
C++17 not your father’s c++
PDF
Array notes
PDF
PPTX
05A_Java_in yemen adenProgramming_IT.pptx
PDF
Improving Android Performance at Droidcon UK 2014
PPT
Initial Java Core Concept
Generic programming
Java and j2ee_lab-manual
(Rx).NET' way of async programming (.NET summit 2017 Belarus)
JVM Mechanics: When Does the JVM JIT & Deoptimize?
Java MCQ Questions and Answers PDF By ScholarHat
Improving Java performance at JBCNConf 2015
informatics practices practical file
C# programs
Puzles C#
Wap to implement bitwise operators
Java parallel programming made simple
C++11 concurrency
Java doc Pr ITM2
C++17 not your father’s c++
Array notes
05A_Java_in yemen adenProgramming_IT.pptx
Improving Android Performance at Droidcon UK 2014
Initial Java Core Concept
Ad

More from bhim1213 (20)

PDF
In 1998, Congress passed legislation concerning shifting the burden .pdf
PDF
If A denotes some event, what does A denote If P(A)equals=0.997, wh.pdf
PDF
How do neutrophils find and get to an infectionSolutionNeutro.pdf
PDF
From your own words not copy past from internet please Talked about.pdf
PDF
Forms an important part of the subunits of the ribosome. The _ are sp.pdf
PDF
During DNA replication, a series of steps are required to ensure tha.pdf
PDF
Disease X occurs when someone has the xx genotype. However, only 20 .pdf
PDF
Darwins Theory had five main tenets (or components), what are they.pdf
PDF
Define toxic shock syndrome (TSS) impetigo MRSASolutionAnswer.pdf
PDF
A system was set up in parallel with two components, A and B. The pr.pdf
PDF
All content is made permanent for future use. All content will be lo.pdf
PDF
a. A waitress is serving 5 people at a table. She has the 5 dishes t.pdf
PDF
Biochemistry homework Focus concept ripening fruit and the activity.pdf
PDF
A process that has its representative PCB in a device queue is in th.pdf
PDF
Which of the following statements is (are) trueI Cash flow is a.pdf
PDF
What is the relationship of the epithelium of the epidermis to the co.pdf
PDF
What is a linked listWhat is a linked lists general syntaxCan .pdf
PDF
What is the output of running class GenericMethodDemo of the followi.pdf
PDF
What do you think are the roles of professional societies in contemp.pdf
PDF
What is the compensation depth for phytoplankton How does it differ .pdf
In 1998, Congress passed legislation concerning shifting the burden .pdf
If A denotes some event, what does A denote If P(A)equals=0.997, wh.pdf
How do neutrophils find and get to an infectionSolutionNeutro.pdf
From your own words not copy past from internet please Talked about.pdf
Forms an important part of the subunits of the ribosome. The _ are sp.pdf
During DNA replication, a series of steps are required to ensure tha.pdf
Disease X occurs when someone has the xx genotype. However, only 20 .pdf
Darwins Theory had five main tenets (or components), what are they.pdf
Define toxic shock syndrome (TSS) impetigo MRSASolutionAnswer.pdf
A system was set up in parallel with two components, A and B. The pr.pdf
All content is made permanent for future use. All content will be lo.pdf
a. A waitress is serving 5 people at a table. She has the 5 dishes t.pdf
Biochemistry homework Focus concept ripening fruit and the activity.pdf
A process that has its representative PCB in a device queue is in th.pdf
Which of the following statements is (are) trueI Cash flow is a.pdf
What is the relationship of the epithelium of the epidermis to the co.pdf
What is a linked listWhat is a linked lists general syntaxCan .pdf
What is the output of running class GenericMethodDemo of the followi.pdf
What do you think are the roles of professional societies in contemp.pdf
What is the compensation depth for phytoplankton How does it differ .pdf
Ad

Recently uploaded (20)

PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
Insiders guide to clinical Medicine.pdf
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
Computing-Curriculum for Schools in Ghana
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
RMMM.pdf make it easy to upload and study
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
PPH.pptx obstetrics and gynecology in nursing
PPTX
Final Presentation General Medicine 03-08-2024.pptx
102 student loan defaulters named and shamed – Is someone you know on the list?
Insiders guide to clinical Medicine.pdf
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Renaissance Architecture: A Journey from Faith to Humanism
2.FourierTransform-ShortQuestionswithAnswers.pdf
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Microbial disease of the cardiovascular and lymphatic systems
Anesthesia in Laparoscopic Surgery in India
Computing-Curriculum for Schools in Ghana
Module 4: Burden of Disease Tutorial Slides S2 2025
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
RMMM.pdf make it easy to upload and study
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPH.pptx obstetrics and gynecology in nursing
Final Presentation General Medicine 03-08-2024.pptx

How many times will the following code print Welcome to Java in.pdf

  • 1. How many times will the following code print "Welcome to Java"? int count = 0; while (count Solution Ans) 15) D.10 public class MultiQues { public static void main(String[] args) { // TODO Auto-generated method stub int count = 0; while(count < 10){ System.out.println("welcome to java"); count++; } } } 16) E.45 public class MultiQues { public static void main(String[] args) { // TODO Auto-generated method stub int y = 0; for(int i=0;i<10;++i){ y+=i; } System.out.println(y); } } 17) B.10 public class MultiQues { public static void main(String[] args) { // TODO Auto-generated method stub int y = 0; int i=0; for(i=0;i<10;++i){ y+=i;
  • 2. } System.out.println(i); } } 18) B.n There are n iterations for the given for loop because it is given that i=1 to i <= n so there aren iterations. 19) C.n-1 Here for loop starts from i=1 to i