0% found this document useful (0 votes)
15 views

Assignment-1

This document is an assignment for a Programming 1 course at Jazan University in Saudi Arabia for the 2023-2024 academic year. It contains 5 questions: 1. Write the output of 5 code snippets. 2. Identify the class name, method, statements, and comments in a code sample. 3. Fill in a variable name table marking names as valid or invalid. 4. Write a Java program using chained if-else statements to display the type of day based on a user input. The assignment is worth 10 marks and is due on January 15, 2024. It provides practice on programming fundamentals like output, code analysis, variables, and conditional statements.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Assignment-1

This document is an assignment for a Programming 1 course at Jazan University in Saudi Arabia for the 2023-2024 academic year. It contains 5 questions: 1. Write the output of 5 code snippets. 2. Identify the class name, method, statements, and comments in a code sample. 3. Fill in a variable name table marking names as valid or invalid. 4. Write a Java program using chained if-else statements to display the type of day based on a user input. The assignment is worth 10 marks and is due on January 15, 2024. It provides practice on programming fundamentals like output, code analysis, variables, and conditional statements.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

KINGDOM OF SAUDI ARABIA | JAZAN UNIVERSITY

COLLEGE OF COMPUTER SCIENCE & INFORMATION SYSTEMS


ASSIGNMENT-1 : 2023-2024
Academic Year 2023-2024 Semester 2
Course with code Programming 1 Section
Type of Assignment Question and answer Max. Marks 10 Marks
Date of Announcement Deadline 15-01-2024

Student Name Student ID

ASSIGNMENT PROBLEM STATEMENT


(Theory)

1. Write the output of each line. 5 Marks

Ans

1- int r=19, y=3; 1-………………………….

System.out.println("\n The value="+r%y);

2- System.out.print("My name is:Asma”)); 2-………………………….

System.out.print("My age is:22”));

3- System.out.println("\t Java Programming”);


3-………………………….
4- int n=15;
4-………………………….
int m=5;

double ans = n / (double)m;

System.out.println(ans);

5- System.out.println("The value is " + 10 ); 5-………………………….


2. Identify from the following: 3 Marks
//This code has my name and my ID

public class Ex
{
public static void main(String[] args)
{
System.out.print("My Name is: Ahmad ");
System.out.print("My ID is: 20901234 ");

} }

i) What is the class name from the above?


ii) Method?
iii) Statements?
iv) Comments?

3. Filled up the Variable Name Table with the valid or invalid: 1 Marks

Name valid / invalid


8sum
Book Title
bookName
A_7b

4. Write a Java program to accept the day from the user and display the following using
chained if-else statement. (1 Mark)

day=6 and day=7 - Holiday


day=1 or day=2 - Working day
day=3 or day=4 – Middle days

Name of the Course LAILA BIN LEBDAH Signature


Teacher

You might also like