Tuesday, April 18, 2023

Model question set -1

 


1. In which normal form of database, atomicity is introduced?

A) First

B) Second

C) Third

D) Fourth

2. Which of the following techniques is not implemented to protect a database?

A) Rollback

B) Backup

C) Recovery

D) Firewall

3. Which one of the following SQL commands is executed to display all the records having a second letter in the LNAME (LAST NAME) as “A” from the customer table?

A) SELECT * FROM CUSTOMER WHERE LNAME LIKE “?A%”;

B) SELECT * FROM CUSTOMER WHERE LNAME LIKE “_A%”;

C) SELECT * FROM CUSTOMER WHERE LNAME LIKE “A%”;

D) SELECT * FROM CUSTOMER WHERE LNAME LIKE “%A”;

4. Which of the following is an incorrect IP address?

A) 192.168.0.1

B) 192.168.1

C) 172.255.0.0

D) 202.10.79.4

5. Which of the following is a server-side scripting language?

A) JavaScript

B) MySql

C) PHP

D) Jquery

6. Which of the following keywords are used to declare a variable in JavaScript?

A) int or var

B) float or let

C) var or let

D) char or var

7. Which of the following commands is executed in PHP to concatenate the variables $x with $y??

A) $x + $y

B) $x=$y

 C) concat ($x,$y)

  D) $x.$y

8. Which statement is incorrect about the object-oriented approach?

A) Emphasis is on data rather than procedure.

B) Data is hidden and cannot be accessed.

C) Objects communicate through functions.

D) It supports abstract data but not the class.

9. Which of the following feasibility study is concerned with cost benefit analysis?

A) Technical feasibility

B) Economic feasibility

C) Operational feasibility

D) Schedule feasibility


Group B

Short Answer Questions


10. Which type of database system (centralized or distributed) is mostly preferred by financial institution like a bank? Give any four suitable reasons.


Solution: Financial institutions like banks mostly prefer a distributed database system over a centralized one. Here are five reasons why:


1. High Availability and Reliability – If one server fails, other servers in the distributed system can continue functioning, ensuring uninterrupted banking services.



2. Faster Access and Performance – A distributed database stores data across multiple locations, reducing latency and improving response times for customers accessing services from different regions.



3. Data Redundancy and Backup – Distributed databases often have multiple copies of data, reducing the risk of data loss in case of system failure.



4. Scalability – Banks can easily expand their database system as they grow, adding new branches and services without overloading a single central system.



5. Security and Compliance – Sensitive financial data can be stored in different locations to comply with regional regulations and enhance security by limiting exposure to a single attack point.




Would you like me to refine this further based on any specific exam or study requirements?



Solution: Relational databases are widely used by business organizations due to their several advantages. Here are some reasons why business organizations prefer applying relational model for database design:

Flexibility: Relational databases are flexible because the data is stored in tables that can be easily joined together via a primary key or a foreign key.

Scalability: Relational databases can handle large amounts of data and can be easily scaled to meet the changing requirements of a business.

Ease of use: Relational databases are easy to use and understand, and they provide a simple and intuitive way to organize and access data.

Data integrity: Relational databases enforce data integrity by ensuring that data is consistent and accurate across all tables.

11. Develop a program in JavaScript to exchange/swap the values of any two variables.


Solution: The JavaScript program to exchange/swap the values of any two variables is:

<html>

<head>

<title> JavaScript program to exchange/swap the values of any two variables</title>

</head>

<body>

<script>

let a = 5;

let b = 10;

document.write("Before swap: a =" + a + "and b =" + b);

let temp = a;

a = b;

b = temp;

document.write("After swap: a ="+  a + "and b ="+b); 

</script>

</body>

</html>  


OR


How can you connect a database with PHP? Demonstrate with an example.


Solution:

To connect MySQL database with PHP, you can use the following steps:

(1)Create a new PHP file and write the following code to establish a connection with MySQL:

<?php

$servername = "localhost";

$username = "your_username";

$password = "your_password";

$dbname = "your_database_name";


$conn = mysqli_connect($servername, $username, $password, $dbname);


if (!$conn) {

die("Connection failed: " . mysqli_connect_error());

}

echo "Connected successfully";

?>

(2) Replace "your_username", "your_password", and "your_database_name" with your actual MySQL username, password, and database name.

(3) Save the PHP file and run it in a web browser. If the connection is successful, you should see the message "Connected successfully" displayed in the browser.


12. Describe the concept of Object Oriented and Procedure Oriented Programming in brief.


Solution:

Object oriented programming is a programming paradigm that was developed to overcome the drawbacks and limitations of particularly procedure-oriented programming. The major need for developing such languages was to manage the ever-increasing size and complexity of programs.

Procedural programming is a programming paradigm that organizes software design around procedures. Procedures are self-contained units of code that perform a specific task. Procedural programming is based on the concept of "functions" that take inputs and produce outputs. Functions are called by other functions to perform tasks.

The main difference between OOP and procedural programming is their approach to code organization. In procedural programming, the program is divided into small parts called functions. In OOP, the program is divided into small parts called objects. Procedural programming follows a top-down approach while OOP follows a bottom-up approach.


13. Write down any five qualities of good software.


Solution: Good software is characterized by several key attributes. Here are five qualities of good software:

Functionality: The software meets the requirements and specifications that it was designed for, and it behaves as expected when it is used in its intended environment.

Usability: The software is easy to use and understand, and it provides a positive user experience.

Reliability: The software is free of defects and it performs consistently and accurately under different conditions and scenarios.

Performance: The software runs efficiently and quickly, and it can handle large amounts of data or traffic.

Security: The software is protected against unauthorized access and it keeps the data and functions safe from malicious attacks.

14. Explain mobile computing with its advantages and disadvantages.


