The Social Media Language (SML) has the following built-in data types: comment message

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

Need help in this question with detailed explanation

Info given-

The Social Media Language (SML) has the following built-in data types:

comment
message
account
picture
message

The format of functions in SML is as follows:

<return_type> <function_name> (<parameter1> , <parameter2>,  …, <parameter_n>)

SML has the following built-in operations:

account post   (comment, message, account);
account post   (picture, account);
account delete (message, account);
account delete (picture, account);
account find   (comment, account);
message search (picture, account);
account share  (account, account);

SML also has the following built-in conversion functions:

comment comment_of (picture);
comment about      (account);
account friend_of (account);
account add_on_of (picture);
picture picture_of (comment);

The conversion functions convert the value of its parameter, and then returns converted value.  The parameter remains unchanged.

Other features of the language are as follows:

  • The language is not case sensitive.
  • Coercion is performed only from comment to picture, and from message to picture; meaning, if the actual data type is either a comment or a message, and the expected data type is a picture, the value of the comment or message is automatically converted to a picture.
  • Static type checking is performed whenever sufficient information has been provided by the programmer to the compiler. Otherwise, type checking is deferred until runtime.
  • Variables do not have to be explicitly declared. Those that are not declared explicitly and start with a letter between I and N (inclusive) have the data type comment (part of the language definition). Any other undeclared variables are typeless; that is, their data type is determined based on the type of the value that was most recently assigned to them.
  • The assignment operator is :=. Both operands of the assignment operator must have the same data type (meaning <type> := <type>, and := returns void.

Given the following variable declarations:

var  ig : account;
meme : picture;
primary : comment;
arrow : account;

 

Q1)

Answer the following sets of program statements. If a statement is will cause a data type mismatch error, rewrite that statement by applying the available conversion functions to prevent the data type mismatch error.(Highlighted in bold)

Line 1: result := find(meme, ig);     
Line 2: ig := delete(result, ig);    

       

    e) Will a data type mismatch error occur in Line 2?

     f) If your answer in the previous question is YES, rewrite Line 2. If your answer in the previous question is NO, select "NA" 

OPTIONS FOR RWERITING LINE 2 ARE AS FOLLOW:(CHOOSE THE RIGHT OPTION AMONG THE GIVEN)

1)ig : delete(picture_of(about(result)), ig)
2)ig:= delete(add_on_of(about(result)), ig)
3)ig : delete(friend_of(about(result)), ig)
4)ig: delete(comment of(about(result)), ig)                                                                                                                      5) NA 

  g) What is the data type of ig after Line 2?

OPTIONS- FOR G (CHOOSE AMONG THE FOLLOWING)

1) account

2) picture

3) message

4) comment

Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Features of HTML
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
  • SEE MORE 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