NEB year 2068 computer science questions
(old syllabus)
Group-A
Attempt any two questions..(2x20=40)
q1.
a)what is an operator?Explain different types of oeprator used in programming with example.[1+4]
Ans:-
operator:-
for example: +,-,= etc
It is of following types.
1)Arithmetic operator: It is used to do arithmetic calculations/operation.
It has following types.
+ -----------> used for addition.example is a+b. It means we are performing addition with the help of operand a and b
- ------------>It is used for subtraction.Example is a-b. It means we are performing subtraction with the help of operand a and b
* -------------------->used for multiplication.example is a*b. It means we are performing multiplication with the help of operand a and b
/---------------->used for division.example is a/b. It means we are performing division with the help of operand a and b
example
int a=5;
if(!(a==5))
{
printf("it is\n");
}
else
{
printf("it is not\n");
}
here ,the value is 5 but we get output "it is not".It is called reversing the output.
4) Assignment operator:
an operator ,symbolized by '=' character,is called assignment operator.It assigns value to variable.
example:
int a=6;
It means, we are assignming value 6 to variable a.
5)Unary operator:- this operator works on one operand only.It has two types.
I) increment operator:- It increases the value of given variable by one.For example: ++y or y++
It can be classified into pre-increment and post increment.
pre-increment:- It is written as ++x.It means first increase the value and then use that.
post-increment: It is written as x++.It means, first use that and then increase its value by one.
II)decrement operator:- It decreases the value of given variable by one.For example: --y or y--
It can be classified into pre-decrement and post decrement.
pre-decrement:- It is written as --x.It means first decrease the value and then use that.
post-decrement: It is written as x--.It means, first use that and then decrease its value by one.
b)Define nested loop.Write a program to calculate and display the multiplication table using nested loop.[2+3].
Ans:-
Nested loop:
Syntax:
for(initialization; condition ; increment/decrement)
{
for(initialization; condition ; increment/decrement)
{
statements;
}
}
c)Write a program to find out factorial of a number.[5]
Ans:-
//program to get factorial value of a positive number
#include<stdio.h>include<conio.h>
void main()
{
int number,fact=1,i;
printf("enter any positive number\n");
scanf("%d",&number);
if(number>0)
{
for(i=1;i<=number;i++)
{
fact=fact*i;
}
}
else
{
printf("the number is not +ve\n");
}
printf("the factorial value for entered number=%d is =%d\n",number,fact);
getch();
}
d)What do you mean by local,global and static variables.Explain with examples.[5]
Ans:-
Local variables:-
Those variables which are declared inside the function are called local variables.They can not be accessed from other function or outsiders. It means scope is limited to that function where it is declared. For local variables, either we use keyword 'auto' or simply variables with data types.
Example:-
void sum()
{
int a,b;
int sum;
}
Here, a,b and sum are local variables.
Global variables:-
Those variables which are declared outside the function are called global variables.They can be accessed from other function or outsiders. It means scope is not limited to that function. For global variables, either we use keyword 'extern' or simply variables with data types.
Example:-
int a=7,b=9;
int sum;
void sum()
{
sum=a+b;
}
Here, a,b and sum are global variables. Once we declare them , it does not need to be declared inside the function. It works.
static variables:-
Compiler can know the value of variables till it is called.After calling compiler loses its content i.e. function forgets the value. i.e. our function can not retain its value after calling. To overcome this problem, we have to use keyword 'static' with variables. It retains the variables values even after calling.
Example:-
#include <stdio.h>
void sum();
int main()
{
sum();
sum();
return 0;
}
void sum()
{
int a=7,b=9;
printf("sum is=%d\n",a+b);
b++;
}
If we run this program, we will get 16 two times. It means there will be no change in output of statement 'b++'. For this we have to use static in front of int a=7,b=9 i.e.
static int a=7,b=9. If we use it then computer remembers old values and we will get different values.
Now we will get first
16 then
17
q2)
a)What is an array?Write down similarilities and differences of array with pointer.[5]
Ans:-
Array:-
Definition: A composite variable capable of holding multiple data of same data type under a single variable name is called array.
Declaration of Array:
datatype array_name [size];
Example: - int marks [10]; int x[4]={1,2,3,4};
Array size is fixed at the time of array declaration.
Generally, we use for loop () to assign data or item in memory and also use this loop to extract data from memory location.
Types of Array:
There are 2 types of array.
a) One Dimensional Array (1-D): IT is an array where we use one subscript value.It stores value in row in contigous cells.
b) Two Dimensional Array (2-D):an array where we may use two or more than two subscript values.
| Column zero | Column one |
Row 0 à | 1(0,0) | 2(0,1) |
Row 1à | 3(1,0) | 4(1,1) |
1. The code
int a[10], b[10]; a = b; /* WRONG */is illegal. As we've seen, though, you can assign two pointer variables:
int *ip1, *ip2; ip1 = &a[0]; ip2 = ip1;
2.
->Array can be initialized at definition. e.g. int a[3]={1,2,3};
-> Pointer can not be initialized at definition
3.Array can not re-allocate assigned memory.
Pointer can re-assign the allocated memory.
4.In array memory allocation is in seqence.
In pointer memory allocation is Random.
b)Write a program to read salaries of 300 employees and count the number of employees getting salary in range 10000 and 15000.[10]
Ans:-
/* to count ttoal number of employees getting salary between 10,000 to 15,000.
*/
#include <stdio.h>
int main()
{
float salary[300];
int i,count=0;
printf("enter salary of 300 employees\n");
for(i=0;i<=299;i++)
{
scanf("%f",&salary[i]);
if(salary[i]>=10000 && salary[i]<=15000)
{
count++;
}
}
printf("total number of employees getting salary in 10000 and 15000 is=%d",count);
return 0;
}
q3)
a)Write a program to sort an array of n elements in descending order.[10]
Ans:-
/* program to sort n elements in descending order and print them.
*/
#include <stdio.h>
int main()
{
int numbers[100];
int n,i,j,k;
printf("enter the size of n\n");
scanf("%d",&n);
printf("Enter numbers\n");
for(i=0;i<n;i++)
{
scanf("%d",&numbers[i]);
}
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(numbers[i]<numbers[j])
{
k=numbers[i];
numbers[i]=numbers[j];
numbers[j]=k;
}
}
}
printf("numbers in descending order are=:\n");
for(i=0;i<n;i++)
{
printf("%d\n",numbers[i]);
}
return 0;
}
b)Write a program to enter name,roll number and marks of 10 students and store them in a file.Read and display the same from the file.[10].
Ans:-
#include<stdio.h>
int main()
{
FILE *p;
char name[100];
int roll;
int eng,phy,maths,chem,csc;
p=fopen("student.dat","w");
printf("enter name,roll marks in eng,phy,maths,chem and csc\n");
printf("To exit ,press ctrl+z\n");
while((scanf("%s%d%d%d%d%d%d",name,&roll,&eng,&phy,&maths,&chem,&csc))!=EOF)
{
fprintf(p,"%s\t%d\t%d\t%d\t%d\t%d\t%d",name,roll,eng,phy,maths,chem,csc);
}
fclose(p);
p=fopen("student.dat","r");
printf("data are\n");
while((fscanf(p,"%s%d%d%d%d%d%d",name,&roll,&eng,&phy,&maths,&chem,&csc))!=EOF)
{
printf("name=%s,roll=%d, english=%d,physics=%d,maths=%d,chemistry=%d ,csc=%d \n",name,roll,eng,phy,maths,chem,csc);
}
fclose(p);
return 0;
}
Group-B(5x7=35)
Attempt any five questioons.
q4)What do you understand by the term data integrity?Why is it important in designing database?[2+5]
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.
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.
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.
Importance:-
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.
q5)What is feasibility study?Explain different level of feasibility study?[2+5]
Ans:-
It has following types.
q6)Why polymorphism and inheritance are important concepts of OOP?Explain.[7]
Ans:-
q7)Define program logic.Explain different program logic tools.[2+5]
Ans:-
Program Logic:
These are the tools we use in system design.They are quite helpful to understand different parts of system as well as progam.Mostly they use diagrammatic concept to represent our program.It makes clear about data,flows,conditions etc.
.It describes desired features and operations in detail, including screen layouts, business rules, process diagrams, pseudo code and other documentation. We can use two designing methods namely logical (what is required for IS) and physical (how to achieve requirements). At first we design logical and then it is converted into physical design. A prototype should be developed during the logical design phase if possible. The detailed design phase modifies the logical design and produces a final detailed design, which includes technology choices, specifies a system architecture, meets all system goals for performance, and still has all of the application functionality and behavior specified in the logical design.
This design can carry following activities:
Defining precisely the required system output
Determining the data requirement for producing the output
Determining the medium and format of files and databases
Devising processing methods and use of software to produce output
Determine the methods of data capture and data input
Algorithm:
An algorithm is an effective method or a tool for solving a problem using a finite sequence of well organized instructions. Algorithms are used for calculation, data processing, and many other fields.
Each algorithm is a list of well-defined instructions for completing a task. Starting from an initial state, the instructions describe a computation that proceeds through a well-defined series of successive states, eventually terminating in a final ending state. For example,
-->start
-->read a no. x
-->read a no. y
→ let sum=x+y
-->display sum
-->stop
Decision tree:- 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.
q8)What is ysystem ananysis?What are the major objectives of system ananlysis?Explain.[2+5]
Ans:-
system ananysis:-
Once the problems identified, it is time to analyze the type of software that could answer the problems encountered. System analysis (may be by system analyst) will take a look at possible software. The goal of a system analysis is to know the properties and functions of software that would answer the concerns solicited from intended users.
System Analysis would lead in determining the requirements needed in software. These requirements in software should be implemented otherwise the software may not answer the concerns or may lack in its usage. This stage will somehow determine how the software should function.
It is the study of complete business system or parts of business system and application of information gained from that study to design,documentation and implementation of new or improved system. This field is closely related to operations research. An analyst work with users to determine the expectation of users from the proposed system.
Major objective of analysis:
The development of a computer-based information system often comprises the use of a systems analyst. When a computer-based information system is developed, systems analysis would constitute the following steps/points.
The development of a feasibility study, involving determining whether a project is economically, socially,, technologically, organisationally,legally, schedule feasible.
Conducting fact-finding measures, designed to ascertain the requirements of the system's end-users typically interviewing, questionnaires, or visual observations of work on the existing system.
It gives us answer of go /or do not go for development.
q9)Explain benefits of centralized database.
Ans:-
Meaning:-
A centralized database (sometimes abbreviated CDB) is a database that is located, stored, and maintained in a single location. ... Users access a centralized database through a computer network which is able to give them access to the central CPU, which in turn maintains to the database itself.This centralized database is mainly used by institutions or organizations. Since all data is stored at a single location only thus it is easier to access and co-ordinate data. The centralized database has very minimal data redundancy since all data is stored at a single place.
Benefits:-
->Job is centralized.
->It Can not process if main server fails.
->Its Security is given to one machine.
->No need to have network for communication.Not so expensive to set up.
->Data speed is comparatively fast.
q10)What are the types of LAN topology?epxlain with diagram.
Ans:-
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
q11)What do understand by AI?How it affects the modern society?[2+5]
Ans:-
AI:-
Artificial intelligence is where machines can learn and make decisions similarly to humans. There are many types of artificial intelligence including machine learning, where instead of being programmed what to think, machines can observe, analyse and learn from data and mistakes just like our human brains can. This technology is influencing consumer products and has led to significant breakthroughs in healthcare and physics as well as altered industries as diverse as manufacturing, finance and retail. In part due to the tremendous amount of data we generate every day and the computing power available, artificial intelligence has exploded in recent years. We might still be years away from generalised AI—when a machine can do anything a human brain can do—, but AI in its current form is still an essential part of our world.
Effects in modern society:-
I think without AI our society can not move.Everywhere we can find use of AI to make our life better and manageable. We have found use of AI in different fields may be business, may be transport, may be aircraft,search,pattern recognition etc.So I think perhaps there would be a society which is not affected.
Not only that much we have found use of AI in watch which monitors our heart pulse, our calorie burnt, our temprature etc.Even we can see in online platforms may be stock market or B2B or C2C , when we buy or request for informtsions, it is interpreeted by a chat bt automatically.So in nutshell without AI we can not imagine our life.
q12)Write short notes on:
a)Data dictinaory
Ans:-
Database users and application developers can benefit from an authoritative data dictionary document that catalogs the organization, contents, and conventions of one or more databases. The term "data dictionary" is used by many, including myself, to denote a separate set of tables that describes the application tables. The Data Dictionary contains such information as column names, types, and sizes, but also descriptive information such as titles, captions, primary keys, foreign keys, and hints to the user interface about how to display the field.
A super-simple beginning Data Dictionary might look like this:
Among other items of information, it records (1) what data is stored, (2) name, description, and characteristics of each data element, (3) types of relationships between data elements, (4) access rights and frequency of access. Also called system dictionary when used in the context of a system design.
A data dictionary document also may include further information describing how data elements are encoded. One of the advantages of well-designed data dictionary documentation is that it helps to establish consistency throughout a complex database, or across a large collection of federated databases
b)cyber Law:-
This law is commonly known as the law of the internet. It governs the legal issues of computers, Internet, data, software, computer networks and so on. These terms of legal issues are collectively known as cyberspace. In other words, it is a type of law which rules on the Internet to prevent Internet related crime.
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.
El Cajon, the only on casino in town
ReplyDeleteI 샌즈 카지노 먹튀 am looking 더킹 카지노 for an old 더킹 카지노 회원 가입 friend, or a former employee, in the future. At El Cajon, 카지노 사이트 제작 he is a former employee of 온 카지노 가입 쿠폰
Playtech casino - 100% Welcome Bonus up to €100
ReplyDeleteBest Online Casino for Free with up to €100 casino 룰렛 배당 bonus, 벤델핀 With a high level 먹튀 없는 사이트 of customer support, players can request to 서산 휴게텔 give feedback 솔레어카지노 on their
Slots - Casino Games at the PlayAmo Casino - DRMCD
ReplyDeleteThe 수원 출장샵 Slots Online Game is a fantastic option for your players 김제 출장샵 to play 청주 출장샵 Slots on your 경상북도 출장마사지 phone, 정읍 출장샵 tablet or mobile device.