Answer:
It throws an error.
the public class needs a name.
like this:
public class G{ public static void main(String[] args) {
int x=5 , y = 10;
if (x>5 && y>=2) System.out.println("Class 1");
else if (x<14 || y>5) System.out.println(" Class 2");
else System.out.println(" Class 3"); }// end of main
}
if you give the class a name and format it, you get:
Class 2
Explanation:
If you want a user to actively participate in an online activity, create a web ______________.
1. animation
2. application
<u>3. page </u>
4. source
Answer:
Enter a number: 7
Enter a number: 10
Traceback (most recent call last):
File "main.py", line 3, in <module>
print (numi + num2)
NameError: name 'numi' is not defined
Explanation:
The typo in the print statement causes a run-time error, where obviously num1+num2 was expected, and an output of 17.
Answer:
Follows are the method definition to this question:
void Reverse_Order(struct Node* h)//defining a recursive method Reverse_Order that takes structure in parameter
{
if (h == NULL)//use if block to check head equal to null
return;//use return keyword
Reverse_Order(h->next);//call method recursively
cout<<h->data;//print data
}
Explanation:
In the above code, a recursive method "Reverse_Order" takes structure as the parameter, and inside the method, structure variable h is used that uses the if conditional statement to check the header equal to null.
In the condition is true, it will use the return keyword, and in the next step, it calls the method recursively, and print its value in the reverse order.
Answer:
Differences between Object Oriented Programming and Structured Programming
1. Structured programming focuses on process/logic then data while OOP(Object Oriented programming) focuses on data.
2.OOP supports Inheritance,Encapsulation,Abstraction,Polymorphism while structured programming does not supports these.
3.Structured programming follows top-down approach while OOP follows bottom-up approach.
4.OOP is more secured than structured programming because it supports Abstraction (data hiding).