object oriented programming quiz 1, Exercises of Object Oriented Programming

this document will help student and teacher to prepare quiz of object oriented programming

Typology: Exercises

2019/2020

Uploaded on 10/25/2020

mehwish-mehmood
mehwish-mehmood 🇵🇰

2.3

(3)

6 documents

1 / 7

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Name: ____________________________________Roll#.________________________________
1. Identify the errors in section of code shown below [2 Marks]
public class Test {
public static void main(String[] args) {
int a = 3;
int b = 4;
int c = 20;
average = (a + b + c)/5.0;
System.out.println(average);}}
___________________________________________________________________________
2. Decide whether each statement below is TRUE or false. [1 Marks]
a. Java case-sensitive.
b. The purpose of substring is to search for whether a word is found in a sentence.
3. Take 10 elements of integer type in one dimensional array and find out their sum
[2 Marks]
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
SIR SYED UNIVERSITY OF ENGINEERING & TECHNOLOGY
BIOINFORMATICS DEPARTMENT
FALL 2019
OBJECT OORIENTED PROGRAMMING (CS-224)
Quiz 1(A)
Semester: IV Batch: 2018
Max Time: 15 mins Max Marks: 05
Instructions:
Attempt all questions
pf3
pf4
pf5

Partial preview of the text

Download object oriented programming quiz 1 and more Exercises Object Oriented Programming in PDF only on Docsity!

Name: ____________________________________Roll#.________________________________

  1. Identify the errors in section of code shown below [2 Marks] public class Test { public static void main(String[] args) { int a = 3; int b = 4; int c = 20; average = (a + b + c)/5.0; System.out.println(average);}}

  1. Decide whether each statement below is TRUE or false. [1 Marks] a. Java case-sensitive. b. The purpose of substring is to search for whether a word is found in a sentence.
  2. Take 10 elements of integer type in one dimensional array and find out their sum [2 Marks]
















BIOINFORMATICS DEPARTMENT FALL 2019 OBJECT OORIENTED PROGRAMMING (CS-224) Quiz 1(A) Semester: IV Batch: 2018 Max Time: 15 mins Max Marks: 05 Instructions:  Attempt all questions

Name: ____________________________________Roll#._______________________________ _

  1. What is the difference between print and println? [2Marks]


  2. Identify the errors in section of code shown below [1 Mark] public class Test { public static void main(String[] args) { Scanner console = new Scanner(System.in); int n = console.nextInt(); } } _________________________________________________________________________
  3. Take 10 elements of integer type in one dimensional array and find out their average.[2 Mark]

















    **BIOINFORMATICS DEPARTMENT** **FALL 2019 

OBJECT OORIENTED PROGRAMMING (CS-224) Quiz 1(B)** Semester: IV Batch: 2018 Max Time: 15 mins Max Marks: 05 Instructions:  Attempt all questions

Name: ____________________________________Roll#.________________________________

  1. What is the purpose of charAt() method? [2 Marks]



  2. Identify the errors in section of code shown below. [1 Marks] public class Test { public static void main(Strings[] args) { Scanner console = new Scanner(System.in); n = console.nexFloatt(); } }

  1. Write a java program to find left diagonal sum of the matrix.[2 Marks]













_ BIOINFORMATICS DEPARTMENT FALL 2019 OBJECT OORIENTED PROGRAMMING (CS-224) Quiz 1(D) Semester: IV Batch: 2018 Max Time: 15 mins Max Marks: 05 Instructions:  Attempt all questions

Name: ____________________________________ Enrolment#.________________________________

  1. How a constant is defined in java? [2 Marks]


  2. If you run the code below, what gets printed out? [1 Marks]

String s=new String("Bicycle");

int iBegin=1;

int iEnd=3;

System.out.println(s.substring(iBegin,iEnd));

____________________________________________________________

  1. Write a Java program to test the equality of two arrays. [1 Marks]















    **BIOINFORMATICS DEPARTMENT** **FALL 2019 

OBJECT OORIENTED PROGRAMMING (CS-224) Quiz 1(E)** Semester: IV Batch: 2018 Max Time: 15 mins Max Marks: 05 Instructions:  Attempt all questions

Name: ____________________________________Roll#.________________________________

  1. What is the argument type of program’s main( ) method? [2 Mark]
  2. Which type cast must be used to convert a larger value into a smaller one?(Implicit/Explicit) [ Mark] ___________________________________________________________________________
  3. Add code to the program so that it reads the user's first and last name (read an entire line as a single string), then prints the last name followed by a comma and the first initial. (Assume that the user types a valid name.) [2 Mark] Example: Type your name: Jessica Miller Your name is: Miller, J.

















    **BIOINFORMATICS DEPARTMENT** **FALL 2019 

OBJECT OORIENTED PROGRAMMING (CS-224) Quiz 1(F)** Semester: IV Batch: 2018 Max Time: 15 mins Max Marks: 05 Instructions:  Attempt all questions