NEB year 2062 computer science questions
old syllabus
--------------------------------------------
2062 (2005)
Group 'A'
(Long Answer Questions)
Attempt any two of the following questions:[2x20=40]
1.
a) Write a C Program to print the 10 positive integers and their factorials.[5]
Ans:-
//to print 'n' integers and their factorial value.
#include<stdio.h>
include<conio.h>
void main()
{
int number,i,k,fact;
printf("enter value(upper) for number 'number'\n");
scanf("%d",&number);
for(i=1;i<=number;i++)
{
fact=1;
for(k=1;k<=i;k++)
{
fact=fact*k;
}
printf("the factorial value for %d number=%d\n",i,fact);
}
getch();
}
b) differentiate between while and do ... while loop with suitable example. [5]
Ans:-
Differences between while and do.while loop are given below.
while loop | do while loop |
In the while loop, condition is checked in the beginning. | In the do while loop, condition is checked at the end. |
It is also known as a pre-test or entry control loop. | It is also known as post-test or exit control loop. |
It is not terminated with a semicolon. | It is terminated with a semicolon. |
In the while loop, statements are not executed if the condition is false. | In the do while loop, statements are executed once even the condition is false. |
It uses the keyword ‘while’. | It uses two keywords ‘do’ and ‘while’. |
The syntax of while loop is as follows: initialization; while(condition) { statements; increment/decrement; } | The syntax of do-while loop is as follows: initialization; do { statements; increment/decrement; }while(condition); |
The operation of while loop can be represented using flowchart as follows: | The operation of do while loop can be represented using flowchart as follows: |
Example: int main() { int i=1; while(i>=10) { printf("I love my country"); i++; } return 0; } Output: This program displays nothing as output; as condition is evaluated false in the beginning. | Example: #include<stdio.h> int main() { int i=1; do { printf("I love my country"); i++; }while(i>=10); return 0; } Output: This program displays “I love my country” as output at once. |
c) For any integer input through the keyboard, write a C Program in find out whether it is an odd number or even number. [5]
Ans:-
/*Program in find out whether it is an odd number or even number.*/
#include<stdio.h>
include<conio.h>
void main()
{
int x;
printf("enter a number\n");scanf("%d",&x);
if(x%2==0)
{
printf("it is an even number");
}
else
{
printf("it is an odd number\n");
}
d) Write a C Program to input 'n' numbers and find out greatest and smallest number .[5]
Ans:-
/*to find the greatest and smallest value*/
#include<stdio.h>
int main()
{
int numbers[100];
int i,great,small,n;
printf("enter the value of 'n'\n");
scanf("%d",&n);
printf("enter numbers\n");
for(i=0;i<n;i++)
{
scanf("%d",&numbers[i]);
}
great=numbers[4];
small=numbers[3];
for(i=0;i<n;i++)
{
if(great<numbers[i])
{
great=numbers[i];
}
else if(small>numbers[i])
{
small=numbers[i];
}
}
printf("greatest number =%d nd smallest number=%d",great,small);
return 0;
}
2.
a) Draw a flowchart and write C Program to read in a positive integers less than 20 and display its multiplication table.[10]
Ans:-
Flowchart:-
Second part:-
*Program to read in a positive integers
less than 20 and display its multiplication table
*/
#include <stdio.h>
int main()
{
int number,total,k=1,j;
printf("enter a value for total term\n");
scanf("%d",&total);
while(k<=total)
{
printf("enter a number less than 20 to print multiplication table\n");
scanf("%d",&number);
if(number<20)
{ j=1;
while(j<=10)
{
printf("%d*%d=%d\n",number,j,number*j);
j++;
}
}
else
{
printf("the number %d is greater than or equal to 20 so we can not print its table\n",number);
printf("enter next number\n");
}
k++;
}
return 0;
}
b) Write a C Program to input name of 'n' number of students and sort them in alphabetical order.
Ans:-
/*
C program to input name of n students and arrange
them in alphabetical order.
*/
#include <stdio.h>
#include<string.h>
struct shorting
{
char name[100];
}var[800],var1;
int main()
{
int i,j,total;
printf("enter the total size of name to be read\n");
scanf("%d",&total);
printf("enter name\n");
for(i=0;i<total;i++)
{
scanf("%s",var[i].name);
}
for(i=0;i<total;i++)
{
for(j=i+1;j<total;j++)
{
if((strcmp(var[i].name,var[j].name))>0)
{
var1=var[i];
var[i]=var[j];
var[j]=var1;
}
}
}
for(i=0;i<total;i++)
{
printf("name=%s\n",var[i].name);
}
return 0;
}
OR
What do you understand by the term data integrity? Why is an important this to be considered while designing a database? Stage and describe different types of data integrity. [10]
Ans:-
Data integrity:
Integrity is consistency of actions, values, methods, measures, principles, expectations and outcome.
Data integrity is a term used in computer science and telecommunications that can mean ensuring data is "whole" or complete, the condition in which data are identically maintained during any operation (such as transfer, storage or retrieval), the preservation of data for their intended use, or, relative to specified operations, the a priori expectation of data quality.
Or
Database integrity means the correctness and consistency of data. It is another form of database protection.
Put simply, data integrity is the assurance that data is consistent and correct.
Data integrity is normally enforced in a database system by a series of integrity constraints or rules.
Three types of integrity constraints are an inherent part of the relational data model: entity integrity, referential integrity.
Second part:-
Its improtance can be summarized into following lines.
This integrity concept is used to handle/manage:
1.reduce redundancy
2.Maintain consistency
3.To handle simple as well as complex query
4.to link tables
5.to avoid wrong or invalid entry of data.
etc.
Types:-
Entity integrity concerns the concept of a primary key. Entity integrity is an integrity rule which states that every table must have a primary key and that the column or columns chosen to be the primary key should be unique and not null. It means the primary key’s data must not be missing in table/s.
or
The entity integrity is a constraint on primary key value. It states that any attribute of a primary key cannot contain null value. If primary key contains null value, it is not possible to uniquely identify a record in a relation. Entity integrity ensures that it should be easy to identify each entity in the database.
Referential Integrity
Referential integrity ensures that the relationship between the primary key (in a referenced table) and the foreign key (in each of the referencing tables) is always maintained. The maintenance of this relationship means that:
A row in a referenced table cannot be deleted, nor can the primary key be changed, if a foreign key refers to the row. For example, you cannot delete a customer that has placed one or more orders.
A row cannot be added to a referencing table if the foreign key does not match the primary key of an existing row in the referenced table. For example, you cannot create an order for a customer that does not exist.
Domain Integrity
Domain (or column) integrity specifies the set of data values that are valid for a column and determines whether null values are allowed. Domain integrity is enforced by validity checking and by restricting the data type, format, or range of possible values allowed in a column.
3.
a) Write an algorithm and C Program to read salaries of 200 employees and count the number of employees getting salary between 5,000 -10,000.[10]
Ans:-
Algorithm:
/* to count ttoal number of employees getting salary between 5000 to 10,000.
*/
#include <stdio.h>
int main()
{
float salary[200];
int i,count=0;
printf("enter salary of 200 employees\n");
for(i=0;i<=199;i++)
{
scanf("%f",&salary[i]);
if(salary[i]>=5000 && salary[i]<=10000)
{
count++;
}
}
printf("total number of employees getting salary in 5000 and 10000 is=%d",count);
return 0;
}
b) Write a C Program that will read successive record from the new data file and display each record on the screen in an appropriate format.[10]
Ans:-
/*Program that will read successive record from the new data file and display each record on the screen in an appropriate format*/
#include<stdio.h>
int main()
{
FILE *p;
char name[100];
int stdno;
int eng,phy,maths,chem,csc;
p=fopen("student.dat","r");
printf("data are\n");
while((fscanf(p,"%s%d%d%d%d%d%d",name,&stdno,&eng,&phy,&maths,&chem,&csc))!=EOF)
{
printf("name=%s,stdno=%d, english=%d,physics=%d,maths=%d,chemistry=%d ,csc=%d \n",name,stdno,eng,phy,maths,chem,csc);
}
fclose(p);
return 0;
}
The persons who perform above task/system analysis,design and implementation activity is know as system analyst. Somewhere we say or call by names like business engineer, business analyst etc. The work of system analyst who designs an information system is just same as an architect of a house. They work as facilitators of the development of information systems and computer applications.
It has following types.
Local Area Network:-
It is a privately-owned network done in single building or room or office to share resources or data, documents (for 100 m).It occupies small area and small number of computers.Its Speed with which data is passed is extremely fast(1000mbps).It has Fastest connecting and sharing speed.For communication it uses medium like Co-axial or utp cable (mostly).
Preferd topologies can be topology like bus/star/tree etc.
There is fewer error occurrences during transmission and Less congestion.It can be handled by single person/administrator.
It is cost effective.
star topology:
A star topology is designed with each node (file server, workstations, and peripherals) connected directly to a central network hub, switch, or concentrator (See fig. 2).Data on a star network passes through the hub, switch, or concentrator before continuing to its destination. The hub, switch, or concentrator manages and controls all functions of the network.
It also acts as a repeater for the data flow. This configuration is common with twisted pair cable; however, it can also be used with coaxial cable or fiber optic cable.
Fig. 2. Star topology
Advantages of a Star Topology
Easy to install and wire.
No disruptions to the network when connecting or removing devices.
Easy to detect faults and to remove parts.
Disadvantages of a Star Topology
Requires more cable length than a linear topology.
If the hub, switch, or concentrator fails, nodes attached are disabled.
- Reduced chances of data collision as each node release a data packet after receiving the token.
- Token passing makes ring topology perform better than bus topology under heavy traffic.
- No need of server to control connectivity among the nodes.10. Describe the wireless network system. List out deices and equipment necessary for Wi-Fi network. 3+2
- Execute queries against a database
- Retrieve data from a database
- Insert records into a database
- Update records in a database
- Delete records from a databaseSQL stands for Structured Query Language; it is the most common language for extracting and organising data that is stored in a relational database. A database is a table that consists of rows and columns. SQL is the language of databases. It facilitates retrieving specific information from databases that are further used for analysis. Even when the analysis is being done on another platform like Python or R, SQL would be needed to extract the data that you need from a company’s database.It is used for:
- Execute queries against a database
- Retrieve data from a database
- Insert records into a database
- Update records in a database
- Delete records from a database
Cyber law is a new and quickly developing area of the law that pertains to persons and companies participating in e-commerce development, online business formation, electronic copyright, web image trademarks, software and data licenses, online financial transactions, interactive media, domain name disputes, computer software and hardware, web privacy, software development and cybercrime which includes, credit card fraud, hacking, software piracy, electronic stalking and other computer related offenses.
The getchar() function is used to read (or accept) a single character. It can not take more than one character.
Syntax:
variable_name = getchar();
Here variable_name is a valid C name that has been declared as char type.
putchar():-
The putchar() function is used to display the character contained in the variable name at the output screen / terminal.
Syntax:
putchar(variable_name);
Where variable_name is a type char containing a character.
Example
#include<stdio.h>
int main()
{ char a;
printf("Enter a character");
a=getchar();
putchar(a);
return 0;
}
In the above example, getchar() function accepts a character which stores in a variable 'a' and putchar() used to display stored character.
1. getchar() can not accept more than one character.If we enter then it truncates all characters except the first.
ICT, or information and communications technology (or technologies), is the infrastructure and components that enable modern computing.
Although there is no single, universal definition of ICT, the term is generally accepted to mean all devices, networking components, applications and systems that combined allow people and organizations (i.e., businesses, nonprofit agencies, governments and criminal enterprises) to interact in the digital world.
It has many advantages and can not be mentioned by just writing here. But to know how it works and where it is used, let’s see some.
File sharing/transferring:-
A file can be put on a "Shared Location" or onto a File Server for instant use by colleagues does not matter what is a size of file and how many will use it. Mirror servers and peer-to-peer networks can be used to ease the load of data transfer.
Internet banking:-
We know that almost all banks now-a-days are using this technology for its customers as an extra facility. Internet Banking/ Online Banking allows bank customers to do financial transactions on a website operated by the banks. The customers can do almost any kind of transaction on the secured websites. They can check their account balance, transfer funds, pay bills, etc. but security is a major issue for this.
Relay of information/communication:-
The biggest advantage of that internet is offering of information. The internet and the World Wide Web has made it easy for anyone to access information, and it can be of any type, as the internet is a sea of information. The internet and the World Wide Web have made it easy for anyone to access information, and it can be of any type. Any kind of information on any topic is available on the Internet. As well as, it can be greatly used for communication purpose for any distance.
Dating/Personals:
People are connecting with others through internet and finding their life partners. Internet not only helps to find the right person but also to continue the relationship.
disadvantages:-
Theft of Personal Information
If you use the Internet for online banking, social networking or other services, you may risk a theft to your personal information such as name, address, credit card number etc. Unscrupulous people can access this information through unsecured connections or by planting software and then use your personal details for their benefit. Needless to say, this may land you in serious trouble.
Spamming
Spamming refers to sending unwanted emails in bulk, which provide no purpose and needlessly obstruct the entire system. Such illegal activities can be very frustrating for you as it makes your Internet slower and less reliable.
Virus Threat:
Internet users are often plagued by virus attacks on their systems. Virus programs are inconspicuous and may get activated if you click a seemingly harmless link. Computers connected to Internet are very prone to targeted virus attacks and may end up crashing.
Pornography
Pornography is perhaps the biggest disadvantage of Internet. Internet allows you to access and download millions of pornographic photos, videos and other X-rated stuff. Such unrestricted access to porn can be detrimental for children and teenagers. It can even play havoc in marital and social lives of adults.
This design can carry following activities:
Defining precisely the required system output
Determining the data requirement for producing the outp
Different program logic tools are given below.
1.Algorithm
2.Flowchart
3.Pseudocode
4.Decision table
5.Decision tree
6.DFD
7.UML
Let's understand about decision table and decision tree.
Decision table:- A decision table is a table with various conditions and their corresponding actions. Decision table is a two dimensional matrix. It is divided into four parts, condition stub, action stub, condition entry, and action entry. See the first figure listed below. Condition stub shows the various possible conditions. Condition entry is used for specifying which condition is being analyzed. Action stub shows the various actions taken against different conditions.
And action entry is used to find out which action is taken corresponding to a particular set of conditions.
condition stub condition entry
action stub action entry
Decision tree is a set of rules for what to do in certain condition and if particular condition
satisfies, do that otherwise go to this step. They can be used to enforce strict compliance with local procedures, and avoid improper behaviors, especially in complex procedures or life-and-death situations.
E.g. If the photocopier breaks down, call Raj. If Raj is not available, call Aasha. If Aasha is away, ring Sary.
They are valuable when setting out how the system should behave, and what conditions it will need to be able to cope with. A decision tree showing decisions and actions required of a software system
In above diagram we can see how an applicant is selected or hired under different condition.Sometimes in critical situation it can be used for decision taking.
- It is an electrical cable with an inner conductor surrounded by a flexible, tubular insulating layer, surrounded by a tubular conducting shield.
- The term coaxial comes from the inner conductor and the outer shield sharing the same geometric axis.
- Coaxial cable is used as a transmission line for radio frequency signals, in applications such as connecting radio transmitters and receivers with their antennas, computer network (Internet) connections, and distributing cable television signals and uses many connectors.
- In the context of spaceflight, a satellite is an object which has been placed into orbit by human endeavor. Such objects are sometimes called artificial satellites to distinguish them from natural satellites such as the Moon.
- Satellites are usually semi-independent computer-controlled systems. Satellite subsystems attend many tasks, such as power generation, thermal control, telemetry, altitude control and orbit control
- satellite has on board computer to control and monitor system.
- Additionally, it has radio antennae (receiver and transmitter) with which it can communicate with ground crew.
- Most of the satellites have attitude control system(ACS).It keeps the satellite in right direction.
- Common types include military and civilian Earth observation satellites, communications satellites, navigation satellites, weather satellites, and research satellites. Space stations and human spacecraft in orbit are also satellites.
- Satellite orbits vary greatly, depending on the purpose of the satellite, and are classified in a number of ways. Well-known (overlapping) classes include low Earth orbit, polar orbit, and geostationary orbit.
Some of the major benefits include the following :
- Greater overall database organization
- Reduction of redundant data
- Data consistency within the database
Play Free Solo Titanium Razor & Blades - Technobiography
ReplyDeleteThis razor uses a standard head, standard head, and has a titanium connecting rod unique knurled finish. Use the Blades to slice black titanium and nano titanium by babyliss pro crush the blade titanium astroneer in gold titanium alloy a way you like.