Java i/o - reading inputs
in Java
Assignment Questions
Assignment Questions
Q1 - Input name, roll number and field of interest from user and print in the format below :
Name: xyz, Roll number: xyz, Field of interest: xyz
Input : Single line format
Aman Gupta 4053 Physics
Output :
Name: Aman Gupta
Roll Number: 4053
Field of interest: Physics
Q2 - Input two different string and print them in same line.
Input :
Level
Up
Output :
LevelUp
Q3 - If the marks of Robert in three subjects are entered through keyboard (each out of
100), write a program to calculate his total marks and percentage marks.
Input :
78
89
95
Output : Total marks: 262
Percentage marks: 87%
Q4 - Given two numbers, return their sum in the following format:
Int t representing number of test cases
T lines of Two integers representing the numbers to be added
Input :
3
45
18 20
49 27
Output :
9
38
76
Q5 - Given few lines of input(number of lines unknown) where each line has two
strings, concatenate the strings.
Input :
Hello World
Happy Faces
Sunny Day
Good Morning
Cracking the Coding Interview in Java - Foundation
Assignment Questions
Output :
HelloWorld
HappyFaces
SunnyDay
GoodMorning
Cracking the Coding Interview in Java - Foundation