int main(void) {         int a;         char *s;         int v0 = 9, v1 = 0, v2 = 0, v3 = 0;           printf("Exercise 1:\n====

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

Run the following code and answer the questions.

 

#include <stdio.h>

 

int main(void) {

        int a;

        char *s;

        int v0 = 9, v1 = 0, v2 = 0, v3 = 0;

 

        printf("Exercise 1:\n====================\n");

 

        switch(v0) {

               case 0: printf("Good day\n");   break;

               case 1: printf("Hey There!\n");    break;

               case 2: printf("No Name\n");  break;

               case 3: printf("Yes Please\n"); break;

               case 4: printf("Go ");        

               case 5: printf("Vamos!\n");                

               default: printf(" ");               break;

        }

 

        for(v1; v1<v2; v1=v1+v1) {

               printf("Vamos ");

        }

        printf("\n");

 

        if (v2 == 6) {

            s = "Go";

        }

 

 

        if(v3 != 0) {

               printf("%s VAMOS!\n",s);

        }

 

        return 0;

}

 

  1. What is the output of the program? Please explain why using the variables v0, v1, v2, and v3.
  2. The code has a vulnerability that can prevent the program from outputting properly. Explain what the problem is. What are the values of v0, v1, v2, and v3 that may cause such problem?
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
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