Informatics Practice Quiz: Exam!

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Sunithasoj
S
Sunithasoj
Community Contributor
Quizzes Created: 1 | Total Attempts: 454
| Attempts: 454 | Questions: 10
Please wait...
Question 1 / 10
0 %
0/100
Score 0/100
1. Observe the given code: int ctr=10; while(ctr>5) { ctr=ctr-2; }                       How many times the above given loop will run?

Explanation

The given code initializes the variable ctr to 10. The while loop condition checks if ctr is greater than 5. Since 10 is greater than 5, the loop will run for the first time. Inside the loop, ctr is decremented by 2, so its value becomes 8. The loop condition is still true, so the loop runs for the second time. ctr is again decremented by 2, making its value 6. The loop condition is still true, so the loop runs for the third time. ctr is decremented by 2 again, making its value 4. Now, the loop condition becomes false as 4 is not greater than 5, so the loop does not run anymore. Therefore, the loop runs 3 times.

Submit
Please wait...
About This Quiz
Informatics Practice Quiz: Exam! - Quiz

The Informatics Practice Quiz: Exam assesses knowledge in Java programming, focusing on swing controls, operators, loops, and switch-case statements. It is designed to test practical skills in handling... see moreJava GUI components and understanding control flow, enhancing students' readiness for advanced computer science applications. see less

2. Study the following code and answer the questions that follow: String str="Green World, Clean World"; int len=str.length(),remain; remain=100-len; TextField3.setText(Integer.toString(remain)+" more characters can be entered");

Explanation

The code first calculates the length of the string "Green World, Clean World" and stores it in the variable "len". It then subtracts the length from 100 to find the remaining number of characters that can be entered. Finally, it sets the text of TextField3 to the value of "remain" concatenated with the string " more characters can be entered". Since the length of the string is 24, the value of "remain" is 100 - 24 = 76. Therefore, the correct answer is "76 more characters can be entered".

Submit
3. Shiva has placed two radio buttons on a payment form designed in NetBeans to accept a mode of payment one out of cash or card. To his surprise, during runtime, a customer is able to select both options for a single transaction. Solution for the above problem.

Explanation

Setting the Button group property ensures that only one radio button can be selected at a time. This means that when the customer selects one option, the other option will automatically be deselected. This prevents the customer from selecting both options for a single transaction.

Submit
4. Name the assignment operator used in Java.

Explanation

The assignment operator used in Java is "=" which is used to assign a value to a variable.

Submit
5. Name the control which is not directly editable during run time.

Explanation

The jLabel control is not directly editable during runtime. It is a non-editable component that is used to display text or images on a form. Unlike jTextArea, jCheckBox, and jRadioButton, which can be interacted with and edited by the user, the jLabel control is typically used for displaying static information or labels on a form.

Submit
6. What will be an output of the following code if value of variable application is 1? switch (application) { case 0 : jTextField1.setText("RDBMS");   case 1 : jTextField1.setText("BROWSER");   case 2 : jTextField1.setText("OS");     break;   case 3 : jTextField1.setText("PHOTO EDITOR"); break;   default : jTextField1.setText("Application Software"); break;

Explanation

The output of the code will be "OS" because the value of the variable "application" is 1, and according to the switch statement, when the value is 1, it will execute the code block for case 1. In this case, it will set the text of the jTextField1 to "BROWSER". However, there are no break statements after each case, so the code will continue to execute the code block for case 2 as well, setting the text of jTextField1 to "OS".

Submit
7. Name any two methods of string class.

Explanation

The given correct answer lists two methods of the string class, which are length() and substring(). The length() method is used to determine the length of a string, while the substring() method is used to extract a portion of a string based on specified indices. These methods are commonly used in string manipulation and are essential for performing various operations on strings.

Submit
8. Prachi is working with the following swing controls: jButton, jLabel, jTextField, jCheckBox. Suggest her any two basic methods commonly available with all the four controls mentioned above.

Explanation

The two basic methods commonly available with all the four swing controls mentioned above are setText() and setVisible(). The setText() method is used to set the text content of a control, such as a button or a label. The setVisible() method is used to set the visibility of a control, making it either visible or invisible.

Submit
9. Which of the following are open standards? .OGG .DOC .BMP .ODF

Explanation

The correct answer is OGG and ODF. OGG is an open standard for audio file formats, while ODF is an open standard for document file formats. BMP and DOC, on the other hand, are not open standards. BMP is a raster graphics image file format owned by Microsoft, and DOC is a file format used for Microsoft Word documents.

Submit
10. Name the method which implements method overloading.

Explanation

The method that implements method overloading in this case is substring(). Method overloading occurs when a class has multiple methods with the same name but different parameters. In the case of substring(), there are multiple versions of the method that can be called depending on the parameters provided. This allows for flexibility and versatility in how the method can be used.

Submit
View My Results

Quiz Review Timeline (Updated): Mar 19, 2023 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 19, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Apr 18, 2020
    Quiz Created by
    Sunithasoj
Cancel
  • All
    All (10)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
Observe the given code:...
Study the following code and answer the questions that follow:...
Shiva has placed two radio buttons on a payment form designed in...
Name the assignment operator used in Java.
Name the control which is not directly editable during run time.
What will be an output of the following code if value of variable...
Name any two methods of string class.
Prachi is working with the following swing controls:...
Which of the following are open standards? .OGG .DOC .BMP .ODF
Name the method which implements method overloading.
Alert!

Advertisement