Solution: Mobile computing is the form of human-computer interaction by which a computer is expected to be transported during normal usages. Mobile computing is a generic term describing one's ability to use technology while moving, as opposed to portable which is the only particle for use while deployed in a stationary configuration.

Advantages

Increase in Productivity- Mobile devices can be used out in the field of various companies, therefore reducing the time and cost for clients and themselves.

Entertainment- Mobile devices can be used for entertainment purposes, for personal and even for presentations to people and clients.

Portability- This would be one of the main advantages of mobile computing, you are not restricted to one location for you to get jobs done or even access email on the go.

Cloud Computing- This service is available for saving documents on a online server and being able to access them anytime and anywhere when you have a connection to the internet and can access these files on several mobile devices or even PCs at home.

Quick Service- We can sell a product or give service in quicker time by using mobile computing.

Social Interactivity – it is very useful tool for social interactivity that allows for data sharing and collaboration between users.

Disadvantages


Quality of connectivity- as one of the disadvantages, mobile devices will need either WiFi connectivity or mobile network connectivity such as GPRS, 3G and in some countries even 4G connectivity that is why this is a disadvantage because if you are not near any of these connections your access to the internet is very limited.

Security concerns- Mobile VPNs are unsafe to connect to, and also syncing devices might also lead to security concerns.

Power Consumption- due to the use of batteries in these devices, these do not tend to last long, if in a situation where there is no source of power for charging then that will certainly be a letdown.

Human interface with device- These are still uncommon; screens are often too small. Keyboards are impractical, especially one handed.


Group C

Give the long answers to the following questions.


15. Why do most of the business organizations prefer setting their network with the client-server architecture? Write its advantages and disadvantages.


Solution:

Client-server architecture is a type of computer network architecture where many clients (remote processors) request and receive service from a centralized server (host computer). Many business organizations prefer setting their network with the client-server architecture due to its several advantages. Here are some advantages and disadvantages of client-server architecture:

Advantages:


Centralization: The main advantage of client-server network is the centralized control that it is integrated with. All the necessary information is placed in a single location.

Security: In client-server network, the data is well protected due to its centralized architecture. It can be enforced with access controls such that only authorized users are granted access.

Scalability: Client-server networks are highly scalable. Whenever the user needs they can increase the number of resources such as clients and servers.

Management: Since all the files are stored in the central server, it is rather easy to manage files.

Disadvantages:


Cost: Setting up a client-server network can be expensive as it requires specialized hardware and software.

Maintenance: Maintaining a client-server network can be complex and may require dedicated IT staff.

Single point of failure: Since all data and services are centralized on the server, if the server fails, all clients will be affected.

16. Develop a program in C using structure to ask the information of any 12 students with roll_number, name and marks scored in sub1, sub2, and sub3. Also, display them in proper format along with the calculation of total and percentage. [Note: the full marks of each subject is 100].


Solution:

#include <stdio.h>

#include<conio.h>

void main()

{

struct student {

  int roll_number;

  char name[50];

  float   sub1,sub2,sub3;

}s[12];

  int i;


  // input student data

  for (i = 0; i < 12; i++) 

{

printf("enter roll no");

scanf("%d",&s[i].roll_number);

printf("enter name");

scanf("%s",s[i].name);

            do

                {        printf("enter sub1 sub2 and sub3");

                        scannf("%f%f%f",&s[i].sub1,&s[i].sub2,&sub3);

    }while(s[i].sub1>=0 ||s[i].sub1<=100)  ||(s[i].sub2>=0 ||s[i].sub2<=100)||(s[i].sub2>=0 ||s[i].sub2<=100);

   }


  // print student data

  printf("\nRoll No.\tName\t\tSub1\tSub2\tSub3\tTotal\tPercentage\n");

  for (i = 0; i < 12; i++) 

{

    float total = s[i].sub1 + s[i].sub2 + s[i].sub3;

    float percentage = total / 3;

    printf("%d\t\t%s\t\t%f\t%f\t%f\t%d\t%.2f%%\n", s[i].roll_number, s[i].name, s[i].sub1, s[i].sub2, s[i].sub3, total, percentage);

  }


  getch();

}

OR


Demonstrate a program in C to create a data file named score.dat to store students’ information with Reg_no, name, gender, and address. The program should ask the user to continue or not. When finished, the program should also display all the records in the proper format.


Solution:

#include <stdio.h>

  #include <conio.h>

  void main()

{

      int reg_no;

      char name[50];

      char gender[10];

      char address[100];

        char choice:

      FILE *fp;

      fp = fopen("score.dat", "w");

      if (fp == NULL) 
{
          printf("Error opening file.\n");
          exit(1);
     }

      do 

        {

         

          printf("enter Reg_no: ");

          scanf("%d", &reg_no);

          printf("enter Name: ");

          scanf("%s", name);

          printf("enter Gender  ");

          scanf(" %s", gender);

          printf("enter Address: ");

          scanf("%s", address);

           fprintf(fp,"%d%s%s%s",reg_no,name,gender,address);

          printf("\nAdd another record (Y/N)? ");

          choice=getche();

      } while (choice == 'Y' || choice == 'y');

      fclose(fp);

      fp = fopen("score.dat", "rb");

      if (fp == NULL) {

          printf("Error opening file.\n");

          exit(1);

      }

      printf("reg no\t name\t gender \t address\n");

      while ( fscanf(fp,"%d%s%s%s",&reg_no,name,gender,address)!=EOF) 

{

          printf("%d\t%s\t%s\t%s\n",reg_no,name,gender,address);

}

      fclose(fp);

    getch();

  }



No comments:

Post a Comment

OOPS

   paradigm refers to a style or approach to solving problems and organizing code in a particular way. It dictates how developers think abo...