programming languages Online Quiz - 44
Description: programming languages Online Quiz - 44 | |
Number of Questions: 20 | |
Created by: Aliensbrain Bot | |
Tags: programming languages |
Encapsulation is the process of basing one class on another.
#include main() { char a[4]="HELLO"; printf("%s",a); }
#include main() { int a[2][2][2] = {{10,2,3,4},{5,6,7,8}}; int p,*q; p=&a[2][2][2]; *q=**a printf("%d----%d",*p,*q); }
#include main (){ unsigned int a = 0xf0ad; char *c = (char *) &a; printf("value @c: %x",*c); }
#include main(){ extern int i; i=23; printf("%d",i); }
#include main(){ static int a[20]; int i=0; a[i]=i++; printf("%d %d %d",a[0],a[1],i); }
#include main(){ int a=2; int *p=&a; print("%x\t",p); print("%x\t",*p++); print("%x\t",p); }
main() { int a[5] = {10,20,30,40,50}; char *p; p=(char *)a; printf("%d\n",a); }
#include main (){ char c[] = "Hello"; char *p = "Hello"; printf("Size of c: %d Addr of c:%x\n",sizeof(c),c); }
Can a variable be declared as both const and volatile
Which of the below symbol is used to make comments in C language?
public abstract class AbstractTest { public int getNum() { return 45; } public abstract class Bar { public int getNum() { return 38; } } public static void main(String[] args) { AbstractTest t = new AbstractTest() { public int getNum() { return 22; } }; AbstractTest.Bar f = t.new Bar() { public int getNum() { return 57; } }; System.out.println(f.getNum() + " " + t.getNum()); } }
class Plane { static String s = "-"; public static void main(String[] args) { new Plane().s1(); System.out.println(s); } void s1() { try { s2(); } catch (Exception e) { s += "c"; } } void s2() throws Exception { s3(); s += "2"; s3(); s += "2b"; } void s3() throws Exception { throw new Exception(); } }
- class Loopy { 2. public static void main(String[] args) { 3. int[] x = {7,6,5,4,3,2,1}; 4. // insert code here 5. System.out.print(y + " "); 6. } 7. } }
Given: 3. public class Circles { 4. public static void main(String[] args) { 5. int[] ia = {1,3,5,7,9}; 6. for(int x : ia) { 7. for(int j = 0; j < 3; j++) { 8. if(x > 4 && x < 8) continue; 9. System.out.print(" " + x); 10. if(j == 1) break; 11. continue; 12. } 13. continue; 14. } 15. } 16. }
- public class Wind { 4. public static void main(String[] args) { 5. foreach: 6. for(int j=0; j<5; j++) { 7. for(int k=0; k< 3; k++) { 8. System.out.print(" " + j); 9. if(j==3 && k==1) break foreach; 10. if(j==0 || j==2) break; 11. } 12. } 13. } 14. }
What will be printed by the code below? my $val = 'x'; print ref($val);
What will be printed by the following code? package A; sub new { return bless {}; } sub foo { return 'A'; } package B; use base 'A'; sub foo { return 'B'; } package main; my $obj = B->new(); print $obj->foo(), "\n";
What will be the value of $val? my $str = 'aa bb cccc'; my $val = () = $str =~ /\w+/g;
What gets printed? my $a = 123; my $b = 0123; if ($a == $b) { print "same"; } else { print "different"; }