What is the difference between break and continue?

1 Answer

Answer :

A: break keyword stops the complete loop and takes the control out of the loop, whereas, the continue keyword just stops the current iteration and takes the control to the next iteration.

Related questions

Description : Which of the following do not represent legal flow control statements? A) break; B) return; C) exit(); D) continue outer;

Last Answer : C) exit();

Description : Which of the following do not represent legal flow control statements? A) break; B) return; C) exit(); D) continue outer;

Last Answer : C) exit();

Description : By using ................... you can force immediate termination of a loop, by passing the conditional expression and any remaining code in the body of the loop. A) Break B) Continue C) Terminate D) Loop Close

Last Answer : A) Break

Description : In java, ............. can only test for equality, where as ............ can evaluate any type of the Boolean expression. A) switch, if B) if, switch C) if, break D) continue, if

Last Answer : A) switch, if

Description : Match the following HTTP status code to their respective definitions. i) 400 a) OK ii) 500 b) Not found iii) 200 c) Continue iv) 100 d) Internal server error A) i-b, ii-d, iii-a, iv-c B) i-a, ii-b, iii-c, iv-d C) i-b, ii-c, iii-a, iv-d D) i-b, ii-a, iii-c, iv-d

Last Answer : A) i-b, ii-d, iii-a, iv-c

Description : Match the following HTTP status code to their respective definitions. i) 400 a) OK ii) 500 b) Not found iii) 200 c) Continue iv) 100 d) Internal server error A) i-b, ii-d, iii-a, iv-c B) i-a, ii-b, iii-c, iv-d C) i-b, ii-c, iii-a, iv-d D) i-b, ii-a, iii-c, iv-d

Last Answer : A) i-b, ii-d, iii-a, iv-c

Description : Define what is the difference between break and continue statement?

Last Answer : The break statement is used to terminate the current enclosing loop or conditional statements in which it appears. We have already used the break statement to come out of switch statements. The ... statement stops the current iteration and simply returns control back to the top of the loop.

Description : What is the purpose of Ctrl + I shortcut key in MS - Word: a) It converts selected text into the next larger size of the same font. b) It applies the Italic formatting to the selected text. c) It makes the selected text bold d) It adds a line break to the document. e) None of The Above

Last Answer : b) It applies the Italic formatting to the selected text.

Description : break statement is used to i) get out of method ii) end aprogram iii) get out of a loop iv) get out of the system A) 1 & 2 B) 1,2 & 3 C) 1 & 3 D) 3

Last Answer : D) 3

Description : Which of the following keywords are used to control access to a class member? A) default B) break C) protected D) goto

Last Answer : C) protected

Description : What is the output of the following? i = 0 while i < 5: print(i) i += 1 if i == 3: break else: print(0) a) 0 1 2 0 b) 0 1 2 c) error d) none of the mentioned

Last Answer : b) 0 1 2

Description : What is the output of the following? True = False while True: print(True) break a) True b) False c) None d) none of the mentioned

Last Answer : b) False

Description : What is the output of the following? i = 1 while False: if i%2 == 0: break print(i) i += 2 a) 1 b) 1 3 5 7 … c) 1 2 3 4 … d) none of the mentioned

Last Answer : d) none of the mentioned

Description : What is the output of the following? i = 2 while True: if i%3 == 0: break print(i) i += 2 a) 2 4 6 8 10 … b) 2 4 c) 2 3 d) error

Last Answer : b) 2 4

Description : What is the output of the following? i = 1 while True: if i%2 == 0: break print(i) i += 2 a) 1 Page No 13 b) 1 2 c) 1 2 3 4 5 6 … d) 1 3 5 7 9 11 …

Last Answer : d) 1 3 5 7 9 11 …

Description : What is the output of the following? i = 5 while True: if i%0O9 == 0: break print(i) i += 1 a) 5 6 7 8 b) 5 6 7 8 9 c) 5 6 7 8 9 10 11 12 13 14 15 …. d) error

Last Answer : d) error

Description : hat is the output of the following? i = 5 while True: if i%0O11 == 0: Page No 12 break print(i) i += 1 a) 5 6 7 8 9 10 b) 5 6 7 8 c) 5 6 d) error

Last Answer : b) 5 6 7 8

Description : What is the output of the following? i = 1 while True: if i%0O7 == 0: break print(i) i += 1 a) 1 2 3 4 5 6 b) 1 2 3 4 5 6 7 c) error d) none of the mentioned

Last Answer : a) 1 2 3 4 5 6

Description : What is the output of the following? i = 1 Page No 11 while True: if i%3 == 0: break print(i) i + = 1 a) 1 2 b) 1 2 3 c) error d) none of the mentioned

Last Answer : c) error

Description : Describe Jump statements: break, continue, and goto. 

Last Answer : Break terminates a loop or switch. Continue jumps to the next iteration of an enclosing iteration statement. Goto jumps to a labelled statement.

Description : The statement is used to transfer the control to the end of statement block in a loop. a. Continue b. Break c. Switch d. Goto

Last Answer : b. Break

Description : A subroutine called by another subroutine is called: a. Nested b. For loop c. Break d. Continue

Last Answer : a. Nested

Description : Illustrate the use of break and continue statement with example.

Last Answer : Break: It breaks the execution of the loop which allows exiting from any loop or switch, such that break statement skips the remaining part of current iterations of the loop.  Syntax: ... then execution control will skip remaining statements of loop & will start next iteration of loop 

Description : What is the difference between a sequential file and a random file?

