NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io


Enunt: Quiz Maker - Scrieti o aplicatia care citeste random intrebari dintr-un fisier si construieste un quiz cu 10 intrebari pentru studenti. Cere studentului sa raspunda la quiz, iar apoi evalueaza si da o nota.

-----------------------------------------------------------------------------
//Clasa QuizMaker


import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Random;
import java.util.Scanner;

public class QuizMaker {

public static void main(String[] args) {

ArrayList<Questions> listaDeIntrebSiRasp = new ArrayList<Questions>();
Scanner FileInput = null;
Scanner keyboardInput = new Scanner(System.in);

int rezultat = 0;
try {
FileInput = new Scanner(new File("C:\Users\valentin.vizuroiu\workspace\Quiz Maker\src\questions"));
} catch (FileNotFoundException e) {

e.printStackTrace();
}
FileInput.useDelimiter("---|n");

while (FileInput.hasNext()) {
String numeIntrebare = FileInput.next();
String raspunsIntrebare = FileInput.next();

Questions newQuestion = new Questions(numeIntrebare, raspunsIntrebare, 0);
listaDeIntrebSiRasp.add(newQuestion);

String raspuns = "";

for (int i = 0; i < 10; i++) {

Random randomizer = new Random();

Questions random = listaDeIntrebSiRasp.get(randomizer.nextInt(listaDeIntrebSiRasp.size()));

System.out.println(random.getNumeIntrebare());
// keyboardInput.useDelimiter("/r/n ");
raspuns = keyboardInput.next(); // .next();

if (raspuns.equalsIgnoreCase(
random.getRaspunsIntrebare().substring(0, random.getRaspunsIntrebare().length() - 1))) {

rezultat++;
}

else {
System.out.println("Raspunsul corect era :" + random.getRaspunsIntrebare());
}

listaDeIntrebSiRasp.remove(listaDeIntrebSiRasp.indexOf(random));
}
System.out.println("Scor: " + rezultat);
keyboardInput.close();
}

}
-----------------------------------------------------------------------------------------------
// Clasa Questions

public class Questions {

private String numeIntrebare;
private String raspunsIntrebare;



public Questions(String numeIntrebare, String raspunsIntrebare, int numarIntrebare) {


this.numeIntrebare = numeIntrebare;
this.raspunsIntrebare = raspunsIntrebare;

}


public String getNumeIntrebare() {
return numeIntrebare;
}


public void setNumeIntrebare(String numeIntrebare) {
this.numeIntrebare = numeIntrebare;
}


public String getRaspunsIntrebare() {
return raspunsIntrebare;
}


public void setRaspunsIntrebare(String raspunsIntrebare) {
this.raspunsIntrebare = raspunsIntrebare;
}
}
--------------------------------------------------------
//Lista de intrebari

0- How many different colors does GIF format support? ---256 max
1- Which of these formats supports animation? ---GIF
2- What’s the difference between lossy and lossless compression? ---Lossless writes the data in a more efficient way, while lossy is optimised for file size
3- Which of these formats is lossy-compressed? ---JPEG
4- What happens, technically speaking, when a file is deleted on a FAT file system? ---The system modifies the filename's first character to signal that it has been deleted and that the directory entry can be recycled
5- What can someone like you do to ensure (with high probability) that files you delete cannot be recovered? ---Write NUL bytes (or random characters) to every address on the disk
6- What’s stdint.h? ---A bunch of typedefs and macros for making integer variables of custom sizes
7- What’s the continent you are living in? ---Europe
8- How many primary colors? ---3
9- What is love? ---Baby don't hurt me
10- What’s the difference between green and blue? ---yellow
11- What does it mean if biHeight is negative? --- If biHeight is negative, the bitmap is a top-down DIB with the origin at the upper left corner
12- What field in BITMAPINFOHEADER specifies the BMP’s color depth (i.e., bits per pixel)? ---biBitCount
13- Why might fopen return NULL in copy.c:37? ---If it can't find the file, it will
14- Why is the third argument to fread always 1 in our code? ---Because it specifies how many elements you want to read
15- What value does copy.c:70 assign padding if bi.biWidth is 3? ---The padding would be 3, because 3 pixels * 3 bytes per pixel * 3 padding = 12, which is a multiple of 4
16- What does black do? ---Obscures the light
17- What is Tm? ---Timis
18- What is the meaning of life? ---39
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.