How many syntax errors in the following code? Assume all libraries are including

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
4) How many syntax errors in the following code? Assume all libraries are
including
#include <iostream>
using namespace std;
class ShapeType {
protected:
double length, width;
void setDimension (double L, double w) { length = L; width = w; }void print() {};;
};
class rectangleType :protected ShapeType
{
private:
public:
};
double length, width;
rectangleType() { length = 0; width = 0; }rectangleType(double L, double w) {
setDimension (L, w); }
void setDimension (double L, double w) { length = L; width = w; }
double getLength() { return length; }
double getwidth() { return width; }
double area() { return length width; }
double perimeter() { return 2* (length + width); }
void print() {
ShapeType: :print();
}
Your answer:
5) How many true statement(s) among the following?
Comm
A. Templates in C++ are commonly used to repeat code by generating a
set of classes and functions
B. Friend functions are member functions that have the right to access
public and protected member functions.
C. The process of overloading an operating in C++ MUST include writing
a function
D. Overloading an operator is commonly used to change its precedence
E. It is possible to create new operators in C++
F. We can override built-in type operators in C++
6) How many false statement(s) among the following?
A. Set in STL is an associate container for storing unique values and
allows rapid lookup
101101
010101011
B. Keys in STL's map are unique
C. We give the highest priority to the first element in the STL's priority
queue
D. Recursion in C++ allows functions to be calling themselves directly or
indirectly and provide an elegant way to define functions
E. Memory addresses store integers that can point other integers
F. Overloading the [] operator requires that the function is a member of
the class
Transcribed Image Text:4) How many syntax errors in the following code? Assume all libraries are including #include <iostream> using namespace std; class ShapeType { protected: double length, width; void setDimension (double L, double w) { length = L; width = w; }void print() {};; }; class rectangleType :protected ShapeType { private: public: }; double length, width; rectangleType() { length = 0; width = 0; }rectangleType(double L, double w) { setDimension (L, w); } void setDimension (double L, double w) { length = L; width = w; } double getLength() { return length; } double getwidth() { return width; } double area() { return length width; } double perimeter() { return 2* (length + width); } void print() { ShapeType: :print(); } Your answer: 5) How many true statement(s) among the following? Comm A. Templates in C++ are commonly used to repeat code by generating a set of classes and functions B. Friend functions are member functions that have the right to access public and protected member functions. C. The process of overloading an operating in C++ MUST include writing a function D. Overloading an operator is commonly used to change its precedence E. It is possible to create new operators in C++ F. We can override built-in type operators in C++ 6) How many false statement(s) among the following? A. Set in STL is an associate container for storing unique values and allows rapid lookup 101101 010101011 B. Keys in STL's map are unique C. We give the highest priority to the first element in the STL's priority queue D. Recursion in C++ allows functions to be calling themselves directly or indirectly and provide an elegant way to define functions E. Memory addresses store integers that can point other integers F. Overloading the [] operator requires that the function is a member of the class
Expert Solution
Step 1

question 4

There are four syntax errors in the code.

the  resolved code 

class ShapeType
{
protected:
double length, width;

public:
void setDimension (double l, double w) { length = l; width = w; }
void print()
};

class rectangleType: protected ShapeType
{
private:
public:
double length, width;

rectangleType() {length = 0; width = 0;}
rectangleType(double L, double W) {
setDimension(L, W);
}

void setDimension(double L, double w) {
length = L;
width = w;
}

double getLength() { return length; }
double getwidth() { return width; }
double area() { return length * width; }
double perimeter() { return 2 * (length + width); }

void print() {
ShapeType::print();

cout << "Length: " << length << endl;
cout << "Width: " << width << endl;
cout << "Area: " << area() << endl;
cout << "Perimeter: " << perimeter() << endl;
}

question 5

A. Templates in C++ are commonly used to repeat code by generating a set of classes and functions
B. Friend functions are member functions that have the right to access public and protected member functions.
D. Overloading an operator is commonly used to change its precedence
E. It is possible to create new operators in C++
F. We can override built-in type operators in C++
question 6


C. We give the highest priority to the first element in the STL's priority queue

E. Memory addresses store integers that can point other integers

 

 

 

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Lock objects
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education