Last Answer : Ans: Sequential file access is the method employed in tape drives where the files are access in a sequential manner. So if you have to get a file in the end of the tape you have to start ... Disks and Optical drives, wherever the files is placed it will go to that particular place and retrieve it.

Description : What is the difference between Call by value and Call by reference?

Last Answer : A: Call By Value : When a function is called by value, then the value of the actual parameter is copied to the formal parameter (i.e. a separate copy is made). Any changes made with the ... with the values at that address of the formal parameter affects (changes) the value of the actual parameter.

Description : What is the difference between naming conventions and naming rules?

Last Answer : A: Violating naming rules will result in a syntax error, whereas, violating naming conventions will not result in any error.

Description : What is the difference between keywords and reserved words?

Last Answer : A: Keywords have a special meaning in a language, and are part of the syntax. Reserved words are words that cannot be used as identifiers (variables, functions, etc.), because they are reserved by the ... goto is a reserved word but not a keyword (as a consequence, you cannot use it at all)

Description : What is the difference between linear and binary search?

Last Answer : A: Linear search does not require the array to be sorted, whereas, binary search requires that the array be sorted. Linear search checks for the search item in a linear fashion from the beginning cell till the end, ... tell what is control variable in your loop. So if your loop is for(int i = 1; i

Description : What is the difference between selection sort and bubble sort?

Last Answer : A: In selection sort, successive rounds are executed to select the element which is required to be placed in their sorted position, whereas, in bubble sort, every consecutive pairs of elements are compared ... element at every pass, whereas, in bubble sort we get the largest element in every pass.

Description : What is the difference between length() and length?

Last Answer : A: length() function is used to find the number of characters present in a String, whereas, length keyword is used to find the number if cells in an array.

Description : What is the difference between function overloading and function overriding?

Last Answer : A: In function overloading only the function name is same but function signature (list of parameters) is different, whereas, in function overriding both the function name as well as function ... is an example of static polymorphism, whereas, function overriding is an example of dynamic polymorphism.

Description : What is the difference between recursion and iteration?

Last Answer : A: Recursion is usually slower than iteration due to overhead of maintaining stack, whereas, Iteration does not use stack so it's faster than recursion. Recursion uses more memory than ... whereas, Iteration consume less memory. Recursion makes code smaller, whereas, Iteration makes code longer.

Description : What is the difference between do-while and while?

Last Answer : A: do-while lop is exit controlled (i.e. condition is checked at the exit) and runs at least once even if the condition is false whereas, while loop is entry controlled (i.e. condition is checked at the entry) and does not run even once if the condition is false.

Description : What is the difference between for and while?

Last Answer : A: The difference lies in the way they are commonly used. for loop is commonly used when the number of iterations are known whereas, while loop is commonly used when the number of iterations are not known.

Description : What is the difference between if and switch?

Last Answer : A: (a) if can compare conditions for all data types whereas, switch can only check integers and characters. (b) all kinds of relations can be checked using if whereas only equality relation can be checked using switch.

Description : What is the difference between casting and coercion?

Last Answer : A: Type Casting refers to Explicit type conversion i.e. When the conversion takes place with the programmer’s intervention, whereas, Coercion refers to Implicit type conversion i.e. When the conversion takes place on its own without the programmer’s intervention.

Description : What is the difference between throws and throw?

Last Answer : A: Using throws keyword, we can give system defined error message if any error occurs, while using throw keyword, we can force an exception and give user-defined error messages.

Description : What is the difference between print() and println() methods?

Last Answer : A: The print() functions prints a line and the control remains on the same line, whereas, the println() function prints a line and the control moves on to the next line.

Description : Methods can be overloaded with a difference only in the type of the return value .. A) Not supported B) False C) True D) None of the above

Last Answer : B) False

Description : _____ produces the relation that has attributes of R1 and R2 (A) Cartesian product (B) Difference (C) Intersection (D) Product

Last Answer : A) Cartesian product

Description : The essential difference between traps and interrupts is (A) traps are asynchronous and interrupts are synchronous with the program (B) traps are synchronous and interrupts are asynchronous with the program ( ... synchronous and interrupts are asynchronous with the I/O devices. (D) None of these.

Last Answer : (B) traps are synchronous and interrupts are asynchronous with the program

Description : A tree with n vertices is called graceful, if its vertices can be labelled with integers 1, 2, ...,n such that the absolute value of the difference of the labels of adjacent vertices are all different. Which of the following trees are ... (B) (b) and (c) (C) (a) and (c) (D) (a), (b) and (c)

Last Answer : Answer: D

Description : ECL is the fastest of all logic families. High Speed in ECL is possible because transistors are used in difference amplifier configuration, in which they are never driven into ............... (1) Race condition (2) Saturation (3) Delay (4) High impedance

Last Answer : Answer: 2  Explanation: Emitter-coupled logic (ECL) is the fastest of all logic families and therefore is used in applications where very high speed is essential. High speeds have become ... configuration, in which they are never driven into saturation and thereby the storage time is eliminated.

Description : What is the difference between continue statement and goto statement ?

Last Answer : continue statement The continue statement is used to repeat a statement or loop conditionally or unconditionally . You can only jump to the top using the continue statement. can't work without continue statement if, ... . The goto statement can work directly without if, else if, for, while etc.

Description : According to the accepted concept of hormone action, if receptor molecules are removed from target organs, then the target organ will (a) continue to respond to the hormone without any difference ( ... require higher concentration (d) continue to respond to the hormone but in the opposite way.

Last Answer : (b) not respond to the hormone