0% found this document useful (0 votes)
2 views6 pages

Short Question For Terminal Exam

The document contains a comprehensive list of short questions from 19 Java lectures, covering topics from basic computer concepts to advanced Java programming techniques. Each lecture includes multiple questions that assess understanding of key concepts such as data types, loops, methods, arrays, file handling, and exception handling. The questions are designed for quick assessments, vivas, or exams.

Uploaded by

fz565916
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views6 pages

Short Question For Terminal Exam

The document contains a comprehensive list of short questions from 19 Java lectures, covering topics from basic computer concepts to advanced Java programming techniques. Each lecture includes multiple questions that assess understanding of key concepts such as data types, loops, methods, arrays, file handling, and exception handling. The questions are designed for quick assessments, vivas, or exams.

Uploaded by

fz565916
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Java Lecture Short Questions

Here is a complete list of short questions derived from all 19 Java lectures you
uploaded. These cover fundamental to advanced concepts, and are suitable for quick
assessments, viva, or exams:

Lecture 1: Introduction to Computers & Java

1. What is the function of the CPU in a computer?


2. Define memory in a computer system.
3. What is a byte and how is it used in memory?
4. Why is memory called volatile?
5. What are input and output devices? Give examples.
6. What does monitor resolution mean?
7. What is a communication device? Name one.
8. What is the difference between storage and memory?
9. What is meant by bus in computer architecture?
10. Define dot pitch in monitors.
11. What is a NIC?
12. What is the function of a modem?
13. Differentiate between primary and secondary storage.
14. What is a pixel?
15. How is data encoded in memory?

Lecture 2: Java Programming IDEs

16. What is Eclipse?


17. Why do we need a JDK to run Eclipse?
18. What is a workspace in Eclipse?
19. What is NetBeans used for?
20. What are the benefits of using an IDE?
21. Write the basic syntax of a HelloWorld Java program.
22. What is the output of System.out.println("The value of a is"+ a + b);
where a=5, b=10?
Lecture 3: Java Fundamentals – Basics

23. What is the structure of a simple Java program?


24. Define a class in Java.
25. What is the purpose of the main method?
26. What is an access specifier?
27. What is the function of System.out.println()?
28. Why do we use comments in Java?
29. What does a method header consist of?
30. What is the function of curly braces in a Java program?

Lecture 4: Java Fundamentals – Data Types & Operators

31. What are identifiers in Java?


32. Mention two rules for writing identifiers.
33. What is the difference between int, long, and short?
34. What is the default type for integer literals in Java?
35. Define a named constant in Java.
36. What are combined assignment operators?
37. Give an example of a mixed integer operation.
38. What is the purpose of the Math class?
39. What is type casting in Java?
40. What is the smallest primitive integer type in Java?

Lecture 5: Strings, Scope & Scanner

41. What is the String class used for?


42. How do you create a String object?
43. What does the charAt() method do?
44. How is length() method used in strings?
45. What does toUpperCase() return?
46. What is a variable’s scope?
47. What is a local variable?
48. Can two local variables have the same name?
49. What class is used to get user input in Java?
50. How do you convert a String input into an integer?
Lecture 7: Loops

51. What is the syntax of a while loop?


52. What is a sentinel value?
53. How is a do-while loop different from a while loop?
54. What is the syntax of a for loop?
55. What is loop control variable?
56. What is the use of break in loops?
57. What happens if the loop continuation condition never becomes false?
58. What is loop nesting?
59. Why should we avoid floating point comparison in loops?
60. Give an example of a loop that calculates the sum of numbers from 1 to 100.

Lecture 8: Methods

61. What is a method in Java?


62. Define method signature.
63. What is the difference between formal and actual parameters?
64. What is method overloading?
65. What is method abstraction?
66. What is the return type of a method?
67. What is a void method?
68. What are the benefits of using methods?
69. What is meant by passing by value in Java?
70. What is stepwise refinement?

Lecture 9: Strings & File Basics

71. What is the difference between String, StringBuilder, and StringBuffer?


72. What does equals() method do?
73. How do you find the length of a string?
74. How do you extract a substring in Java?
75. What does compareTo() return?
76. What is the use of indexOf() method?
77. What does the trim() method do?
78. What is immutability in Strings?
79. What is the output of "apple".compareTo("berry")?
80. How do you convert a number to a String?
Lecture 10: 1D Arrays

81. What is an array in Java?


82. How do you declare a one-dimensional array?
83. What is the default value of an int array?
84. How is array size obtained?
85. What is the difference between length and index in arrays?
86. What is an array initializer?
87. What is foreach loop used for?
88. What is selection sort?
89. What is linear search?
90. What is the output of array[0] = array[1] + array[4]; in a 5-element int
array?

Lecture 11: Multidimensional Arrays

91. How do you declare a 2D array?


92. What is a ragged array?
93. What is the syntax for accessing an element at row 2, column 3?
94. What does array.length return for a 2D array?
95. What is the difference between a row and column in a 2D array?
96. How do you pass a 2D array to a method?
97. What is random shuffling in 2D arrays?
98. What is meant by matrix in Java?
99. How do you find the total number of elements in a 2D array?
100. Give an example of initializing a 2D array using shorthand notation.

Lecture 12: Command-Line Arguments

101. What is the signature of the main method?


102. How do you pass arguments via command line?
103. What is args.length used for?
104. What type is the args parameter?
105. How do you convert a command-line argument into an integer?
106. What happens if no arguments are passed to main()?
107. What does args[0] refer to?
108. How can you use command-line arguments in loops?
109. Can you pass multiple arguments via command line?
110. What class is used to parse command-line values?
Lecture 13: Recursion

111. What is recursion?


112. What is a base case in recursion?
113. What happens if there is no base case?
114. What is factorial and how is it calculated recursively?
115. Write the recursive definition of factorial.
116. What is the Fibonacci sequence?
117. How is fib(n) defined recursively?
118. What error occurs in infinite recursion?
119. How is recursion different from iteration?
120. What is a recursive call?

Lecture 14: Software Testing (can be skipped as per instruction)

(You mentioned to ignore software testing topics; skipping these.)

Lecture 15: Multidimensional Arrays Continued

(Already covered in Q91–Q100; duplicates removed)

Lecture 16: Recursion Advanced (Already covered)

Lecture 17: Unit Testing (SKIPPED)

(As per instruction to skip software testing topics)

Lecture 18: File Handling

121. What is a file?


122. What is the difference between text and binary file?
123. What is a stream in Java?
124. What is the use of Scanner in file reading?
125. How is PrintWriter used?
126. What is try-with-resources?
127. What class is used to get file properties?
128. What does close() do in file operations?
129. What exception is commonly thrown in file I/O?
130. How do you read a file line-by-line in Java?

Lecture 19: Exception Handling

131. What is an exception?


132. Difference between Error and Exception?
133. What is a try-catch block?
134. What is a checked exception?
135. What is an unchecked exception?
136. What is throws keyword used for?
137. What is the purpose of finally block?
138. Give an example of throwing an exception.
139. What is throw vs throws?
140. What is InputMismatchException?

You might also like