)When the inher C+). a. Inaccessible b.. Accessible
Q: Write a w the following
A: The header file <bits/stdc++.h> is declared which contains all the standard libraries. Declare…
Q: We can activate Extend commend by -2 .using the Keyboard . + Enter e ext ex
A: 3)ex EXTEND / Extends objects to meet the edges of other objects
Q: Th e following sta tement should determine if x has a value other than 1 or 2.What is wrong with…
A: Value should be 0<x<1 and x>2
Q: 16- Evaluate the following code (5 > 6 || 4 > 3) && (7 > 8) * • not compile O 1 O true
A: Answer: The correct option is false
Q: Q2\ Write program using function that passing parameter by reference to find perimeter * circle C++
A: Provided the program using function that passes parameter by reference to find the perimeter of…
Q: Find the smallest Fibonacci number greater than 1,000,000 and greater than 1,000,000,000.
A: please check step 2 for the code in c++ which display the Fibonacci number greater than 1,000,000.…
Q: - Show the printout of the following code:
A: bool b = true;int i = b; cout << b << endl;cout << i << endl;
Q: Q.4) What is the function of the following C++ Programs? Part A #include #include main () #include…
A: 1. Function of the program is to find average of 7 numbers 2. Function of the program is to find…
Q: write a R.E for the longuage accepting any no.fa's and b's over, & = fa,b?
A: The Answer is in Below steps
Q: The following statement should determine if x is not greater than 20. What is wrong with it?
A: Answer: Given statement error is highlighted with red font if (!x>20)
Q: 45- By which of the following can the if-else statement be replaced?
A: Please find the answer below :
Q: C++ What is operator overloading? Write a program to find the sum and difference of any two complex…
A: Operator overloading: This is used to enable programmer to use notation target to the target domain…
Q: Q1) Write code in VB.NET using " Do Until - Loop " to solution the following: > x2 + 2Y – z i=0 If…
A: Algorithm: 1. Read x,y values 2. Initialise sum=0,i=0 3. do 4. sum=sum+(x*x +2*y -z) 5. i=i+1 6.…
Q: Fill-In Blanks of the following question: Postfix 2 3 4 * 5+ - is equal to...................
A: Please refer below for your reference: The given postfix expression is : 2 ,3,4,*,5,+,-
Q: 11. Simplify the following statement. i) (p^¬g) v (p^9) ii) (p V¬q) ^(¬p V ¬q)
A: We can simplify the both statement are as follows:
Q: Write minimum test cases for statement coverage.
A: It needs only two types of the test case.
Q: What is the output of following code.
A: Given: Integer s= 4. Integer d=s++; Then d is printed as output. Solution: The priority of post…
Q: -Which of the following is put at the end of the line in C ++?
A: Here they are asking which symbol is used to put at the end of the line. It means while coding the…
Q: Complete the C++ function given below that prints the string s, n times in the output inn separate…
A: Complete the C++ function given below that prints the string s, n times in the output in n separate…
Q: er the following functions by
A: Solution - In the given question, we have to arrange the given functions according to their order of…
Q: In the following segment of c++ when we enter a value for f we get a value for P, one of the choices…
A: EXPLANATION :- According to the given question, there is a one variable "f" which is taken as user…
Q: Modify the code to print the last occurrences of x and print how many times it exists?
A: A linked list is a linear data structure. It is a collection of nodes. Each node is divided into two…
Q: Write a con
A: Files present in a UNIX have associated permissions that verify who will read (r), write (w), and…
Q: C++ Code is allowed: Sachin has a rectangular paper of his usual work. Sachin knows that he will…
A: Dynamic programming is the technique in the computer programming which helps to efficiently solve…
Q: -what is the Continue statement doing ? A) Terminate execution of while or for loop B) passes…
A: continue is a keyword used in loops This makes the later instructions present after continue gets…
Q: Program this
A: The Answer is :-
Q: 8- Evaluate the following code (5 > 6 || 4> 3) && (7>8)
A: The logical operators are the operators that are used to combine two expressions.
Q: In the following segment of c++ when we enter a value for f we get a value for P, one of the choices…
A: Objective: Here, a code segment is given with an incorrect syntax. The wrong statement should be…
Q: Write a function to find out longest palindrome in a given string?
A: As the language in which we can write the code is not given. So I am answering this question using…
Q: 2- Let P, Q, R be true, false, true, respectively, which of the following is true I) P and Q and R…
A:
Q: • Write o *that Co Operato
A: {"generalGuidance":{"sections":[{"sectionId":"27efcbee…
Q: In the following segment of c++ when we enter a value for f we get a value for P, * one of the…
A: #include <iostream>#include <cmath> using namespace std; int main(){ int f,p;…
Q: 3. Write the following code using forEach(). for (let i=0; i<line.length; i++) { let s = line [i]…
A: Use ES6 function representation for forEach(). Syntax:- list.forEach(variable=>statements) ;
Q: 6) The function returns the value of x def my_func (x, p):
A: Algorithm: The algorithm to return the value of xp is: Start def my_func(x,p): y=x**p…
Q: What is the Pre-Fix expression for the following infix expression? ((A+B)*C-(D-E))&(F+G)
A: What is the Pre-fix Expression of Infix Expression ((A+B)*C-(D-E))&(F+G)
Q: a
A: Ans- "A" is a alphabet . It is the first letter of English alphabet.
Q: What does the following code segment do? for i in range(5) : x.append(C[ ]) for j in range(3) :…
A: In the first line x=[] an empty list is created. Then in the next line, 5 empty lists are added to…
Q: Q1) Write program in C++ to read 8 numbers and find summation and avarega ? Q2) Write C++ program to…
A: NOTE : Solving only first question as per the policy. First we will input all the elements and…
Q: 7. Write a function to compute the nth Fibonacci number. Use your function to solve Programming…
A: fibonacci sequence is a series of 1,1,2,3,5,.. The next number is the sum of the previous two…
Q: b) Write a function-file that can be used to calculate the equivalent resistance of n parallel…
A: The equivalent resistance is where the total resistance connected either in parallel or in series.
Q: What are the output of the following segment of C++ code: int count = 1; do { cout << ( count % 2?…
A: Output of given code snippet:
Q: True of false and correct in case of false: SEARCH is case sensitive function
A: In this question we have to choose the statement is True or False. If False then What will be the…
Q: h. ne Write the main function to do the following a. Return type int
A: 5) #include<stdio.h> //header files #include<conio.h> #include<stdlib.h>…
Q: n C++Find the output = for( int a = 5; a >0; a -- ) { cout << "value of a =" << a << endl; }
A: According to the question below the output:
Q: What is the output of the following code #include void recur(char x){ if(x == 'A') { printf("&c",…
A: Language is one of the most widely used programming language which has been used to create different…
Q: 22. Consider the following code using co-begin-end X 23; cobegin X =x + 3; X =x + 13; coend The…
A: The answer for the final possible values of X is
Q: Find the output: int i - 1: while (i i<= 10) cout <<i<<: i +-2; } cout << endl;
A: value of i is initialized to 1 To enter loop, we are checking i*i<=10 or not
Q: Can you please break the above code into 3 sections (loan.h, loan.cpp and main.cpp and give me the…
A: Please refer to the following steps for the complete solution to the problem above.
Q: estrict the li be establis
A: Yes definitely it make sense to restrict the lifetime of a Session Key because the session are…
Q: (empty)^c =.. Ou U^c
A: Ans.) Option C i.e. empty
Control structures
Control structures are block of statements that analyze the value of variables and determine the flow of execution based on those values. When a program is running, the CPU executes the code line by line. After sometime, the program reaches the point where it has to make a decision on whether it has to go to another part of the code or repeat execution of certain part of the code. These results affect the flow of the program's code and these are called control structures.
Switch Statement
The switch statement is a key feature that is used by the programmers a lot in the world of programming and coding, as well as in information technology in general. The switch statement is a selection control mechanism that allows the variable value to change the order of the individual statements in the software execution via search.
Step by step
Solved in 2 steps
- When the inheritance is private, the private methods in base class are __________ in the derived class (in C++).a. Inaccessibleb.. Accessiblec.. Protectedd. PublicWhen the inheritance is protected, then the public members/methods of parent class are in the child class. Select one: a.public b.private c.protected d.inaccessibleWrite a java program in which Animal:Create a class Animal and Add a protected data member named id of integer type.• Add get/set methods for id data member in Animal class with public access. Also provide default constructor this should initialize id to 0.• Also provide parameterized constructor and toString method.• Add an abstract method tellAboutSelf method to Animal class with public access• Add another abstract method speak method to Animal class.Reptile, Bird, MammalNext create the three child classes which extends form Animal class.• Add a default constructor to each of the above created class. The constructor should initialize the id data member id, Reptile, Bird and Mammal, to 1, 2 and 3 respectively also it display a message “(class Name)’s default constructor”. E.g. for Bird it says “Bird’s default constructor”.• Add a parameterized constructor to each of the above created class. The constructor should initialize the id data member, Reptile, Bird and Mammal, to the…
- Write a class named Employee which implements Comparable Interface with name and salary as data fields Add a constructor with argument name and salary. Add getter and Setter for name and salary. Add CompareTo() method for the data Salary. Write a class named Manager which inherits the Employee class. Add an instance variable, named department, of type String. Add a constructor in the subclass class with arguments name, salary, department and a toString() method that prints the manager’s name, department, and salary [Hint: Add a toString( ) method in the super class as well] Create 3 objects of Manager with following arguments 1. (Zayed, 500), 2. ( Ahmed, 700) 3. ( Faisal, 600) Add the above 3 objects into an ArrayLIst object and Sort by Salary and Display. Create an object Employee class with (Zayed, 500,IT) and display the 1. Name 2. Salary 3. Department by using tostring() method.If ParentClass is a Java class and we want the derived classes to have access to all the members of ParentClass, then we used the __?___ access specifier. a) public b) private c) protected d) inheritWrite a class named Employee which implements Comparable Interface with name and salary as data field. Add a constructor with argument name and salary. Add getter and Setter for name and salary. Add CompareTo() method for the data Name. Write a class named Manager which inherits the Employee class. Add an instance variable, named department, of type String. Add a constructor in the subclass class with arguments name, salary, department and a toString() method that prints the manager’s name, department, and salary [Hint: Add a toString( ) method in the super class as well] Create 3 objects of Manager with following arguments 1. (Zayed, 500), 2. ( Ahmed, 700) 3. ( Faisal, 600) Create an Array object Add the above 3 objects into an Array object and Sort by Name and Display Create an object Employee class with argument (Zayed, 500, IT) Display the 1. Name 2. Salary 3. Department by using tostring() method.
- In Java The base class Pet has protected fields petName, and petAge. The derived class Cat extends the Pet class and includes a private field for catBreed. Complete main() to: create a generic pet and print information using printInfo(). create a Cat pet, use printInfo() to print information, and add a statement to print the cat's breed using the getBreed() method.Which one is true? A) An inner class can be declared public or private subject to the same visibility rules applied to a member of the class. B)An inner class can be declared static. A static inner class can be accessed using the outer class name. A static inner class cannot access non-static members of the outer class. C)An inner class supports the work of its containing outer class and is compiled into a class named OuterClassName$InnerClassName.class. D)Inner classes can make programs simple and concise.1) Change the visibility of the variables and constructor in the Employee class to be more secure 2) Add an Admin class with the following features: a) The Admin class is a child of the Employee class b) Admin objects have an instance string password variable c) The Admin class has a 4 parameter constructor. One parameter sets the string, the other three parameters are used as arguments for a parent constructor call. d) Admin objects have an instance getInformation() method with a void return and an Employee object parameter. The method will request the calling Admin’s password and check user input. If input matches the password, the method will display the information of the Employee parameter Please use ***C Sharp** Language to answer the code
- What is true about private fields of a class? They must be used with private methods. They are accessible from anywhere inside or outside of a class. They can never be used in a class. They can be accessed only by methods inside the class they are associated with. Which of these keywords is used to refer to a member of a base class from a subclass? power super this upper Which of the following is true about abstract classes? Note that if a class can be sub-classed, this simply means that it can be derived from. Abstract classes can only contain abstract methods. They cannot be sub-classed. Abstract classes cannot be instantiated, but they can be sub-classed. Abstract classes can only contain abstract methods. They can be sub-classed. Abstract classes can be instantiated, but they cannot be sub-classed.Create a base class with an abstract print( ) method that isoverridden in a derived class. The overridden version of themethod prints the value of an int variable defined in the derivedclass. At the point of definition of this variable, give it a nonzerovalue. In the base-class constructor, call this method. In main( ),create an object of the derived type, and then call its print( )method. Explain the results. (JAVA) Also provide clear output screenshots pleaseMake a class Person, with instance variable name, age, and gender. Make a class Employee inheritfrom Person, with extra data for salary, and hiring date. Make another class Student inherit from Person,with data for program name, level (undergraduate/graduate), and program year. Supply required methods forthe superclass and the subclasses. Make a subclass Manager from Employee, with bonus salary, andoverride the corresponding method(s). Provide toString method for the Employee class and its subclass,Manager, such that it returns employee name, type of the employment, and salary. For instance if you createan object, manager1, from Manager class, with name=”John Smith” and annual salary of $125,000 and bonusweekly bonus of $200, and then write a print statement like System.out.println(manager1); , the output willbe:John Smith, Manager, Salary = $125,000/year, Weekly bonus = $200