Computer - NEB - 2079 Model Set Ans
Computer - NEB - 2079 Model Set Ans
2079(2023)
Computer Science
Candidates are required to give their answer in their own words as far as
practicable. The figures in the margin indicate full marks.
Time: -2 hrs. Full Marks: - 50
Group A
Rewrite the correct options of each question in your answer sheet.
(9x1=9)
1. In which normal form of database, atomicity is introduced?
A) First
B) Second
C) Third
D) Fourth
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.
return 0;
} 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.
Answer:
#include <stdio.h>
#include <stdlib.h>
struct student {
int reg_no;
char name[50];
char gender;
char address[100];
};
int main() {
FILE *fp;
struct student s;
char another;
fp = fopen("score.dat", "wb");
if (fp == NULL) {
printf("Error opening file.\n");
exit(1);
}
do {
printf("Enter student information:\n");
printf("Reg_no: ");
scanf("%d", &s.reg_no);